SourceForge logo
SourceForge logo
Menu

matplotlib-checkins

From: <ry...@us...> - 2009年01月16日 20:07:01
Revision: 6797
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6797&view=rev
Author: ryanmay
Date: 2009年01月16日 20:06:55 +0000 (2009年1月16日)
Log Message:
-----------
Merge evans_test2.py and radian_demo.py, as they are 99% identical (no differences in showing off units support).
Modified Paths:
--------------
 trunk/matplotlib/examples/units/radian_demo.py
Removed Paths:
-------------
 trunk/matplotlib/examples/units/evans_test2.py
Deleted: trunk/matplotlib/examples/units/evans_test2.py
===================================================================
--- trunk/matplotlib/examples/units/evans_test2.py	2009年01月16日 18:56:11 UTC (rev 6796)
+++ trunk/matplotlib/examples/units/evans_test2.py	2009年01月16日 20:06:55 UTC (rev 6797)
@@ -1,25 +0,0 @@
-"""
-Plot with radians from the basic_units mockup example package
-This example shows how the unit class can determine the tick locating,
-formatting and axis labeling.
-"""
-import numpy as np
-from basic_units import radians, degrees, cos
-from pylab import figure, show
-from matplotlib.cbook import iterable
-import math
-
-
-x = np.arange(0, 15, 0.01) * radians
-
-
-fig = figure()
-
-ax = fig.add_subplot(211)
-ax.plot(x, cos(x), xunits=radians)
-
-ax = fig.add_subplot(212)
-ax.plot(x, cos(x), xunits=degrees)
-
-show()
-
Modified: trunk/matplotlib/examples/units/radian_demo.py
===================================================================
--- trunk/matplotlib/examples/units/radian_demo.py	2009年01月16日 18:56:11 UTC (rev 6796)
+++ trunk/matplotlib/examples/units/radian_demo.py	2009年01月16日 20:06:55 UTC (rev 6797)
@@ -1,11 +1,17 @@
+"""
+Plot with radians from the basic_units mockup example package
+This example shows how the unit class can determine the tick locating,
+formatting and axis labeling.
+"""
 import numpy as np
 from basic_units import radians, degrees, cos
-from pylab import figure, show
+from matplotlib.pyplot import figure, show
 
 x = np.arange(0, 15, 0.01) * radians
 
 fig = figure()
 fig.subplots_adjust(hspace=0.3)
+
 ax = fig.add_subplot(211)
 ax.plot(x, cos(x), xunits=radians)
 
@@ -13,4 +19,3 @@
 ax.plot(x, cos(x), xunits=degrees)
 
 show()
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jr...@us...> - 2009年02月24日 15:38:36
Revision: 6930
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6930&view=rev
Author: jrevans
Date: 2009年02月24日 15:38:33 +0000 (2009年2月24日)
Log Message:
-----------
Updated to reflect updated unit conversion interface.
Modified Paths:
--------------
 trunk/matplotlib/examples/units/basic_units.py
 trunk/matplotlib/examples/units/date_support.py
 trunk/matplotlib/examples/units/evans_test.py
Modified: trunk/matplotlib/examples/units/basic_units.py
===================================================================
--- trunk/matplotlib/examples/units/basic_units.py	2009年02月23日 17:43:26 UTC (rev 6929)
+++ trunk/matplotlib/examples/units/basic_units.py	2009年02月24日 15:38:33 UTC (rev 6930)
@@ -304,7 +304,8 @@
 
 class BasicUnitConverter(units.ConversionInterface):
 
- def axisinfo(unit):
+ @staticmethod
+ def axisinfo(unit, axis):
 'return AxisInfo instance for x and unit'
 
 if unit==radians:
@@ -326,9 +327,8 @@
 return units.AxisInfo(label=unit.unit.fullname)
 return None
 
- axisinfo = staticmethod(axisinfo)
-
- def convert(val, unit):
+ @staticmethod
+ def convert(val, unit, axis):
 if units.ConversionInterface.is_numlike(val):
 return val
 #print 'convert checking iterable'
@@ -336,15 +336,14 @@
 return [thisval.convert_to(unit).get_value() for thisval in val]
 else:
 return val.convert_to(unit).get_value()
- convert = staticmethod(convert)
 
- def default_units(x):
+ @staticmethod
+ def default_units(x, axis):
 'return the default unit for x or None'
 if iterable(x):
 for thisx in x:
 return thisx.unit
 return x.unit
- default_units = staticmethod(default_units)
 
 
 
Modified: trunk/matplotlib/examples/units/date_support.py
===================================================================
--- trunk/matplotlib/examples/units/date_support.py	2009年02月23日 17:43:26 UTC (rev 6929)
+++ trunk/matplotlib/examples/units/date_support.py	2009年02月24日 15:38:33 UTC (rev 6930)
@@ -8,7 +8,8 @@
 
 class DateConverter(units.ConversionInterface):
 
- def axisinfo(unit):
+ @staticmethod
+ def axisinfo(unit, axis):
 'return the unit AxisInfo'
 if unit=='date':
 majloc = dates.AutoDateLocator()
@@ -19,17 +20,16 @@
 label='date',
 )
 else: return None
- axisinfo = staticmethod(axisinfo)
 
- def convert(value, unit):
+ @staticmethod
+ def convert(value, unit, axis):
 if units.ConversionInterface.is_numlike(value): return value
 return dates.date2num(value)
- convert = staticmethod(convert)
 
- def default_units(x):
+ @staticmethod
+ def default_units(x, axis):
 'return the default unit for x or None'
 return 'date'
- default_units = staticmethod(default_units)
 
 
 units.registry[datetime.date] = DateConverter()
Modified: trunk/matplotlib/examples/units/evans_test.py
===================================================================
--- trunk/matplotlib/examples/units/evans_test.py	2009年02月23日 17:43:26 UTC (rev 6929)
+++ trunk/matplotlib/examples/units/evans_test.py	2009年02月24日 15:38:33 UTC (rev 6930)
@@ -24,7 +24,8 @@
 
 class FooConverter:
 
- def axisinfo(unit):
+ @staticmethod
+ def axisinfo(unit, axis):
 'return the Foo AxisInfo'
 if unit==1.0 or unit==2.0:
 return units.AxisInfo(
@@ -35,9 +36,9 @@
 
 else:
 return None
- axisinfo = staticmethod(axisinfo)
 
- def convert(obj, unit):
+ @staticmethod
+ def convert(obj, unit, axis):
 """
 convert obj using unit. If obj is a sequence, return the
 converted sequence
@@ -49,16 +50,15 @@
 return [o.value(unit) for o in obj]
 else:
 return obj.value(unit)
- convert = staticmethod(convert)
 
- def default_units(x):
+ @staticmethod
+ def default_units(x, axis):
 'return the default unit for x or None'
 if iterable(x):
 for thisx in x:
 return thisx.unit
 else:
 return x.unit
- default_units = staticmethod(default_units)
 
 units.registry[Foo] = FooConverter()
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
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.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /