|
From: <jd...@us...> - 2008-10-17 16:03:33
|
Revision: 6243
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6243&view=rev
Author: jdh2358
Date: 2008-10-17 16:03:23 +0000 (Fri, 17 Oct 2008)
Log Message:
-----------
moved two scales example to api
Added Paths:
-----------
trunk/matplotlib/examples/api/two_scales.py
Removed Paths:
-------------
trunk/matplotlib/examples/pylab_examples/two_scales.py
Copied: trunk/matplotlib/examples/api/two_scales.py (from rev 6242, trunk/matplotlib/examples/pylab_examples/two_scales.py)
===================================================================
--- trunk/matplotlib/examples/api/two_scales.py (rev 0)
+++ trunk/matplotlib/examples/api/two_scales.py 2008-10-17 16:03:23 UTC (rev 6243)
@@ -0,0 +1,40 @@
+#!/usr/bin/env python
+"""
+
+Demonstrate how to do two plots on the same axes with different left
+right scales.
+
+
+The trick is to use *2 different axes*. Turn the axes rectangular
+frame off on the 2nd axes to keep it from obscuring the first.
+Manually set the tick locs and labels as desired. You can use
+separate matplotlib.ticker formatters and locators as desired since
+the two axes are independent.
+
+This is acheived in the following example by calling pylab's twinx()
+function, which performs this work. See the source of twinx() in
+pylab.py for an example of how to do it for different x scales. (Hint:
+use the xaxis instance and call tick_bottom and tick_top in place of
+tick_left and tick_right.)
+
+"""
+
+import numpy as np
+import matplotlib.pyplot as plt
+
+fig = plt.figure()
+ax1 = fig.add_subplot(111)
+t = np.arange(0.01, 10.0, 0.01)
+s1 = np.exp(t)
+ax1.plot(t, s1, 'b-')
+ax1.set_xlabel('time (s)')
+ax1.set_ylabel('exp')
+
+
+# turn off the 2nd axes rectangle with frameon kwarg
+ax2 = ax1.twinx()
+s2 = np.sin(2*np.pi*t)
+ax2.plot(t, s2, 'r.')
+ax2.set_ylabel('sin')
+plt.show()
+
Deleted: trunk/matplotlib/examples/pylab_examples/two_scales.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/two_scales.py 2008-10-17 16:02:52 UTC (rev 6242)
+++ trunk/matplotlib/examples/pylab_examples/two_scales.py 2008-10-17 16:03:23 UTC (rev 6243)
@@ -1,40 +0,0 @@
-#!/usr/bin/env python
-"""
-
-Demonstrate how to do two plots on the same axes with different left
-right scales.
-
-
-The trick is to use *2 different axes*. Turn the axes rectangular
-frame off on the 2nd axes to keep it from obscuring the first.
-Manually set the tick locs and labels as desired. You can use
-separate matplotlib.ticker formatters and locators as desired since
-the two axes are independent.
-
-This is acheived in the following example by calling pylab's twinx()
-function, which performs this work. See the source of twinx() in
-pylab.py for an example of how to do it for different x scales. (Hint:
-use the xaxis instance and call tick_bottom and tick_top in place of
-tick_left and tick_right.)
-
-"""
-
-import numpy as np
-import matplotlib.pyplot as plt
-
-fig = plt.figure()
-ax1 = fig.add_subplot(111)
-t = np.arange(0.01, 10.0, 0.01)
-s1 = np.exp(t)
-ax1.plot(t, s1, 'b-')
-ax1.set_xlabel('time (s)')
-ax1.set_ylabel('exp')
-
-
-# turn off the 2nd axes rectangle with frameon kwarg
-ax2 = ax1.twinx()
-s2 = np.sin(2*np.pi*t)
-ax2.plot(t, s2, 'r.')
-ax2.set_ylabel('sin')
-plt.show()
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|