Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 96ff817

Browse filesBrowse files
committed
Switch mri_demo.py to OO interface
1 parent db3d206 commit 96ff817
Copy full SHA for 96ff817

File tree

Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-2
lines changed

‎examples/pylab_examples/mri_demo.py

Copy file name to clipboardExpand all lines: examples/pylab_examples/mri_demo.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,18 @@
22

33
import matplotlib.pyplot as plt
44
import matplotlib.cbook as cbook
5+
import matplotlib.cm as cm
56
import numpy as np
67

8+
fig, ax = plt.subplots(num="MRI_demo")
9+
710
# Data are 256x256 16 bit integers
811
dfile = cbook.get_sample_data('s1045.ima.gz')
912
im = np.fromstring(dfile.read(), np.uint16).astype(float)
1013
im.shape = (256, 256)
1114
dfile.close()
1215

13-
plt.imshow(im, cmap=plt.cm.gray)
14-
plt.axis('off')
16+
ax.imshow(im, cmap=cm.gray)
17+
ax.axis('off')
1518

1619
plt.show()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.