You are reading an old version of the documentation (v1.5.3). For the latest version see https://matplotlib.org/stable/

Matplotlib 2.0.0rc2 is available

Install the release candidate now!

matplotlib

Travis-CI:

This Page

pylab_examples example code: mri_demo.pyΒΆ

(Source code, png, hires.png, pdf)

../../_images/mri_demo.png
from __future__ import print_function
import matplotlib.pyplot as plt
import matplotlib.cbook as cbook
import numpy as np
# data are 256x256 16 bit integers
dfile = cbook.get_sample_data('s1045.ima.gz')
im = np.fromstring(dfile.read(), np.uint16).astype(float)
im.shape = 256, 256

plt.imshow(im, cmap=plt.cm.gray)
plt.axis('off')

plt.show()

Keywords: python, matplotlib, pylab, example, codex (see Search examples)