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

Skip to content

Commit b957b96

Browse files
committed
added shared axis demo
svn path=/trunk/matplotlib/; revision=3405
1 parent 5448a1f commit b957b96

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
connect the data limits on the axes in one figure with the axes in
3+
another. This is not the right way to do this for two axes in the
4+
same figure -- use the sharex and sharey property in that case
5+
"""
6+
import numpy
7+
from pylab import figure, show
8+
9+
fig1 = figure()
10+
fig2 = figure()
11+
12+
ax1 = fig1.add_subplot(111)
13+
ax2 = fig2.add_subplot(111)
14+
15+
ax1.plot(numpy.random.rand(100), 'o')
16+
ax2.plot(numpy.random.rand(100), 'o')
17+
18+
ax1.sharex_foreign(ax2)
19+
ax2.sharex_foreign(ax1)
20+
21+
ax1.sharey_foreign(ax2)
22+
ax2.sharey_foreign(ax1)
23+
24+
25+
26+
show()

0 commit comments

Comments
 (0)