Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0f3cc9d

Browse files
committed
image_origin: remove interference between axis and tick labels
1 parent 02c09ce commit 0f3cc9d

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

examples/pylab_examples/image_origin.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,14 @@
77
import matplotlib.pyplot as plt
88
import numpy as np
99

10-
x = np.arange(100.0)
11-
x.shape = (10, 10)
10+
x = np.arange(120)
11+
x.shape = (10, 12)
1212

1313
interp = 'bilinear'
14-
#interp = 'nearest'
15-
lim = -2, 11, -2, 6
16-
plt.subplot(211, facecolor='g')
17-
plt.title('blue should be up')
18-
plt.imshow(x, origin='upper', interpolation=interp)
19-
#plt.axis(lim)
14+
fig, axs = plt.subplots(nrows=2, sharex=True, figsize=(3, 5))
15+
axs[0].set_title('blue should be up')
16+
axs[0].imshow(x, origin='upper', interpolation=interp)
2017

21-
plt.subplot(212, facecolor='y')
22-
plt.title('blue should be down')
23-
plt.imshow(x, origin='lower', interpolation=interp)
24-
#plt.axis(lim)
18+
axs[1].set_title('blue should be down')
19+
axs[1].imshow(x, origin='lower', interpolation=interp)
2520
plt.show()

0 commit comments

Comments
 (0)