You are reading an old version of the documentation (v1.4.3). For the latest version see

We're updating the default styles for Matplotlib 2.0

Learn what to expect in the new updates


Previous topic

pylab_examples example code:

Next topic

pylab_examples example code:

This Page

pylab_examples example code: mri_demo.pyΒΆ

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

#!/usr/bin/env python

from __future__ import print_function
from pylab import *
import matplotlib.cbook as cbook
# data are 256x256 16 bit integers
dfile = cbook.get_sample_data('s1045.ima.gz')
im = np.fromstring(, np.uint16).astype(float)
im.shape = 256, 256

#imshow(im, ColormapJet(256))
imshow(im, cmap=cm.gray)


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