Menu

Commit [r4603]  Maximize  Restore  History

Add experimental support for auto-layout of axes on the figure, to

prevent ticks and labels from overlapping things in other axes.

mdboom 2007-12-04

added /branches/transforms/examples/auto_layout.py
changed /branches/transforms/examples/backend_driver.py
changed /branches/transforms/examples/colorbar_only.py
changed /branches/transforms/examples/figlegend_demo.py
changed /branches/transforms/examples/finance_demo.py
changed /branches/transforms/examples/mathtext_demo.py
changed /branches/transforms/examples/simple_plot.py
changed /branches/transforms/lib/matplotlib/axes.py
changed /branches/transforms/lib/matplotlib/axis.py
changed /branches/transforms/lib/matplotlib/figure.py
changed /branches/transforms/lib/matplotlib/projections/polar.py
changed /branches/transforms/lib/matplotlib/rcsetup.py
/branches/transforms/examples/auto_layout.py Diff Switch to side-by-side view
--- a
+++ b/branches/transforms/examples/auto_layout.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+"""
+Example: simple line plot.
+Show how to make and save a simple line plot with labels, title and grid
+"""
+from pylab import *
+
+t = arange(0.0, 1.0+0.01, 0.01)
+s = cos(2*2*pi*t)
+ax1 = subplot(211)
+plot(t, s, '-', lw=2)
+
+xlabel('xlabel for bottom axes')
+ylabel('ylabel on the right')
+title('About as simple as it gets, folks')
+grid(True)
+ax1.yaxis.set_label_position('right')
+ax1.xaxis.set_ticklabels(['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday'])
+for label in ax1.get_xticklabels():
+    label.set_rotation(45)
+
+ax2 = subplot(212)
+plot(t, s, '-', lw=2)
+grid(True)
+xlabel('xlabel for bottom axes (the ticks are on the top for no good reason)')
+ylabel('I\'m a lefty')
+ax2.xaxis.set_label_position('bottom')
+ax2.xaxis.set_ticks_position('top')
+
+
+#savefig('simple_plot.png')
+savefig('simple_plot')
+
+show()
/branches/transforms/examples/backend_driver.py Diff Switch to side-by-side view
Loading...
/branches/transforms/examples/colorbar_only.py Diff Switch to side-by-side view
Loading...
/branches/transforms/examples/figlegend_demo.py Diff Switch to side-by-side view
Loading...
/branches/transforms/examples/finance_demo.py Diff Switch to side-by-side view
Loading...
/branches/transforms/examples/mathtext_demo.py Diff Switch to side-by-side view
Loading...
/branches/transforms/examples/simple_plot.py Diff Switch to side-by-side view
Loading...
/branches/transforms/lib/matplotlib/axes.py Diff Switch to side-by-side view
Loading...
/branches/transforms/lib/matplotlib/axis.py Diff Switch to side-by-side view
Loading...
/branches/transforms/lib/matplotlib/figure.py Diff Switch to side-by-side view
Loading...
/branches/transforms/lib/matplotlib/projections/polar.py Diff Switch to side-by-side view
Loading...
/branches/transforms/lib/matplotlib/rcsetup.py Diff Switch to side-by-side view
Loading...
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.