Revision: 8887
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8887&view=rev
Author: leejjoon
Date: 2011-01-05 15:43:01 +0000 (Wed, 05 Jan 2011)
Log Message:
-----------
improve demo_axes_hbox_divider.py
Modified Paths:
--------------
trunk/matplotlib/examples/axes_grid/demo_axes_hbox_divider.py
Modified: trunk/matplotlib/examples/axes_grid/demo_axes_hbox_divider.py
===================================================================
--- trunk/matplotlib/examples/axes_grid/demo_axes_hbox_divider.py 2011-01-05 13:31:24 UTC (rev 8886)
+++ trunk/matplotlib/examples/axes_grid/demo_axes_hbox_divider.py 2011-01-05 15:43:01 UTC (rev 8887)
@@ -3,7 +3,7 @@
from mpl_toolkits.axes_grid1.axes_divider import HBoxDivider
import mpl_toolkits.axes_grid1.axes_size as Size
-def make_heights_equal(fig, ax1, ax2, pad):
+def make_heights_equal(fig, rect, ax1, ax2, pad):
# pad in inches
h1, v1 = Size.AxesX(ax1), Size.AxesY(ax1)
@@ -12,7 +12,7 @@
pad_v = Size.Scaled(1)
pad_h = Size.Fixed(pad)
- my_divider = HBoxDivider(fig, 111,
+ my_divider = HBoxDivider(fig, rect,
horizontal=[h1, pad_h, h2],
vertical=[v1, pad_v, v2])
@@ -33,9 +33,10 @@
ax1.imshow(arr1, interpolation="nearest")
ax2.imshow(arr2, interpolation="nearest")
+
+ rect = 111 # subplot param for combined axes
+ make_heights_equal(fig1, rect, ax1, ax2, pad=0.5) # pad in inches
- make_heights_equal(fig1, ax1, ax2, pad=0.5)
-
for ax in [ax1, ax2]:
ax.locator_params(nbins=4)
@@ -43,6 +44,9 @@
ax3 = plt.axes([0.5, 0.5, 0.001, 0.001], frameon=False)
ax3.xaxis.set_visible(False)
ax3.yaxis.set_visible(False)
- ax3.annotate("Location of two axes are adjusted\n so that they have an equal height\n while maintaining their aspect ratios", (0.5, 0.5),
+ ax3.annotate("Location of two axes are adjusted\n so that they have equal heights\n while maintaining their aspect ratios", (0.5, 0.5),
xycoords="axes fraction", va="center", ha="center",
- bbox=dict(fc="w"))
+ bbox=dict(boxstyle="round, pad=1", fc="w"))
+
+ plt.show()
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|