SourceForge logo
SourceForge logo
Menu

matplotlib-checkins — Commit notification. DO NOT POST to this list, just subscribe to it.

You can subscribe to this list here.

2007 Jan
Feb
Mar
Apr
May
Jun
Jul
(115)
Aug
(120)
Sep
(137)
Oct
(170)
Nov
(461)
Dec
(263)
2008 Jan
(120)
Feb
(74)
Mar
(35)
Apr
(74)
May
(245)
Jun
(356)
Jul
(240)
Aug
(115)
Sep
(78)
Oct
(225)
Nov
(98)
Dec
(271)
2009 Jan
(132)
Feb
(84)
Mar
(74)
Apr
(56)
May
(90)
Jun
(79)
Jul
(83)
Aug
(296)
Sep
(214)
Oct
(76)
Nov
(82)
Dec
(66)
2010 Jan
(46)
Feb
(58)
Mar
(51)
Apr
(77)
May
(58)
Jun
(126)
Jul
(128)
Aug
(64)
Sep
(50)
Oct
(44)
Nov
(48)
Dec
(54)
2011 Jan
(68)
Feb
(52)
Mar
Apr
May
Jun
Jul
Aug
Sep
Oct
Nov
Dec
(1)
2018 Jan
Feb
Mar
Apr
May
(1)
Jun
Jul
Aug
Sep
Oct
Nov
Dec
S M T W T F S

1
(7)
2
(2)
3
(3)
4
5
(6)
6
(6)
7
(9)
8
(6)
9
(2)
10
(4)
11
12
(3)
13
(3)
14
(5)
15
16
(2)
17
(2)
18
19
(3)
20
21
(2)
22
23
(2)
24
(7)
25
(2)
26
(1)
27
(1)
28
29
(1)
30




Showing results of 79

<< < 1 2 3 4 > >> (Page 3 of 4)
From: <jd...@us...> - 2009年06月07日 14:13:18
Revision: 7194
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7194&view=rev
Author: jdh2358
Date: 2009年06月07日 14:13:12 +0000 (2009年6月07日)
Log Message:
-----------
update doc strings to point to new fill between demos
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2009年06月07日 13:58:48 UTC (rev 7193)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2009年06月07日 14:13:12 UTC (rev 7194)
@@ -6019,7 +6019,7 @@
 
 %(PolyCollection)s
 
- .. plot:: mpl_examples/pylab_examples/fill_between.py
+ .. plot:: mpl_examples/pylab_examples/fill_between_demo.py.py
 
 .. seealso::
 
@@ -6126,7 +6126,7 @@
 
 %(PolyCollection)s
 
- .. plot:: mpl_examples/pylab_examples/fill_betweenx.py
+ .. plot:: mpl_examples/pylab_examples/fill_betweenx_demo.py
 
 .. seealso::
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年06月07日 14:11:32
Revision: 7192
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7192&view=rev
Author: jdh2358
Date: 2009年06月07日 13:55:10 +0000 (2009年6月07日)
Log Message:
-----------
add support for bz2 files per sf support request 2794556
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/cbook.py
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py	2009年06月07日 13:46:10 UTC (rev 7191)
+++ trunk/matplotlib/lib/matplotlib/cbook.py	2009年06月07日 13:55:10 UTC (rev 7192)
@@ -314,6 +314,11 @@
 # get rid of 'U' in flag for gzipped files.
 flag = flag.replace('U','')
 fh = gzip.open(fname, flag)
+ elif fname.endswith('.bz2'):
+ # get rid of 'U' in flag for bz2 files
+ flag = flag.replace('U','')
+ import bz2
+ fh = bz2.BZ2File(fname, flag)
 else:
 fh = file(fname, flag)
 opened = True
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7191
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7191&view=rev
Author: jdh2358
Date: 2009年06月07日 13:46:10 +0000 (2009年6月07日)
Log Message:
-----------
fixed a doc tutorial url
Modified Paths:
--------------
 trunk/matplotlib/doc/users/pyplot_tutorial.rst
Modified: trunk/matplotlib/doc/users/pyplot_tutorial.rst
===================================================================
--- trunk/matplotlib/doc/users/pyplot_tutorial.rst	2009年06月07日 13:08:34 UTC (rev 7190)
+++ trunk/matplotlib/doc/users/pyplot_tutorial.rst	2009年06月07日 13:46:10 UTC (rev 7191)
@@ -271,4 +271,4 @@
 variety of other coordinate systems one can choose -- see
 :ref:`annotations-tutorial` for details. More examples can be found
 in the `annotations demo
-<http://matplotlib.sf.net/examples/pylab_examples/annotation_demo.py>`_
+<http://matplotlib.sf.net/examples/pylab_examples/annotation_demo.html>`_
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年06月07日 14:10:41
Revision: 7193
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7193&view=rev
Author: jdh2358
Date: 2009年06月07日 13:58:48 +0000 (2009年6月07日)
Log Message:
-----------
update changelog
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年06月07日 13:55:10 UTC (rev 7192)
+++ trunk/matplotlib/CHANGELOG	2009年06月07日 13:58:48 UTC (rev 7193)
@@ -1,4 +1,15 @@
+2009年06月07日 add support for bz2 files per sf support request 2794556 -
+ JDH
 
+2009年06月06日 added a properties method to the artist and inspector to
+ return a dict mapping property name -> value; see sf
+ feature request 2792183 - JDH
+
+2009年06月06日 added Neil's auto minor tick patch; sf patch #2789713 - JDH
+
+2009年06月06日 do not apply alpha to rgba color conversion if input is
+ already rgba - JDH
+
 2009年06月03日 axes_grid : Initial check-in of curvelinear grid support. See
 examples/axes_grid/demo_curvelinear_grid.py - JJL
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7190
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7190&view=rev
Author: leejjoon
Date: 2009年06月07日 13:08:34 +0000 (2009年6月07日)
Log Message:
-----------
fix typo in axes_grid/clip_path.py
Modified Paths:
--------------
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py	2009年06月06日 21:35:36 UTC (rev 7189)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py	2009年06月07日 13:08:34 UTC (rev 7190)
@@ -4,6 +4,7 @@
 
 def atan2(dy, dx):
 if dx == 0 and dx == 0:
+ print "warning"
 return 0
 else:
 return math.atan2(dy, dx)
@@ -45,7 +46,7 @@
 segx, segy = [], []
 
 if dx == 0. and dy == 0:
- dx = x[+1] - x[i]
+ dx = x[i+1] - x[i]
 dy = y[i+1] - y[i]
 
 a = degrees(atan2(dy, dx))
@@ -59,7 +60,7 @@
 ns = i+1
 
 if dx == 0. and dy == 0:
- dx = x[+1] - x[i]
+ dx = x[i+1] - x[i]
 dy = y[i+1] - y[i]
 
 a = degrees(atan2(dy, dx))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2009年06月06日 21:36:43
Revision: 7189
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7189&view=rev
Author: efiring
Date: 2009年06月06日 21:35:36 +0000 (2009年6月06日)
Log Message:
-----------
Tweak John's change to handling of rgba arrays
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/colors.py
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py	2009年06月06日 18:21:51 UTC (rev 7188)
+++ trunk/matplotlib/lib/matplotlib/colors.py	2009年06月06日 21:35:36 UTC (rev 7189)
@@ -361,27 +361,35 @@
 then an empty array will be returned. Same for an empty list.
 """
 try:
- if c.lower() == 'none':
- return np.zeros((0,4), dtype=np.float_)
+ nc = len(c)
+ except TypeError:
+ raise ValueError(
+ "Cannot convert argument type %s to rgba array" % type(c))
+ try:
+ if nc == 0 or c.lower() == 'none':
+ return np.zeros((0,4), dtype=np.float)
 except AttributeError:
 pass
- if len(c) == 0:
- return np.zeros((0,4), dtype=np.float_)
 try:
- result = np.array([self.to_rgba(c, alpha)], dtype=np.float_)
+ # Single value? Put it in an array with a single row.
+ return np.array([self.to_rgba(c, alpha)], dtype=np.float)
 except ValueError:
 if isinstance(c, np.ndarray):
 if c.ndim != 2 and c.dtype.kind not in 'SU':
 raise ValueError("Color array must be two-dimensional")
- if len(c.shape)==2 and c.shape[-1]==4:
+ if (c.ndim == 2 and c.shape[1] == 4 and c.dtype.kind == 'f'):
+ if (c.ravel() > 1).any() or (c.ravel() < 0).any():
+ raise ValueError(
+ "number in rgba sequence is outside 0-1 range")
 # looks like rgba already, nothing to be done; do
 # we want to apply alpha here if
 # (c[:,3]==1).all() ?
- return c
- result = np.zeros((len(c), 4))
+ return np.asarray(c, np.float)
+ # It must be some other sequence of color specs.
+ result = np.zeros((nc, 4), dtype=np.float)
 for i, cc in enumerate(c):
- result[i] = self.to_rgba(cc, alpha) # change in place
- return np.asarray(result, np.float_)
+ result[i] = self.to_rgba(cc, alpha)
+ return result
 
 colorConverter = ColorConverter()
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2009年06月06日 18:21:52
Revision: 7188
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7188&view=rev
Author: efiring
Date: 2009年06月06日 18:21:51 +0000 (2009年6月06日)
Log Message:
-----------
Try to improve the cursor readout and status message.
This could be done better with changes to the backends.
The status (pan/zoom etc) should be indicated via the
state of the buttons, e.g. using radio buttons, rather
than by printing text. The readout should be positioned
to minimize jumping around of the text.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/lib/matplotlib/backend_bases.py
 trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2009年06月06日 18:18:54 UTC (rev 7187)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2009年06月06日 18:21:51 UTC (rev 7188)
@@ -2468,12 +2468,14 @@
 def format_coord(self, x, y):
 'return a format string formatting the *x*, *y* coord'
 if x is None:
- x = '???'
+ xs = '???'
+ else:
+ xs = self.format_xdata(x)
 if y is None:
- y = '???'
- xs = self.format_xdata(x)
- ys = self.format_ydata(y)
- return 'x=%s, y=%s'%(xs,ys)
+ ys = '???'
+ else:
+ ys = self.format_ydata(y)
+ return 'x=%s y=%s'%(xs,ys)
 
 #### Interactive manipulation
 
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py	2009年06月06日 18:18:54 UTC (rev 7187)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py	2009年06月06日 18:21:51 UTC (rev 7188)
@@ -1460,7 +1460,7 @@
 
 restore_bbox = tight_bbox.adjust_bbox(self.figure, format,
 bbox_inches)
- 
+
 _bbox_inches_restore = (bbox_inches, restore_bbox)
 else:
 _bbox_inches_restore = None
@@ -1896,7 +1896,7 @@
 except OverflowError: pass
 else:
 if len(self.mode):
- self.set_message('%s : %s' % (self.mode, s))
+ self.set_message('%s, %s' % (self.mode, s))
 else:
 self.set_message(s)
 else: self.set_message(self.mode)
@@ -1923,7 +1923,7 @@
 'button_press_event', self.press_pan)
 self._idRelease = self.canvas.mpl_connect(
 'button_release_event', self.release_pan)
- self.mode = 'pan/zoom mode'
+ self.mode = 'pan/zoom'
 self.canvas.widgetlock(self)
 else:
 self.canvas.widgetlock.release(self)
@@ -2193,7 +2193,7 @@
 if self._active:
 self._idPress = self.canvas.mpl_connect('button_press_event', self.press_zoom)
 self._idRelease = self.canvas.mpl_connect('button_release_event', self.release_zoom)
- self.mode = 'Zoom to rect mode'
+ self.mode = 'zoom rect'
 self.canvas.widgetlock(self)
 else:
 self.canvas.widgetlock.release(self)
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py	2009年06月06日 18:18:54 UTC (rev 7187)
+++ trunk/matplotlib/lib/matplotlib/ticker.py	2009年06月06日 18:21:51 UTC (rev 7188)
@@ -344,7 +344,7 @@
 
 def format_data_short(self,value):
 'return a short formatted string representation of a number'
- return '%1.3g'%value
+ return '%-12g'%value
 
 def format_data(self,value):
 'return a formatted string representation of a number'
@@ -525,7 +525,7 @@
 
 def format_data_short(self,value):
 'return a short formatted string representation of a number'
- return '%1.3g'%value
+ return '%-12g'%value
 
 def is_decade(self, x):
 n = self.nearest_long(x)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2009年06月06日 18:18:59
Revision: 7187
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7187&view=rev
Author: efiring
Date: 2009年06月06日 18:18:54 +0000 (2009年6月06日)
Log Message:
-----------
Update CHANGELOG
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年06月06日 14:16:40 UTC (rev 7186)
+++ trunk/matplotlib/CHANGELOG	2009年06月06日 18:18:54 UTC (rev 7187)
@@ -1,6 +1,9 @@
-2009年06月03日 axes_grid : Initial check-in of curvelinear grid support. See 
+
+2009年06月03日 axes_grid : Initial check-in of curvelinear grid support. See
 examples/axes_grid/demo_curvelinear_grid.py - JJL
 
+2009年06月01日 Add set_color method to Patch - EF
+
 2009年06月01日 Spine is now derived from Patch - ADS
 
 2009年06月01日 use cbook.is_string_like() instead of isinstance() for spines - ADS
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年06月06日 14:16:41
Revision: 7186
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7186&view=rev
Author: jdh2358
Date: 2009年06月06日 14:16:40 +0000 (2009年6月06日)
Log Message:
-----------
added a properties method to the artist and inspector to return a dict mapping property name -> value; see sf feature request 2792183
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/artist.py
Modified: trunk/matplotlib/lib/matplotlib/artist.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/artist.py	2009年06月06日 13:26:49 UTC (rev 7185)
+++ trunk/matplotlib/lib/matplotlib/artist.py	2009年06月06日 14:16:40 UTC (rev 7186)
@@ -672,6 +672,12 @@
 self.pchanged()
 
 
+ def properties(self):
+ """
+ return a dictionary mapping property name -> value for all Artist props
+ """
+ return ArtistInspector(self).properties()
+
 def set(self, **kwargs):
 """
 A tkstyle set command, pass *kwargs* to set properties
@@ -876,6 +882,7 @@
 return ':meth:`%s <%s>`%s' % (s, target, aliases)
 
 
+
 def pprint_setters(self, prop=None, leadingspace=2):
 """
 If *prop* is *None*, return a list of strings of all settable properies
@@ -954,24 +961,39 @@
 lines.append('%s%s: %s' %(pad, name, accepts))
 return lines
 
- def pprint_getters(self):
+
+ def properties(self):
 """
- Return the getters and actual values as list of strings.
+ return a dictionary mapping property name -> value
 """
-
 o = self.oorig
 getters = [name for name in dir(o)
 if name.startswith('get_')
 and callable(getattr(o, name))]
 #print getters
 getters.sort()
- lines = []
+ d = dict()
 for name in getters:
 func = getattr(o, name)
 if self.is_alias(func): continue
 
 try: val = func()
 except: continue
+ else: d[name[4:]] = val
+
+ return d
+
+ def pprint_getters(self):
+ """
+ Return the getters and actual values as list of strings.
+ """
+
+ d = self.properties()
+ names = d.keys()
+ names.sort()
+ lines = []
+ for name in names:
+ val = d[name]
 if getattr(val, 'shape', ()) != () and len(val)>6:
 s = str(val[:6]) + '...'
 else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年06月06日 13:26:51
Revision: 7185
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7185&view=rev
Author: jdh2358
Date: 2009年06月06日 13:26:49 +0000 (2009年6月06日)
Log Message:
-----------
added Neil's auto minor tick patch; sf patch #2789713
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/lib/matplotlib/pyplot.py
 trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2009年06月06日 11:36:10 UTC (rev 7184)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2009年06月06日 13:26:49 UTC (rev 7185)
@@ -7790,7 +7790,19 @@
 
 return _bbox
 
+ def minorticks_on(self):
+ 'Add autoscaling minor ticks to the axes.'
+ for ax in (self.xaxis, self.yaxis):
+ if ax.get_scale() == 'log':
+ s = ax._scale
+ ax.set_minor_locator(mticker.LogLocator(s.base, s.subs))
+ else:
+ ax.set_minor_locator(mticker.AutoMinorLocator())
 
+ def minorticks_off(self):
+ 'Remove minor ticks from the axes.'
+ self.xaxis.set_minor_locator(mticker.NullLocator())
+ self.yaxis.set_minor_locator(mticker.NullLocator())
 
 
 class SubplotBase:
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py	2009年06月06日 11:36:10 UTC (rev 7184)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py	2009年06月06日 13:26:49 UTC (rev 7185)
@@ -1047,8 +1047,23 @@
 silent_list('Text yticklabel', labels)
 )
 
+def minorticks_on():
+ """
+ Display minor ticks on the current plot.
 
+ Displaying minor ticks reduces performance; turn them off using
+ minorticks_off() if drawing speed is a problem.
+ """
+ gca().minorticks_on()
+ draw_if_interactive()
 
+def minorticks_off():
+ """
+ Remove minor ticks from the current plot.
+ """
+ gca().minorticks_off()
+ draw_if_interactive()
+
 def rgrids(*args, **kwargs):
 """
 Set/Get the radial locations of the gridlines and ticklabels on a
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py	2009年06月06日 11:36:10 UTC (rev 7184)
+++ trunk/matplotlib/lib/matplotlib/ticker.py	2009年06月06日 13:26:49 UTC (rev 7185)
@@ -1182,6 +1182,40 @@
 def __init__(self):
 MaxNLocator.__init__(self, nbins=9, steps=[1, 2, 5, 10])
 
+class AutoMinorLocator(Locator):
+ """
+ Dynamically find minor tick positions based on the positions of
+ major ticks. Assumes the scale is linear and major ticks are
+ evenly spaced.
+ """
+ def __call__(self):
+ 'Return the locations of the ticks'
+ majorlocs = self.axis.get_majorticklocs()
+ try:
+ majorstep = majorlocs[1] - majorlocs[0]
+ except IndexError:
+ raise ValueError('Need at least two major ticks to find minor '
+ 'tick locations')
+ # see whether major step should be divided by 5, 4 or 2. This
+ # should cover most cases.
+ temp = float(('%e' % majorstep).split('e')[0])
+ if temp % 5 < 1e-10:
+ minorstep = majorstep / 5.
+ elif temp % 2 < 1e-10:
+ minorstep = majorstep / 4.
+ else:
+ minorstep = majorstep / 2.
+
+ tmin = majorlocs[0] - majorstep
+ tmax = majorlocs[-1] + majorstep
+ locs = np.arange(tmin, tmax, minorstep)
+ vmin, vmax = self.axis.get_view_interval()
+ if vmin > vmax:
+ vmin,vmax = vmax,vmin
+
+ return locs[(vmin < locs) & (locs < vmax)]
+
+
 class OldAutoLocator(Locator):
 """
 On autoscale this class picks the best MultipleLocator to set the
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年06月06日 11:36:12
Revision: 7184
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7184&view=rev
Author: jdh2358
Date: 2009年06月06日 11:36:10 +0000 (2009年6月06日)
Log Message:
-----------
do not apply alpha to rgba color conversion if input is already rgba
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/collections.py
 trunk/matplotlib/lib/matplotlib/colors.py
 trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py	2009年06月05日 23:45:53 UTC (rev 7183)
+++ trunk/matplotlib/lib/matplotlib/collections.py	2009年06月06日 11:36:10 UTC (rev 7184)
@@ -91,6 +91,7 @@
 self.set_antialiased(antialiaseds)
 self.set_urls(urls)
 
+
 self._uniform_offsets = None
 self._offsets = np.array([], np.float_)
 if offsets is not None:
@@ -106,6 +107,7 @@
 self._pickradius = pickradius
 self.update(kwargs)
 
+
 def _get_value(self, val):
 try: return (float(val), )
 except TypeError:
Modified: trunk/matplotlib/lib/matplotlib/colors.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colors.py	2009年06月05日 23:45:53 UTC (rev 7183)
+++ trunk/matplotlib/lib/matplotlib/colors.py	2009年06月06日 11:36:10 UTC (rev 7184)
@@ -373,7 +373,11 @@
 if isinstance(c, np.ndarray):
 if c.ndim != 2 and c.dtype.kind not in 'SU':
 raise ValueError("Color array must be two-dimensional")
-
+ if len(c.shape)==2 and c.shape[-1]==4:
+ # looks like rgba already, nothing to be done; do
+ # we want to apply alpha here if
+ # (c[:,3]==1).all() ?
+ return c
 result = np.zeros((len(c), 4))
 for i, cc in enumerate(c):
 result[i] = self.to_rgba(cc, alpha) # change in place
@@ -976,7 +980,7 @@
 def __init__(self,azdeg=315,altdeg=45,\
 hsv_min_val=0,hsv_max_val=1,hsv_min_sat=1,hsv_max_sat=0):
 """
- Specify the azimuth (measured clockwise from south) and altitude 
+ Specify the azimuth (measured clockwise from south) and altitude
 (measured up from the plane of the surface) of the light source
 in degrees.
 
@@ -987,7 +991,7 @@
 (hsv_max_sat hsv_max_val) in regions that are illuminated.
 The default extremes are chose so that completely shaded points
 are nearly black (s = 1, v = 0) and completely illuminated points
- are nearly white (s = 0, v = 1). 
+ are nearly white (s = 0, v = 1).
 """
 self.azdeg = azdeg
 self.altdeg = altdeg
@@ -999,10 +1003,10 @@
 def shade(self,data,cmap):
 """
 Take the input data array, convert to HSV values in the
- given colormap, then adjust those color values 
+ given colormap, then adjust those color values
 to given the impression of a shaded relief map with a
 specified light source.
- RGBA values are returned, which can then be used to 
+ RGBA values are returned, which can then be used to
 plot the shaded image with imshow.
 """
 # imagine an artificial sun placed at infinity in
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp	2009年06月05日 23:45:53 UTC (rev 7183)
+++ trunk/matplotlib/src/_backend_agg.cpp	2009年06月06日 11:36:10 UTC (rev 7184)
@@ -465,7 +465,7 @@
 if (region->data==NULL)
 throw Py::ValueError("Cannot restore_region from NULL data");
 
- agg::rect_i rect(xx1-region->rect.x1, (yy1-region->rect.y1), 
+ agg::rect_i rect(xx1-region->rect.x1, (yy1-region->rect.y1),
 		 xx2-region->rect.x1, (yy2-region->rect.y1));
 
 
@@ -1187,6 +1187,7 @@
 			 *(double*)PyArray_GETPTR2(edgecolors, ei, 1),
 			 *(double*)PyArray_GETPTR2(edgecolors, ei, 2),
 			 *(double*)PyArray_GETPTR2(edgecolors, ei, 3));
+
 	if (Nlinewidths) {
 	 gc.linewidth = double(Py::Float(linewidths[i % Nlinewidths])) * dpi/72.0;
 	} else {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7183
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7183&view=rev
Author: leejjoon
Date: 2009年06月05日 23:45:53 +0000 (2009年6月05日)
Log Message:
-----------
axes_grid/clip_path.py : fix math domain error
Modified Paths:
--------------
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py	2009年06月05日 16:53:47 UTC (rev 7182)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py	2009年06月05日 23:45:53 UTC (rev 7183)
@@ -1,6 +1,12 @@
 import numpy as np
-from math import degrees, atan2
+from math import degrees
+import math
 
+def atan2(dy, dx):
+ if dx == 0 and dx == 0:
+ return 0
+ else:
+ return math.atan2(dy, dx)
 
 # FIXME : The current algorithm seems to return incorrect angle when the line
 # ends at the boudnary.
@@ -38,6 +44,10 @@
 ns = -1
 segx, segy = [], []
 
+ if dx == 0. and dy == 0:
+ dx = x[+1] - x[i]
+ dy = y[i+1] - y[i]
+
 a = degrees(atan2(dy, dx))
 _pos_angles.append((x0, y0, a))
 
@@ -48,6 +58,10 @@
 segx, segy = [x0], [y0]
 ns = i+1
 
+ if dx == 0. and dy == 0:
+ dx = x[+1] - x[i]
+ dy = y[i+1] - y[i]
+
 a = degrees(atan2(dy, dx))
 _pos_angles.append((x0, y0, a))
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7182
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7182&view=rev
Author: jdh2358
Date: 2009年06月05日 16:53:47 +0000 (2009年6月05日)
Log Message:
-----------
updated backend driver to find the new fill_between examples
Modified Paths:
--------------
 trunk/matplotlib/examples/tests/backend_driver.py
Modified: trunk/matplotlib/examples/tests/backend_driver.py
===================================================================
--- trunk/matplotlib/examples/tests/backend_driver.py	2009年06月05日 16:53:11 UTC (rev 7181)
+++ trunk/matplotlib/examples/tests/backend_driver.py	2009年06月05日 16:53:47 UTC (rev 7182)
@@ -86,7 +86,7 @@
 'figimage_demo.py',
 'figlegend_demo.py',
 'figure_title.py',
- 'fill_between.py',
+ 'fill_between_demo.py',
 'fill_demo.py',
 'fill_demo2.py',
 'fill_spiral.py',
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2009年06月05日 16:53:13
Revision: 7181
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7181&view=rev
Author: jdh2358
Date: 2009年06月05日 16:53:11 +0000 (2009年6月05日)
Log Message:
-----------
renamed fill_between.py and fill_betweenx.py to have _demo postfix
Added Paths:
-----------
 trunk/matplotlib/examples/pylab_examples/fill_between_demo.py
 trunk/matplotlib/examples/pylab_examples/fill_betweenx_demo.py
Removed Paths:
-------------
 trunk/matplotlib/examples/pylab_examples/fill_between.py
 trunk/matplotlib/examples/pylab_examples/fill_betweenx.py
Deleted: trunk/matplotlib/examples/pylab_examples/fill_between.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/fill_between.py	2009年06月05日 16:51:21 UTC (rev 7180)
+++ trunk/matplotlib/examples/pylab_examples/fill_between.py	2009年06月05日 16:53:11 UTC (rev 7181)
@@ -1,67 +0,0 @@
-#!/usr/bin/env python
-import matplotlib.mlab as mlab
-from matplotlib.pyplot import figure, show
-import numpy as np
-
-x = np.arange(0.0, 2, 0.01)
-y1 = np.sin(2*np.pi*x)
-y2 = 1.2*np.sin(4*np.pi*x)
-
-fig = figure()
-ax1 = fig.add_subplot(311)
-ax2 = fig.add_subplot(312, sharex=ax1)
-ax3 = fig.add_subplot(313, sharex=ax1)
-
-ax1.fill_between(x, 0, y1)
-ax1.set_ylabel('between y1 and 0')
-
-ax2.fill_between(x, y1, 1)
-ax2.set_ylabel('between y1 and 1')
-
-ax3.fill_between(x, y1, y2)
-ax3.set_ylabel('between y1 and y2')
-ax3.set_xlabel('x')
-
-# now fill between y1 and y2 where a logical condition is met. Note
-# this is different than calling
-# fill_between(x[where], y1[where],y2[where]
-# because of edge effects over multiple contiguous regions.
-fig = figure()
-ax = fig.add_subplot(211)
-ax.plot(x, y1, x, y2, color='black')
-ax.fill_between(x, y1, y2, where=y2>=y1, facecolor='green')
-ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red')
-ax.set_title('fill between where')
-
-# Test support for masked arrays.
-y2 = np.ma.masked_greater(y2, 1.0)
-ax1 = fig.add_subplot(212, sharex=ax)
-ax1.plot(x, y1, x, y2, color='black')
-ax1.fill_between(x, y1, y2, where=y2>=y1, facecolor='green')
-ax1.fill_between(x, y1, y2, where=y2<=y1, facecolor='red')
-ax1.set_title('Now regions with y2>1 are masked')
-
-# This example illustrates a problem; because of the data
-# gridding, there are undesired unfilled triangles at the crossover
-# points. A brute-force solution would be to interpolate all
-# arrays to a very fine grid before plotting.
-
-# show how to use transforms to create axes spans where a certain condition is satisfied
-fig = figure()
-ax = fig.add_subplot(111)
-y = np.sin(4*np.pi*x)
-ax.plot(x, y, color='black')
-
-# use the data coordinates for the x-axis and the axes coordinates for the y-axis
-import matplotlib.transforms as mtransforms
-trans = mtransforms.blended_transform_factory(ax.transData, ax.transAxes)
-theta = 0.9
-ax.axhline(theta, color='green', lw=2, alpha=0.5)
-ax.axhline(-theta, color='red', lw=2, alpha=0.5)
-ax.fill_between(x, 0, 1, where=y>theta, facecolor='green', alpha=0.5, transform=trans)
-ax.fill_between(x, 0, 1, where=y<-theta, facecolor='red', alpha=0.5, transform=trans)
-
-
-
-show()
-
Copied: trunk/matplotlib/examples/pylab_examples/fill_between_demo.py (from rev 7180, trunk/matplotlib/examples/pylab_examples/fill_between.py)
===================================================================
--- trunk/matplotlib/examples/pylab_examples/fill_between_demo.py	 (rev 0)
+++ trunk/matplotlib/examples/pylab_examples/fill_between_demo.py	2009年06月05日 16:53:11 UTC (rev 7181)
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+import matplotlib.mlab as mlab
+from matplotlib.pyplot import figure, show
+import numpy as np
+
+x = np.arange(0.0, 2, 0.01)
+y1 = np.sin(2*np.pi*x)
+y2 = 1.2*np.sin(4*np.pi*x)
+
+fig = figure()
+ax1 = fig.add_subplot(311)
+ax2 = fig.add_subplot(312, sharex=ax1)
+ax3 = fig.add_subplot(313, sharex=ax1)
+
+ax1.fill_between(x, 0, y1)
+ax1.set_ylabel('between y1 and 0')
+
+ax2.fill_between(x, y1, 1)
+ax2.set_ylabel('between y1 and 1')
+
+ax3.fill_between(x, y1, y2)
+ax3.set_ylabel('between y1 and y2')
+ax3.set_xlabel('x')
+
+# now fill between y1 and y2 where a logical condition is met. Note
+# this is different than calling
+# fill_between(x[where], y1[where],y2[where]
+# because of edge effects over multiple contiguous regions.
+fig = figure()
+ax = fig.add_subplot(211)
+ax.plot(x, y1, x, y2, color='black')
+ax.fill_between(x, y1, y2, where=y2>=y1, facecolor='green')
+ax.fill_between(x, y1, y2, where=y2<=y1, facecolor='red')
+ax.set_title('fill between where')
+
+# Test support for masked arrays.
+y2 = np.ma.masked_greater(y2, 1.0)
+ax1 = fig.add_subplot(212, sharex=ax)
+ax1.plot(x, y1, x, y2, color='black')
+ax1.fill_between(x, y1, y2, where=y2>=y1, facecolor='green')
+ax1.fill_between(x, y1, y2, where=y2<=y1, facecolor='red')
+ax1.set_title('Now regions with y2>1 are masked')
+
+# This example illustrates a problem; because of the data
+# gridding, there are undesired unfilled triangles at the crossover
+# points. A brute-force solution would be to interpolate all
+# arrays to a very fine grid before plotting.
+
+# show how to use transforms to create axes spans where a certain condition is satisfied
+fig = figure()
+ax = fig.add_subplot(111)
+y = np.sin(4*np.pi*x)
+ax.plot(x, y, color='black')
+
+# use the data coordinates for the x-axis and the axes coordinates for the y-axis
+import matplotlib.transforms as mtransforms
+trans = mtransforms.blended_transform_factory(ax.transData, ax.transAxes)
+theta = 0.9
+ax.axhline(theta, color='green', lw=2, alpha=0.5)
+ax.axhline(-theta, color='red', lw=2, alpha=0.5)
+ax.fill_between(x, 0, 1, where=y>theta, facecolor='green', alpha=0.5, transform=trans)
+ax.fill_between(x, 0, 1, where=y<-theta, facecolor='red', alpha=0.5, transform=trans)
+
+
+
+show()
+
Deleted: trunk/matplotlib/examples/pylab_examples/fill_betweenx.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/fill_betweenx.py	2009年06月05日 16:51:21 UTC (rev 7180)
+++ trunk/matplotlib/examples/pylab_examples/fill_betweenx.py	2009年06月05日 16:53:11 UTC (rev 7181)
@@ -1,50 +0,0 @@
-import matplotlib.mlab as mlab
-from matplotlib.pyplot import figure, show
-import numpy as np
-
-## Copy of fill_between.py but using fill_betweenx() instead.
-
-x = np.arange(0.0, 2, 0.01)
-y1 = np.sin(2*np.pi*x)
-y2 = 1.2*np.sin(4*np.pi*x)
-
-fig = figure()
-ax1 = fig.add_subplot(311)
-ax2 = fig.add_subplot(312, sharex=ax1)
-ax3 = fig.add_subplot(313, sharex=ax1)
-
-ax1.fill_betweenx(x, 0, y1)
-ax1.set_ylabel('between y1 and 0')
-
-ax2.fill_betweenx(x, y1, 1)
-ax2.set_ylabel('between y1 and 1')
-
-ax3.fill_betweenx(x, y1, y2)
-ax3.set_ylabel('between y1 and y2')
-ax3.set_xlabel('x')
-
-# now fill between y1 and y2 where a logical condition is met. Note
-# this is different than calling
-# fill_between(x[where], y1[where],y2[where]
-# because of edge effects over multiple contiguous regions.
-fig = figure()
-ax = fig.add_subplot(211)
-ax.plot(y1, x, y2, x, color='black')
-ax.fill_betweenx(x, y1, y2, where=y2>=y1, facecolor='green')
-ax.fill_betweenx(x, y1, y2, where=y2<=y1, facecolor='red')
-ax.set_title('fill between where')
-
-# Test support for masked arrays.
-y2 = np.ma.masked_greater(y2, 1.0)
-ax1 = fig.add_subplot(212, sharex=ax)
-ax1.plot(y1, x, y2, x, color='black')
-ax1.fill_betweenx(x, y1, y2, where=y2>=y1, facecolor='green')
-ax1.fill_betweenx(x, y1, y2, where=y2<=y1, facecolor='red')
-ax1.set_title('Now regions with y2 > 1 are masked')
-
-# This example illustrates a problem; because of the data
-# gridding, there are undesired unfilled triangles at the crossover
-# points. A brute-force solution would be to interpolate all
-# arrays to a very fine grid before plotting.
-
-show()
Copied: trunk/matplotlib/examples/pylab_examples/fill_betweenx_demo.py (from rev 7178, trunk/matplotlib/examples/pylab_examples/fill_betweenx.py)
===================================================================
--- trunk/matplotlib/examples/pylab_examples/fill_betweenx_demo.py	 (rev 0)
+++ trunk/matplotlib/examples/pylab_examples/fill_betweenx_demo.py	2009年06月05日 16:53:11 UTC (rev 7181)
@@ -0,0 +1,50 @@
+import matplotlib.mlab as mlab
+from matplotlib.pyplot import figure, show
+import numpy as np
+
+## Copy of fill_between.py but using fill_betweenx() instead.
+
+x = np.arange(0.0, 2, 0.01)
+y1 = np.sin(2*np.pi*x)
+y2 = 1.2*np.sin(4*np.pi*x)
+
+fig = figure()
+ax1 = fig.add_subplot(311)
+ax2 = fig.add_subplot(312, sharex=ax1)
+ax3 = fig.add_subplot(313, sharex=ax1)
+
+ax1.fill_betweenx(x, 0, y1)
+ax1.set_ylabel('between y1 and 0')
+
+ax2.fill_betweenx(x, y1, 1)
+ax2.set_ylabel('between y1 and 1')
+
+ax3.fill_betweenx(x, y1, y2)
+ax3.set_ylabel('between y1 and y2')
+ax3.set_xlabel('x')
+
+# now fill between y1 and y2 where a logical condition is met. Note
+# this is different than calling
+# fill_between(x[where], y1[where],y2[where]
+# because of edge effects over multiple contiguous regions.
+fig = figure()
+ax = fig.add_subplot(211)
+ax.plot(y1, x, y2, x, color='black')
+ax.fill_betweenx(x, y1, y2, where=y2>=y1, facecolor='green')
+ax.fill_betweenx(x, y1, y2, where=y2<=y1, facecolor='red')
+ax.set_title('fill between where')
+
+# Test support for masked arrays.
+y2 = np.ma.masked_greater(y2, 1.0)
+ax1 = fig.add_subplot(212, sharex=ax)
+ax1.plot(y1, x, y2, x, color='black')
+ax1.fill_betweenx(x, y1, y2, where=y2>=y1, facecolor='green')
+ax1.fill_betweenx(x, y1, y2, where=y2<=y1, facecolor='red')
+ax1.set_title('Now regions with y2 > 1 are masked')
+
+# This example illustrates a problem; because of the data
+# gridding, there are undesired unfilled triangles at the crossover
+# points. A brute-force solution would be to interpolate all
+# arrays to a very fine grid before plotting.
+
+show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7180
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7180&view=rev
Author: jdh2358
Date: 2009年06月05日 16:51:21 +0000 (2009年6月05日)
Log Message:
-----------
added example to fill_between to show how to create multiple axes spans where a condition is true
Modified Paths:
--------------
 trunk/matplotlib/examples/pylab_examples/fill_between.py
Modified: trunk/matplotlib/examples/pylab_examples/fill_between.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/fill_between.py	2009年06月05日 16:49:29 UTC (rev 7179)
+++ trunk/matplotlib/examples/pylab_examples/fill_between.py	2009年06月05日 16:51:21 UTC (rev 7180)
@@ -55,10 +55,11 @@
 # use the data coordinates for the x-axis and the axes coordinates for the y-axis
 import matplotlib.transforms as mtransforms
 trans = mtransforms.blended_transform_factory(ax.transData, ax.transAxes)
-ax.axhline(0.5, color='green', lw=2, alpha=0.5)
-ax.axhline(-0.5, color='red', lw=2, alpha=0.5)
-ax.fill_between(x, 0, 1, where=y2>0.5, facecolor='green', alpha=0.5, transform=trans)
-ax.fill_between(x, 0, 1, where=y2<-0.5, facecolor='red', alpha=0.5, transform=trans)
+theta = 0.9
+ax.axhline(theta, color='green', lw=2, alpha=0.5)
+ax.axhline(-theta, color='red', lw=2, alpha=0.5)
+ax.fill_between(x, 0, 1, where=y>theta, facecolor='green', alpha=0.5, transform=trans)
+ax.fill_between(x, 0, 1, where=y<-theta, facecolor='red', alpha=0.5, transform=trans)
 
 
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7179
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7179&view=rev
Author: jdh2358
Date: 2009年06月05日 16:49:29 +0000 (2009年6月05日)
Log Message:
-----------
added example to fill_between to show how to create multiple axes spans where a condition is true
Modified Paths:
--------------
 trunk/matplotlib/examples/pylab_examples/fill_between.py
Modified: trunk/matplotlib/examples/pylab_examples/fill_between.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/fill_between.py	2009年06月05日 13:00:47 UTC (rev 7178)
+++ trunk/matplotlib/examples/pylab_examples/fill_between.py	2009年06月05日 16:49:29 UTC (rev 7179)
@@ -46,5 +46,21 @@
 # points. A brute-force solution would be to interpolate all
 # arrays to a very fine grid before plotting.
 
+# show how to use transforms to create axes spans where a certain condition is satisfied
+fig = figure()
+ax = fig.add_subplot(111)
+y = np.sin(4*np.pi*x)
+ax.plot(x, y, color='black')
+
+# use the data coordinates for the x-axis and the axes coordinates for the y-axis
+import matplotlib.transforms as mtransforms
+trans = mtransforms.blended_transform_factory(ax.transData, ax.transAxes)
+ax.axhline(0.5, color='green', lw=2, alpha=0.5)
+ax.axhline(-0.5, color='red', lw=2, alpha=0.5)
+ax.fill_between(x, 0, 1, where=y2>0.5, facecolor='green', alpha=0.5, transform=trans)
+ax.fill_between(x, 0, 1, where=y2<-0.5, facecolor='red', alpha=0.5, transform=trans)
+
+
+
 show()
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7178
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7178&view=rev
Author: jdh2358
Date: 2009年06月05日 13:00:47 +0000 (2009年6月05日)
Log Message:
-----------
added JJ's F/C two scale example
Added Paths:
-----------
 trunk/matplotlib/examples/api/fahrenheit_celcius_scales.py
Added: trunk/matplotlib/examples/api/fahrenheit_celcius_scales.py
===================================================================
--- trunk/matplotlib/examples/api/fahrenheit_celcius_scales.py	 (rev 0)
+++ trunk/matplotlib/examples/api/fahrenheit_celcius_scales.py	2009年06月05日 13:00:47 UTC (rev 7178)
@@ -0,0 +1,28 @@
+"""
+Shoiw how to display two scales on the left and right y axis -- Fahrenheit and Celcius
+"""
+
+import matplotlib.pyplot as plt
+
+fig = plt.figure()
+ax1 = fig.add_subplot(111) # the Fahrenheit scale
+ax2 = ax1.twinx() # the Celcius scale
+
+def Tc(Tf):
+ return (5./9.)*(Tf-32)
+
+
+def update_ax2(ax1):
+ y1, y2 = ax1.get_ylim()
+ ax2.set_ylim(Tc(y1), Tc(y2))
+ ax2.figure.canvas.draw()
+
+# automatically update ylim of ax2 when ylim of ax1 changes.
+ax1.callbacks.connect("ylim_changed", update_ax2)
+ax1.plot([78, 79, 79, 77])
+
+ax1.set_title('Two scales: Fahrenheit and Celcius')
+ax1.set_ylabel('Fahrenheit')
+ax2.set_ylabel('Celcius')
+
+plt.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7176
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7176&view=rev
Author: mdboom
Date: 2009年06月03日 12:15:06 +0000 (2009年6月03日)
Log Message:
-----------
Bugfix in FltkAgg backend, thanks to Daniel
Modified Paths:
--------------
 branches/v0_98_5_maint/lib/matplotlib/backends/backend_fltkagg.py
Modified: branches/v0_98_5_maint/lib/matplotlib/backends/backend_fltkagg.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/backends/backend_fltkagg.py	2009年06月03日 05:49:59 UTC (rev 7175)
+++ branches/v0_98_5_maint/lib/matplotlib/backends/backend_fltkagg.py	2009年06月03日 12:15:06 UTC (rev 7176)
@@ -115,6 +115,7 @@
 window = Fltk.Fl_Double_Window(10,10,30,30)
 canvas = FigureCanvasFltkAgg(figure)
 window.end()
+ #Fltk.Fl.visual(Fltk.FL_DOUBLE)
 window.show()
 window.make_current()
 figManager = FigureManagerFltkAgg(canvas, num, window)
@@ -157,7 +158,7 @@
 def handle(self, event):
 x=Fltk.Fl.event_x()
 y=Fltk.Fl.event_y()
- yf=self._source.figure.bbox.height() - y
+ yf=self._source.figure.bbox.height - y
 if event == Fltk.FL_FOCUS or event == Fltk.FL_UNFOCUS:
 return 1
 elif event == Fltk.FL_KEYDOWN:
@@ -230,7 +231,7 @@
 def resize(self,size):
 w, h = size
 # compute desired figure size in inches
- dpival = self.figure.dpi.get()
+ dpival = self.figure.dpi
 winch = w/dpival
 hinch = h/dpival
 self.figure.set_size_inches(winch,hinch)
@@ -405,7 +406,7 @@
 """
 
 def __init__(self, canvas, figman):
- #xmin, xmax = canvas.figure.bbox.intervalx().get_bounds()
+ #xmin, xmax = canvas.figure.bbox.intervalx
 #height, width = 50, xmax-xmin
 self.canvas = canvas
 self.figman = figman
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2009年06月03日 12:50:19
Revision: 7177
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7177&view=rev
Author: mdboom
Date: 2009年06月03日 12:16:21 +0000 (2009年6月03日)
Log Message:
-----------
Merged revisions 7176 via svnmerge from 
https://matplotlib.svn.sf.net/svnroot/matplotlib/branches/v0_98_5_maint
........
 r7176 | mdboom | 2009年06月03日 08:15:06 -0400 (2009年6月03日) | 1 line
 
 Bugfix in FltkAgg backend, thanks to Daniel
........
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py
Property Changed:
----------------
 trunk/matplotlib/
 trunk/matplotlib/doc/pyplots/README
 trunk/matplotlib/doc/sphinxext/gen_gallery.py
 trunk/matplotlib/doc/sphinxext/gen_rst.py
 trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
 trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
 trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
 - /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7115
 + /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7176
Modified: svn:mergeinfo
 - /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
 + /branches/v0_91_maint:5753-5771
/branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176
Property changes on: trunk/matplotlib/doc/pyplots/README
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176
Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176
Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771
/branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py	2009年06月03日 12:15:06 UTC (rev 7176)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_fltkagg.py	2009年06月03日 12:16:21 UTC (rev 7177)
@@ -115,6 +115,7 @@
 window = Fltk.Fl_Double_Window(10,10,30,30)
 canvas = FigureCanvasFltkAgg(figure)
 window.end()
+ #Fltk.Fl.visual(Fltk.FL_DOUBLE)
 window.show()
 window.make_current()
 figManager = FigureManagerFltkAgg(canvas, num, window)
@@ -157,7 +158,7 @@
 def handle(self, event):
 x=Fltk.Fl.event_x()
 y=Fltk.Fl.event_y()
- yf=self._source.figure.bbox.height() - y
+ yf=self._source.figure.bbox.height - y
 if event == Fltk.FL_FOCUS or event == Fltk.FL_UNFOCUS:
 return 1
 elif event == Fltk.FL_KEYDOWN:
@@ -230,7 +231,7 @@
 def resize(self,size):
 w, h = size
 # compute desired figure size in inches
- dpival = self.figure.dpi.get()
+ dpival = self.figure.dpi
 winch = w/dpival
 hinch = h/dpival
 self.figure.set_size_inches(winch,hinch)
@@ -405,7 +406,7 @@
 """
 
 def __init__(self, canvas, figman):
- #xmin, xmax = canvas.figure.bbox.intervalx().get_bounds()
+ #xmin, xmax = canvas.figure.bbox.intervalx
 #height, width = 50, xmax-xmin
 self.canvas = canvas
 self.figman = figman
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176
Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py
___________________________________________________________________
Modified: svn:mergeinfo
 - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080
 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771
/branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2009年06月03日 05:50:06
Revision: 7175
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7175&view=rev
Author: leejjoon
Date: 2009年06月03日 05:49:59 +0000 (2009年6月03日)
Log Message:
-----------
axes_grid: initial checkin of curvelinear grid support
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/ChangeLog
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py
Added Paths:
-----------
 trunk/matplotlib/examples/axes_grid/demo_curvelinear_grid.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/angle_helper.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/clip_path.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/grid_finder.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/grid_helper_curvelinear.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年06月02日 02:30:57 UTC (rev 7174)
+++ trunk/matplotlib/CHANGELOG	2009年06月03日 05:49:59 UTC (rev 7175)
@@ -1,3 +1,6 @@
+2009年06月03日 axes_grid : Initial check-in of curvelinear grid support. See 
+ examples/axes_grid/demo_curvelinear_grid.py - JJL
+
 2009年06月01日 Spine is now derived from Patch - ADS
 
 2009年06月01日 use cbook.is_string_like() instead of isinstance() for spines - ADS
Added: trunk/matplotlib/examples/axes_grid/demo_curvelinear_grid.py
===================================================================
--- trunk/matplotlib/examples/axes_grid/demo_curvelinear_grid.py	 (rev 0)
+++ trunk/matplotlib/examples/axes_grid/demo_curvelinear_grid.py	2009年06月03日 05:49:59 UTC (rev 7175)
@@ -0,0 +1,131 @@
+import numpy as np
+#from matplotlib.path import Path
+
+import matplotlib.pyplot as plt
+import matplotlib.cbook as cbook
+
+from mpl_toolkits.axes_grid.grid_helper_curvelinear import GridHelperCurveLinear
+from mpl_toolkits.axes_grid.axislines import Subplot
+
+from mpl_toolkits.axes_grid.parasite_axes import SubplotHost, \
+ ParasiteAxesAuxTrans
+
+
+def curvelinear_test1(fig):
+ """
+ grid for custom transform.
+ """
+
+ def tr(x, y):
+ x, y = np.asarray(x), np.asarray(y)
+ return x, y-x
+
+ def inv_tr(x,y):
+ x, y = np.asarray(x), np.asarray(y)
+ return x, y+x
+
+
+ grid_helper = GridHelperCurveLinear((tr, inv_tr))
+
+ ax1 = Subplot(fig, 1, 2, 1, grid_helper=grid_helper)
+ # ax1 will have a ticks and gridlines defined by the given
+ # transform (+ transData of the Axes). Note that the transform of
+ # the Axes itself (i.e., transData) is not affected by the given
+ # transform.
+
+ fig.add_subplot(ax1)
+
+ xx, yy = tr([3, 6], [5.0, 10.])
+ ax1.plot(xx, yy)
+
+ ax1.set_aspect(1.)
+ ax1.set_xlim(0, 10.)
+ ax1.set_ylim(0, 10.)
+
+ ax1.grid(True)
+
+
+
+import mpl_toolkits.axes_grid.angle_helper as angle_helper
+from matplotlib.projections import PolarAxes
+from matplotlib.transforms import Affine2D
+
+def curvelinear_test2(fig):
+ """
+ polar projection, but in a rectangular box.
+ """
+
+ # PolarAxes.PolarTransform takes radian. However, we want our coordinate
+ # system in degree
+ tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform()
+
+ # polar projection, which involves cycle, and also has limits in
+ # its coordinates, needs a special method to find the extremes
+ # (min, max of the coordinate within the view).
+
+ # 20, 20 : number of sampling points along x, y direction
+ extreme_finder = angle_helper.ExtremeFinderCycle(20, 20,
+ lon_cycle = 360,
+ lat_cycle = None,
+ lon_minmax = None,
+ lat_minmax = (0, np.inf),
+ )
+
+ grid_locator1 = angle_helper.LocatorDMS(12)
+ # Find a grid values appropriate for the coordinate (degree,
+ # minute, second).
+
+ tick_formatter1 = angle_helper.FormatterDMS()
+ # And also uses an appropriate formatter. Note that,the
+ # acceptable Locator and Formatter class is a bit different than
+ # that of mpl's, and you cannot directly use mpl's Locator and
+ # Formatter here (but may be possible in the future).
+
+ grid_helper = GridHelperCurveLinear(tr,
+ extreme_finder=extreme_finder,
+ grid_locator1=grid_locator1,
+ tick_formatter1=tick_formatter1
+ )
+
+
+ ax1 = SubplotHost(fig, 1, 2, 2, grid_helper=grid_helper)
+
+ # make ticklabels of right and top axis visible.
+ ax1.axis["right"].major_ticklabels.set_visible(True)
+ ax1.axis["top"].major_ticklabels.set_visible(True)
+
+ # let right axis shows ticklabels for 1st coordinate (angle)
+ ax1.axis["right"].get_helper().nth_coord_ticks=0
+ # let bottom axis shows ticklabels for 2nd coordinate (radius)
+ ax1.axis["bottom"].get_helper().nth_coord_ticks=1
+
+ fig.add_subplot(ax1)
+
+
+ # A parasite axes with given transform
+ ax2 = ParasiteAxesAuxTrans(ax1, tr, "equal")
+ # note that ax2.transData == tr + ax1.transData
+ # Anthing you draw in ax2 will match the ticks and grids of ax1.
+ ax1.parasites.append(ax2)
+ intp = cbook.simple_linear_interpolation
+ ax2.plot(intp(np.array([0, 30]), 50),
+ intp(np.array([10., 10.]), 50))
+
+ ax1.set_aspect(1.)
+ ax1.set_xlim(-5, 12)
+ ax1.set_ylim(-5, 10)
+
+ ax1.grid(True)
+
+if 1:
+ fig = plt.figure(1, figsize=(7, 4))
+ fig.clf()
+
+ curvelinear_test1(fig)
+ curvelinear_test2(fig)
+
+ plt.draw()
+ plt.show()
+
+
+
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/ChangeLog
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/ChangeLog	2009年06月02日 02:30:57 UTC (rev 7174)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/ChangeLog	2009年06月03日 05:49:59 UTC (rev 7175)
@@ -1,6 +1,7 @@
 2009年06月01日 Jae-Joon Lee <lee...@gm...>
 
 	* axislines.py (Axes.toggle_axisline): fix broken spine support.
+	(AxisArtistHelper): Initial support for curvelinear grid and ticks.
 
 2009年05月04日 Jae-Joon Lee <lee...@gm...>
 
Added: trunk/matplotlib/lib/mpl_toolkits/axes_grid/angle_helper.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/angle_helper.py	 (rev 0)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/angle_helper.py	2009年06月03日 05:49:59 UTC (rev 7175)
@@ -0,0 +1,345 @@
+from math import floor
+
+import numpy as np
+import math
+
+A = np.array
+
+from mpl_toolkits.axes_grid.grid_finder import ExtremeFinderSimple
+
+def select_step_degree(dv):
+
+ degree_limits_ = [1.5, 3, 7, 13, 20, 40, 70, 120, 270, 520]
+ degree_steps_ = [ 1, 2, 5, 10, 15, 30, 45, 90, 180, 360]
+ degree_factors = [1.] * len(degree_steps_)
+
+ minsec_limits_ = [1.5, 2.5, 3.5, 8, 11, 18, 25, 45]
+ minsec_steps_ = [1, 2, 3, 5, 10, 15, 20, 30]
+
+ minute_limits_ = A(minsec_limits_)*(1./60.)
+ minute_factors = [60.] * len(minute_limits_)
+
+ second_limits_ = A(minsec_limits_)*(1./3600.)
+ second_factors = [3600.] * len(second_limits_)
+
+ degree_limits = np.concatenate([second_limits_,
+ minute_limits_,
+ degree_limits_])
+
+ degree_steps = np.concatenate([minsec_steps_,
+ minsec_steps_,
+ degree_steps_])
+
+ degree_factors = np.concatenate([second_factors,
+ minute_factors,
+ degree_factors])
+
+ n = degree_limits.searchsorted(dv)
+ step = degree_steps[n]
+ factor = degree_factors[n]
+
+ return step, factor
+
+
+
+def select_step_hour(dv):
+
+ hour_limits_ = [1.5, 2.5, 3.5, 5, 7, 10, 15, 21, 36]
+ hour_steps_ = [1, 2 , 3, 4, 6, 8, 12, 18, 24]
+ hour_factors = [1.] * len(hour_steps_)
+
+ minsec_limits_ = [1.5, 2.5, 3.5, 4.5, 5.5, 8, 11, 14, 18, 25, 45]
+ minsec_steps_ = [1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30]
+
+ minute_limits_ = A(minsec_limits_)*(1./60.)
+ minute_factors = [60.] * len(minute_limits_)
+
+ second_limits_ = A(minsec_limits_)*(1./3600.)
+ second_factors = [3600.] * len(second_limits_)
+
+ hour_limits = np.concatenate([second_limits_,
+ minute_limits_,
+ hour_limits_])
+
+ hour_steps = np.concatenate([minsec_steps_,
+ minsec_steps_,
+ hour_steps_])
+
+ hour_factors = np.concatenate([second_factors,
+ minute_factors,
+ hour_factors])
+
+ n = hour_limits.searchsorted(dv)
+ step = hour_steps[n]
+ factor = hour_factors[n]
+
+ return step, factor
+
+
+def select_step_sub(dv):
+
+ # subarcsec or degree
+ tmp = 10.**(int(math.log10(dv))-1.)
+ dv2 = dv/tmp
+ substep_limits_ = [1.5, 3., 7.]
+ substep_steps_ = [1. , 2., 5.]
+
+ factor = 1./tmp
+
+ if 1.5*tmp >= dv:
+ step = 1
+ elif 3.*tmp >= dv:
+ step = 2
+ elif 7.*tmp >= dv:
+ step = 5
+ else:
+ step = 1
+ factor = 0.1*factor
+
+ return step, factor
+
+
+def select_step(v1, v2, nv, hour=False):
+
+ if v1 > v2:
+ v1, v2 = v2, v1
+
+ A = np.array
+
+ dv = float(v2 - v1) / nv
+
+ if hour:
+ _select_step = select_step_hour
+ cycle = 24.
+ else:
+ _select_step = select_step_degree
+ cycle = 360.
+
+ # for degree
+ if dv > 1./3600.:
+ #print "degree"
+ step, factor = _select_step(dv)
+ else:
+ step, factor = select_step_sub(dv*3600.)
+ #print "feac", step, factor
+
+ factor = factor * 3600.
+
+
+ f1, f2, fstep = v1*factor, v2*factor, step/factor
+ levs = np.arange(math.floor(f1/step), math.ceil(f2/step)+0.5,
+ 1, dtype="i") * step
+
+ # n : number valid levels. If there is a cycle, e.g., [0, 90, 180,
+ # 270, 360], the a grid line needs to be extend from 0 to 360, so
+ # we need to return the whole array. However, the last level (360)
+ # needs to be ignored often. In this case, so we return n=4.
+
+ n = len(levs)
+
+
+ # we need to check the range of values
+ # for example, -90 to 90, 0 to 360,
+
+
+ if factor == 1. and (levs[-1] >= levs[0]+cycle): # check for cycle
+ nv = int(cycle / step)
+ levs = np.arange(0, nv, 1) * step
+ n = len(levs)
+
+ return levs, n, factor
+
+
+def select_step24(v1, v2, nv):
+ v1, v2 = v1/15., v2/15.
+ levs, n, factor = select_step(v1, v2, nv, hour=True)
+ return levs*15., n, factor
+
+def select_step360(v1, v2, nv):
+ return select_step(v1, v2, nv, hour=False)
+
+
+
+
+class LocatorHMS(object):
+ def __init__(self, den):
+ self.den = den
+ def __call__(self, v1, v2):
+ return select_step24(v1, v2, self.den)
+
+
+class LocatorDMS(object):
+ def __init__(self, den):
+ self.den = den
+ def __call__(self, v1, v2):
+ return select_step360(v1, v2, self.den)
+
+
+class FormatterHMS(object):
+ def __call__(self, direction, factor, values): # hour
+ if len(values) == 0:
+ return []
+ ss = [[-1, 1][v>0] for v in values]
+ values = np.abs(values)/15.
+
+ if factor == 1:
+ return ["$%d^{\mathrm{h}}$" % (int(v),) for v in values]
+ elif factor == 60:
+ return ["$%d^{\mathrm{h}},円%02d^{\mathrm{m}}$" % (s*floor(v/60.), v%60) \
+ for s, v in zip(ss, values)]
+ elif factor == 3600:
+ if ss[-1] == -1:
+ inverse_order = True
+ values = values[::-1]
+ else:
+ inverse_order = False
+ degree = floor(values[0]/3600.)
+ hm_fmt = "$%d^{\mathrm{h}},円%02d^{\mathrm{m}},円"
+ s_fmt = "%02d^{\mathrm{s}}$"
+ l_hm_old = ""
+ r = []
+ for v in values-3600*degree:
+ l_hm = hm_fmt % (ss[0]*degree, floor(v/60.))
+ l_s = s_fmt % (v%60,)
+ if l_hm != l_hm_old:
+ l_hm_old = l_hm
+ l = l_hm + l_s
+ else:
+ l = "$"+l_s
+ r.append(l)
+ if inverse_order:
+ return r[::-1]
+ else:
+ return r
+ #return [fmt % (ss[0]*degree, floor(v/60.), v%60) \
+ # for s, v in zip(ss, values-3600*degree)]
+ else: # factor > 3600.
+ return ["$%s$" % (str(v),) for v in values]
+
+
+class FormatterDMS(object):
+ def __call__(self, direction, factor, values):
+ if len(values) == 0:
+ return []
+ ss = [[-1, 1][v>0] for v in values]
+ values = np.abs(values)
+ if factor == 1:
+ return ["$%d^{\circ}$" % (s*int(v),) for (s, v) in zip(ss, values)]
+ elif factor == 60:
+ return ["$%d^{\circ},円%02d^{\prime}$" % (s*floor(v/60.), v%60) \
+ for s, v in zip(ss, values)]
+ elif factor == 3600:
+ if ss[-1] == -1:
+ inverse_order = True
+ values = values[::-1]
+ else:
+ inverse_order = False
+ degree = floor(values[0]/3600.)
+ hm_fmt = "$%d^{\circ},円%02d^{\prime},円"
+ s_fmt = "%02d^{\prime\prime}$"
+ l_hm_old = ""
+ r = []
+ for v in values-3600*degree:
+ l_hm = hm_fmt % (ss[0]*degree, floor(v/60.))
+ l_s = s_fmt % (v%60,)
+ if l_hm != l_hm_old:
+ l_hm_old = l_hm
+ l = l_hm + l_s
+ else:
+ l = "$"+l_s
+ r.append(l)
+ if inverse_order:
+ return r[::-1]
+ else:
+ return r
+ #return [fmt % (ss[0]*degree, floor(v/60.), v%60) \
+ # for s, v in zip(ss, values-3600*degree)]
+ else: # factor > 3600.
+ return ["$%s$" % (str(v),) for v in ss*values]
+
+
+
+
+class ExtremeFinderCycle(ExtremeFinderSimple):
+ """
+ When there is a cycle, e.g., longitude goes from 0-360.
+ """
+ def __init__(self,
+ nx, ny,
+ lon_cycle = 360.,
+ lat_cycle = None,
+ lon_minmax = None,
+ lat_minmax = (-90, 90)
+ ):
+ #self.transfrom_xy = transform_xy
+ #self.inv_transfrom_xy = inv_transform_xy
+ self.nx, self.ny = nx, ny
+ self.lon_cycle, self.lat_cycle = lon_cycle, lat_cycle
+ self.lon_minmax = lon_minmax
+ self.lat_minmax = lat_minmax
+
+
+ def __call__(self, transform_xy, x1, y1, x2, y2):
+ """
+ get extreme values.
+
+ x1, y1, x2, y2 in image coordinates (0-based)
+ nx, ny : number of dvision in each axis
+ """
+ x_, y_ = np.linspace(x1, x2, self.nx), np.linspace(y1, y2, self.ny)
+ x, y = np.meshgrid(x_, y_)
+ lon, lat = transform_xy(np.ravel(x), np.ravel(y))
+
+ # iron out jumps, but algorithm should be improved.
+ # Tis is just naive way of doing and my fail for some cases.
+ if self.lon_cycle is not None:
+ lon0 = lon.min()
+ lon -= 360. * ((lon - lon0) > 180.)
+ if self.lat_cycle is not None:
+ lat0 = lat.min()
+ lat -= 360. * ((lat - lat0) > 180.)
+
+ lon_min, lon_max = lon.min(), lon.max()
+ lat_min, lat_max = lat.min(), lat.max()
+
+ lon_min, lon_max, lat_min, lat_max = \
+ self._adjust_extremes(lon_min, lon_max, lat_min, lat_max)
+
+ return lon_min, lon_max, lat_min, lat_max
+
+
+ def _adjust_extremes(self, lon_min, lon_max, lat_min, lat_max):
+
+ lon_min, lon_max, lat_min, lat_max = \
+ self._add_pad(lon_min, lon_max, lat_min, lat_max)
+
+ # check cycle
+ if self.lon_cycle:
+ lon_max = min(lon_max, lon_min + self.lon_cycle)
+ if self.lat_cycle:
+ lat_max = min(lat_max, lat_min + self.lat_cycle)
+
+ if self.lon_minmax is not None:
+ min0 = self.lon_minmax[0]
+ lon_min = max(min0, lon_min)
+ max0 = self.lon_minmax[1]
+ lon_max = min(max0, lon_max)
+
+ if self.lat_minmax is not None:
+ min0 = self.lat_minmax[0]
+ lat_min = max(min0, lat_min)
+ max0 = self.lat_minmax[1]
+ lat_max = min(max0, lat_max)
+
+ return lon_min, lon_max, lat_min, lat_max
+
+
+
+
+
+if __name__ == "__main__":
+ #test2()
+ print select_step360(21.2, 33.3, 5)
+ print select_step360(20+21.2/60., 21+33.3/60., 5)
+ print select_step360(20.5+21.2/3600., 20.5+33.3/3600., 5)
+ print select_step360(20+21.2/60., 20+53.3/60., 5)
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py	2009年06月02日 02:30:57 UTC (rev 7174)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py	2009年06月03日 05:49:59 UTC (rev 7175)
@@ -1,3 +1,48 @@
+"""
+Axislines includes modified implementation of the Axes class. The
+biggest difference is that the artists responsible to draw axis line,
+ticks, ticklabel and axis labels are separated out from the mpl's Axis
+class, which are much more than artists in the original
+mpl. Originally, this change was motivated to support curvlinear
+grid. Here are a few reasons that I came up with new axes class.
+
+
+ * "top" and "bottom" x-axis (or "left" and "right" y-axis) can have
+ different ticks (tick locations and labels). This is not possible
+ with the current mpl, although some twin axes trick can help.
+
+ * Curvelinear grid.
+
+ * angled ticks.
+
+In the new axes class, xaxis and yaxis is set to not visible by
+default, and new set of artist (AxisArtist) are defined to draw axis
+line, ticks, ticklabels and axis label. Axes.axis attribute serves as
+a dictionary of these artists, i.e., ax.axis["left"] is a AxisArtist
+instance responsible to draw left y-axis. The default Axes.axis contains
+"bottom", "left", "top" and "right".
+
+AxisArtist can be considered as a container artist and
+has following children artists which will draw ticks, labels, etc.
+
+ * line
+ * major_ticks, major_ticklabels
+ * minor_ticks, minor_ticklabels
+ * offsetText
+ * label
+
+Note that these are separate artists from Axis class of the
+original mpl, thus most of tick-related command in the original mpl
+won't work, although some effort has made to work with. For example,
+color and markerwidth of the ax.axis["bottom"].major_ticks will follow
+those of Axes.xaxis unless explicitly specified.
+
+In addition to AxisArtist, the Axes will have *gridlines* attribute,
+which obviously draws grid lines. The gridlines needs to be separated
+from the axis as some gridlines can never pass any axis.
+
+"""
+
 import matplotlib.axes as maxes
 import matplotlib.artist as martist
 import matplotlib.text as mtext
@@ -73,25 +118,92 @@
 class UnimplementedException(Exception):
 pass
 
-class AxisLineHelper(object):
+
+
+class AxisArtistHelper(object):
+ """
+ AxisArtistHelper should define
+ following method with given APIs. Note that the first axes argument
+ will be axes attribute of the caller artist.
+
+
+ # LINE
+
+ def get_line(self, axes):
+ # path : Path
+ return path
+
+ def get_line_transform(self, axes):
+ # ...
+ # trans : transform
+ return trans
+
+ # LABEL
+
+ def get_label_pos(self, axes):
+ # x, y : position
+ return (x, y), trans
+
+
+ def get_label_offset_transform(self, \
+ axes,
+ pad_points, fontprops, renderer,
+ bboxes,
+ ):
+ # va : vertical alignment
+ # ha : horizontal alignment
+ # a : angle
+ return trans, va, ha, a
+
+ # TICK
+
+ def get_tick_transform(self, axes):
+ return trans
+
+ def get_tick_iterators(self, axes):
+ # iter : iteratoable object that yields (c, angle, l) where
+ # c, angle, l is position, tick angle, and label
+
+ return iter_major, iter_minot
+
+
+ """
 class _Base(object):
+
 def __init__(self, label_direction):
 self.label_direction = label_direction
 
- def get_label_pos(self):
- raise UnimplementedException("")
+ #def update(self):
+ # raise UnimplementedException("update method not implemented")
 
+ def update_lim(self, axes):
+ pass
+
 _label_angles = dict(left=90, right=90, bottom=0, top=0)
 _ticklabel_angles = dict(left=0, right=0, bottom=0, top=0)
 
- def _get_label_transform(self, pad_points, fontprops, renderer,
- bboxes=None,
- trans=None):
+ def _get_label_offset_transform(self, pad_points, fontprops, renderer,
+ bboxes=None,
+ #trans=None
+ ):
 
- if trans is None:
- trans = self.axes.transAxes
+ """
+ Returns (offset-transform, vertical-alignment, horiz-alignment)
+ of (tick or axis) labels appropriate for the label
+ direction.
 
- #dpi_scale_trans = self.axes.figure.dpi_scale_trans
+ The offset-transform represents a required pixel offset
+ from the reference point. For example, x-axis center will
+ be the referece point for xlabel.
+
+ pad_points : padding from axis line or tick labels (see bboxes)
+ fontprops : font properties for label
+ renderer : renderer
+ bboxes=None : list of bboxes (window extents) of the tick labels.
+
+ all the above parameters are used to estimate the offset.
+
+ """
 if renderer:
 pad_pixels = renderer.points_to_pixels(pad_points)
 font_size_points = fontprops.get_size_in_points()
@@ -111,74 +223,64 @@
 tr = Affine2D()
 if self.label_direction == "left":
 tr.translate(-(pad_pixels+w), 0.)
- trans = trans + tr
+ #trans = trans + tr
 
- return trans, "center", "right"
+ return tr, "center", "right"
 
 elif self.label_direction == "right":
 tr.translate(+(pad_pixels+w), 0.)
- #tr = ScaledTranslation(+((pad_points+w) / 72.), 0.,
- # dpi_scale_trans)
- trans = trans + tr
+ #trans = trans + tr
 
- return trans, "center", "left"
+ return tr, "center", "left"
 
 elif self.label_direction == "bottom":
- #pad_points = font_size_points + pad_points
 tr.translate(0, -(pad_pixels+font_size_pixels+h))
- trans = trans + tr
+ #trans = trans + tr
 
- return trans, "baseline", "center"
+ return tr, "baseline", "center"
 
 elif self.label_direction == "top":
- #pad_points = font_size_points/8. + pad_points
- #tr.translate(0, +(pad_pixels+font_size_pixels/6.+h))
- #tr.translate(0, +(pad_pixels+font_size_pixels/10.+h))
 tr.translate(0, +(pad_pixels+h))
- #tr = ScaledTranslation(0, (pad_points+h) / 72.,
- # dpi_scale_trans)
- trans = trans + tr
+ #trans = trans + tr
 
- return trans, "baseline", "center"
+ return tr, "baseline", "center"
 
 else:
 raise ValueError("")
 
 
- def get_label_transform(self, pad_points, fontprops, renderer,
- bboxes,
- trans=None):
+ def get_label_offset_transform(self,
+ axes,
+ pad_points, fontprops, renderer,
+ bboxes,
+ #trans=None
+ ):
 
- tr, va, ha = self._get_label_transform(pad_points, fontprops,
- renderer,
- bboxes, trans)
+ tr, va, ha = self._get_label_offset_transform(pad_points, fontprops,
+ renderer,
+ bboxes,
+ #trans
+ )
 
 a = self._label_angles[self.label_direction]
 return tr, va, ha, a
 
- def get_ticklabel_transform(self, pad_points, fontprops, renderer,
- trans=None):
 
- tr, va, ha = self._get_label_transform(pad_points, fontprops,
- renderer,
- None, trans)
+ def get_ticklabel_offset_transform(self, axes,
+ pad_points, fontprops,
+ renderer,
+ ):
 
+ tr, va, ha = self._get_label_offset_transform(pad_points, fontprops,
+ renderer,
+ None,
+ )
+
 a = self._ticklabel_angles[self.label_direction]
 return tr, va, ha, a
 
- def get_line_transform(self):
- return self.axes.transAxes
 
- def get_line(self):
- raise UnimplementedException("")
 
- def get_tick_transform(self):
- raise UnimplementedException("")
-
- def get_tick_iterators(self):
- raise UnimplementedException("")
-
-
 class Fixed(_Base):
 
 _default_passthru_pt = dict(left=(0, 0),
@@ -186,13 +288,13 @@
 bottom=(0, 0),
 top=(0, 1))
 
- def __init__(self, axes, loc, nth_coord=None,
+ def __init__(self,
+ loc, nth_coord=None,
 passingthrough_point=None, label_direction=None):
 """
 nth_coord = along which coordinate value varies
 in 2d, nth_coord = 0 -> x axis, nth_coord = 1 -> y axis
 """
- self.axes = axes
 if loc not in ["left", "right", "bottom", "top"]:
 raise ValueError("%s" % loc)
 
@@ -203,9 +305,8 @@
 nth_coord = 0
 
 self.nth_coord = nth_coord
- self.axis = [self.axes.xaxis, self.axes.yaxis][self.nth_coord]
 
- super(AxisLineHelper.Fixed, self).__init__(loc)
+ super(AxisArtistHelper.Fixed, self).__init__(loc)
 
 if passingthrough_point is None:
 passingthrough_point = self._default_passthru_pt[loc]
@@ -220,113 +321,160 @@
 fixed_coord = 1-nth_coord
 _verts[:,fixed_coord] = self.passthru_pt[fixed_coord]
 
+ # axis line in transAxes
 self._path = Path(_verts)
 
 
 def get_nth_coord(self):
 return self.nth_coord
 
- def get_line(self):
+ # LINE
+
+ def get_line(self, axes):
 return self._path
 
- def get_label_pos(self):
+ def get_line_transform(self, axes):
+ return axes.transAxes
+
+ # LABLE
+
+ def get_label_pos(self, axes):
+ """
+ label reference position in transAxes.
+
+ get_label_transform() returns a transform of (transAxes+offset)
+ """
 _verts = [0.5, 0.5]
 nth_coord = self.nth_coord
 fixed_coord = 1-nth_coord
 _verts[fixed_coord] = self.passthru_pt[fixed_coord]
- return _verts, self.axes.transAxes
+ return _verts, axes.transAxes
 
- def get_tick_transform(self):
- trans_tick = [self.axes.get_xaxis_transform(),
- self.axes.get_yaxis_transform()][self.nth_coord]
 
- return trans_tick
+ def get_label_offset_transform(self, axes,
+ pad_points, fontprops, renderer,
+ bboxes,
+ ):
 
- def get_tick_iterators(self):
- """tick_loc, tick_angle, tick_label"""
+ tr, va, ha = self._get_label_offset_transform( \
+ pad_points, fontprops, renderer, bboxes,
+ #trans
+ )
 
- angle = 0 - 90 * self.nth_coord
- if self.passthru_pt[1 - self.nth_coord] > 0.5:
- angle = 180+angle
+ a = self._label_angles[self.label_direction]
+ #tr = axes.transAxes + tr
 
- major = self.axis.major
- majorLocs = major.locator()
- major.formatter.set_locs(majorLocs)
- majorLabels = [major.formatter(val, i) for i, val in enumerate(majorLocs)]
+ return tr, va, ha, a
 
- minor = self.axis.minor
- minorLocs = minor.locator()
- minor.formatter.set_locs(minorLocs)
- minorLabels = [minor.formatter(val, i) for i, val in enumerate(minorLocs)]
 
- trans_tick = self.get_tick_transform()
 
- tr2ax = trans_tick + self.axes.transAxes.inverted()
+ # TICK
 
- def _f(locs, labels):
- for x, l in zip(locs, labels):
+ def get_tick_transform(self, axes):
+ trans_tick = [axes.get_xaxis_transform(),
+ axes.get_yaxis_transform()][self.nth_coord]
 
- c = list(self.passthru_pt) # copy
- c[self.nth_coord] = x
+ return trans_tick
 
- c2 = tr2ax.transform_point(c)
- delta=0.001
- if 0. -delta<= c2[self.nth_coord] <= 1.+delta:
- yield c, angle, l
 
- return _f(majorLocs, majorLabels), _f(minorLocs, minorLabels)
 
-
 class Floating(_Base):
- def __init__(self, axes, nth_coord,
+ def __init__(self, nth_coord,
 passingthrough_point, label_direction, transform):
 
- self.axes = axes
 self.nth_coord = nth_coord
- self.axis = [self.axes.xaxis, self.axes.yaxis][self.nth_coord]
 
 self.passingthrough_point = passingthrough_point
 
 self.transform = transform
 
- super(AxisLineHelper.Floating, self).__init__(label_direction)
+ super(AxisArtistHelper.Floating,
+ self).__init__(label_direction)
 
+
 def get_nth_coord(self):
 return self.nth_coord
 
- def get_line(self):
+ def get_line(self, axes):
 _verts = np.array([[0., 0.],
 [1., 1.]])
 
 fixed_coord = 1-self.nth_coord
- trans_passingthrough_point = self.transform + self.axes.transAxes.inverted()
+ trans_passingthrough_point = self.transform + axes.transAxes.inverted()
 p = trans_passingthrough_point.transform_point(self.passingthrough_point)
 _verts[:,fixed_coord] = p[fixed_coord]
 
 return Path(_verts)
 
+ def get_line_transform(self, axes):
+ return axes.transAxes
 
- def get_label_pos(self):
+ def get_label_pos(self, axes):
 _verts = [0.5, 0.5]
 
 fixed_coord = 1-self.nth_coord
- trans_passingthrough_point = self.transform + self.axes.transAxes.inverted()
+ trans_passingthrough_point = self.transform + axes.transAxes.inverted()
 p = trans_passingthrough_point.transform_point(self.passingthrough_point)
 _verts[fixed_coord] = p[fixed_coord]
 if not (0. <= _verts[fixed_coord] <= 1.):
 return None, None
 else:
- return _verts, self.axes.transAxes
+ return _verts, axes.transAxes
 
+ def get_label_transform(self, axes,
+ pad_points, fontprops, renderer,
+ bboxes,
+ ):
 
+ tr, va, ha = self._get_label_offset_transform(pad_points, fontprops,
+ renderer,
+ bboxes,
+ #trans
+ )
 
- def get_tick_transform(self):
+ a = self._label_angles[self.label_direction]
+ tr = axes.transAxes + tr
+ #tr = axes.transAxes + tr
+
+ return tr, va, ha, a
+
+
+
+ def get_tick_transform(self, axes):
 return self.transform
 
- def get_tick_iterators(self):
+
+
+
+
+class AxisArtistHelperRectlinear:
+
+ class Fixed(AxisArtistHelper.Fixed):
+
+ def __init__(self,
+ axes, loc, nth_coord=None,
+ passingthrough_point=None, label_direction=None):
+ """
+ nth_coord = along which coordinate value varies
+ in 2d, nth_coord = 0 -> x axis, nth_coord = 1 -> y axis
+ """
+
+ super(AxisArtistHelperRectlinear.Fixed, self).__init__( \
+ loc, nth_coord,
+ passingthrough_point, label_direction)
+
+ self.axis = [axes.xaxis, axes.yaxis][self.nth_coord]
+
+
+
+ # TICK
+
+ def get_tick_iterators(self, axes):
 """tick_loc, tick_angle, tick_label"""
 
 angle = 0 - 90 * self.nth_coord
+ if self.passthru_pt[1 - self.nth_coord] > 0.5:
+ angle = 180+angle
 
 major = self.axis.major
 majorLocs = major.locator()
@@ -338,11 +486,56 @@
 minor.formatter.set_locs(minorLocs)
 minorLabels = [minor.formatter(val, i) for i, val in enumerate(minorLocs)]
 
- tr2ax = self.transform + self.axes.transAxes.inverted()
+ trans_tick = self.get_tick_transform(axes)
 
+ tr2ax = trans_tick + axes.transAxes.inverted()
+
 def _f(locs, labels):
 for x, l in zip(locs, labels):
 
+ c = list(self.passthru_pt) # copy
+ c[self.nth_coord] = x
+
+ # check if the tick point is inside axes
+ c2 = tr2ax.transform_point(c)
+ delta=0.001
+ if 0. -delta<= c2[self.nth_coord] <= 1.+delta:
+ yield c, angle, l
+
+ return _f(majorLocs, majorLabels), _f(minorLocs, minorLabels)
+
+
+
+ class Floating(AxisArtistHelper.Floating):
+ def __init__(self, axes, nth_coord,
+ passingthrough_point, label_direction, transform):
+
+ super(AxisArtistHelperRectlinear.Floating, self).__init__( \
+ nth_coord, passingthrough_point, label_direction, transform)
+
+ self.axis = [axes.xaxis, axes.yaxis][self.nth_coord]
+
+
+ def get_tick_iterators(self, axes):
+ """tick_loc, tick_angle, tick_label"""
+
+ angle = 0 - 90 * self.nth_coord
+
+ major = self.axis.major
+ majorLocs = major.locator()
+ major.formatter.set_locs(majorLocs)
+ majorLabels = [major.formatter(val, i) for i, val in enumerate(majorLocs)]
+
+ minor = self.axis.minor
+ minorLocs = minor.locator()
+ minor.formatter.set_locs(minorLocs)
+ minorLabels = [minor.formatter(val, i) for i, val in enumerate(minorLocs)]
+
+ tr2ax = self.transform + axes.transAxes.inverted()
+
+ def _f(locs, labels):
+ for x, l in zip(locs, labels):
+
 c = list(self.passingthrough_point) # copy
 c[self.nth_coord] = x
 c1, c2 = tr2ax.transform_point(c)
@@ -352,34 +545,60 @@
 return _f(majorLocs, majorLabels), _f(minorLocs, minorLabels)
 
 
-class GridHelperRectlinear(object):
 
 
+
+class GridHelperBase(object):
+
 def __init__(self):
- self.axes = None
 self._force_update = True
+ self._old_limits = None
+ super(GridHelperBase, self).__init__()
 
- def set_axes(self, axes):
- self.axes = axes
 
+ def update_lim(self, axes):
+ x1, x2 = axes.get_xlim()
+ y1, y2 = axes.get_ylim()
+
+ if self._force_update or self._old_limits != (x1, x2, y1, y2):
+ self._update(x1, x2, y1, y2)
+ self._force_update = False
+ self._old_limits = (x1, x2, y1, y2)
+
+
 def _update(self, x1, x2, y1, y2):
- self._force_update = False
+ pass
 
+
 def invalidate(self):
 self._force_update = True
 
+
 def get_gridlines(self):
 return []
 
- def _get_axisline_helper(self, nth_coord, loc,
+
+
+class GridHelperRectlinear(GridHelperBase):
+
+
+ def __init__(self, axes):
+
+ super(GridHelperRectlinear, self).__init__()
+ self.axes = axes
+
+ #def set_axes(self, axes):
+ # self.axes = axes
+
+ def _get_axisline_helper_deprecated(self, nth_coord, loc,
 passingthrough_point, transform=None):
 if transform is None or transform is self.axes.transAxes:
- return AxisLineHelper.Fixed(self.axes, loc,
+ return AxisArtistHelper.Fixed(self.axes, loc,
 nth_coord, passingthrough_point)
 
 else:
 label_direction = loc
- return AxisLineHelper.Floating(self.axes,
+ return AxisArtistHelper.Floating(self.axes,
 nth_coord, passingthrough_point,
 label_direction,
 transform)
@@ -390,16 +609,23 @@
 #transform=None,
 tick_direction="in",
 label_direction=None,
- offset=None):
+ offset=None,
+ axes=None,
+ ):
 
- _helper = AxisLineHelper.Fixed(self.axes, loc,
- nth_coord, passthrough_point)
+ if axes is None:
+ warnings.warn("'new_fixed_axis' explicitly requires the axes keyword.")
+ axes = self.axes
 
- axisline = AxisLine(self.axes, _helper,
- #tick_direction="in",
- offset=offset,
- )
+ _helper = AxisArtistHelperRectlinear.Fixed(axes, loc,
+ nth_coord,
+ passthrough_point)
 
+ axisline = AxisArtist(axes, _helper,
+ #tick_direction="in",
+ offset=offset,
+ )
+
 return axisline
 
 
@@ -407,21 +633,27 @@
 transform=None,
 tick_direction="in",
 label_direction=None,
- ):
+ axes=None,
+ ):
 
- _helper = AxisLineHelper.Floating(self.axes,
- nth_coord, passthrough_point,
- label_direction,
- transform)
+ if axes is None:
+ warnings.warn("'new_floating_axis' explicitly requires the axes keyword.")
+ axes = self.axes
 
- axisline = AxisLine(self.axes, _helper,
- #tick_direction="in",
- )
+ _helper = AxisArtistHelperRectlinear.Floating( \
+ axes,
+ nth_coord, passthrough_point,
+ label_direction,
+ transform)
 
+ axisline = AxisArtist(axes, _helper,
+ #tick_direction="in",
+ )
+
 return axisline
 
 
- def new_axisline(self, loc,
+ def new_axisline_deprecated(self, loc,
 nth_coord=None, passthrough_point=None,
 transform=None,
 tick_direction="in",
@@ -435,7 +667,7 @@
 passthrough_point,
 transform)
 
- axisline = AxisLine(self.axes, _helper,
+ axisline = AxisArtist(self.axes, _helper,
 #tick_direction="in",
 offset=offset,
 )
@@ -444,18 +676,9 @@
 
 
 
-
-
-
-class XYEvent:
- def __init__(self, xy):
- self.x, self.y = xy
-
-
 from matplotlib.lines import Line2D
 
 class Ticks(Line2D):
-#LineCollection
 def __init__(self, ticksize, **kwargs):
 self.ticksize = ticksize
 self.locs_angles = []
@@ -608,6 +831,9 @@
 # return Bbox.from_bounds(0, 0, 0, 0)
 
 
+
+
+
 class AxisLabel(mtext.Text):
 def __init__(self, *kl, **kwargs):
 self._axis = kwargs.pop("axis", None)
@@ -635,279 +861,40 @@
 return self._text
 
 
-class AxisGridLineBase(martist.Artist):
- def __init__(self, *kl, **kw):
- super(AxisGridLineBase, self).__init__(*kl, **kw)
+class GridlinesCollection(LineCollection):
+ def __init__(self, *kl, **kwargs):
+ super(GridlinesCollection, self).__init__(*kl, **kwargs)
+ self.set_grid_helper(None)
 
+ def set_grid_helper(self, grid_helper):
+ self._grid_helper = grid_helper
 
-
-class GridLine(AxisGridLineBase):
- """ a line along which the n-th axes coord is constant."""
-
- LABELPAD = 5
- ZORDER=2.5
-
- def __init__(self, axes,
- helper,
- #offset_transform=None,
- offset=None,
- major_tick_size=None,
- major_tick_pad=None,
- minor_tick_size=None,
- minor_tick_pad=None,
- **kw):
-
- AxisGridLineBase.__init__(self, **kw)
-
- self.axes = axes
-
- self._helper = helper
-
- #if offset_transform is None:
- # self.offset_transform = IdentityTransform()
- #else:
- # self.offset_transform = offset_transform
-
- if offset is None:
- offset = (0, 0)
- self.dpi_transform = Affine2D()
- self.offset_transform = ScaledTranslation(offset[0], offset[1],
- self.dpi_transform)
-
- self.set_transform(axes.transAxes + \
- self.offset_transform)
-
- self._label_visible = True
- self._majortick_visible = True
- self._majorticklabel_visible = True
- self._minortick_visible = True
- self._minorticklabel_visible = True
-
-
- if self._helper.label_direction in ["left", "right"]:
- axis_name = "ytick"
- else:
- axis_name = "xtick"
-
-
- if major_tick_size is None:
- self.major_tick_size = rcParams['%s.major.size'%axis_name]
- if major_tick_pad is None:
- self.major_tick_pad = rcParams['%s.major.pad'%axis_name]
- if minor_tick_size is None:
- self.minor_tick_size = rcParams['%s.minor.size'%axis_name]
- if minor_tick_pad is None:
- self.minor_tick_pad = rcParams['%s.minor.pad'%axis_name]
-
- self._init_line()
- self._init_ticks()
- self._init_label()
-
- self.set_zorder(self.ZORDER)
-
- def _init_line(self):
- tran = self._helper.get_line_transform() + self.offset_transform
- self.line = BezierPath(self._helper.get_line(),
- color=rcParams['axes.edgecolor'],
- linewidth=rcParams['axes.linewidth'],
- transform=tran)
-
- def get_helper(self):
- return self._helper
-
- def _draw_line(self, renderer):
- self.line.set_path(self._helper.get_line())
- self.line.draw(renderer)
-
-
- def _init_ticks(self):
-
- transform=self._helper.get_tick_transform()+self.offset_transform
-
- self.major_ticks = Ticks(self.major_tick_size,
- transform=transform)
- self.minor_ticks = Ticks(self.minor_tick_size,
- transform=transform)
-
-
- size = rcParams['xtick.labelsize']
-
- fontprops = font_manager.FontProperties(size=size)
- tvhl = self._helper.get_ticklabel_transform(self.major_tick_pad,
- fontprops=fontprops,
- renderer=None,
- trans=transform)
- trans, vert, horiz, label_a = tvhl
-
- color = rcParams['xtick.color']
- self.major_ticklabels = TickLabels(size, color=color)
- self.minor_ticklabels = TickLabels(size, color=color)
-
- #self.major_ticklabels = TickLabels(size, axis=self.axis)
- #self.minor_ticklabels = TickLabels(size, axis=self.axis)
-
-
- self.major_ticklabels.set(figure = self.axes.figure,
- rotation = label_a,
- transform=trans,
- va=vert,
- ha=horiz,
- fontproperties=fontprops)
-
- self.minor_ticklabels.set(figure = self.axes.figure,
- rotation = label_a,
- transform=trans,
- va=vert,
- ha=horiz,
- fontproperties=fontprops)
-
-
- def _draw_ticks(self, renderer):
- #majortick_iter, minortick_iter):
- #major_locs, major_angles,
- #minor_locs, minor_angles):
-
- majortick_iter, minortick_iter = self._helper.get_tick_iterators()
-
- tick_loc_angles = []
- tick_loc_labels = []
- for tick_loc, tick_angle, tick_label in majortick_iter:
- tick_loc_angles.append((tick_loc, tick_angle))
- tick_loc_labels.append((tick_loc, tick_label))
-
-
- transform=self._helper.get_tick_transform()+self.offset_transform
- fontprops = font_manager.FontProperties(size=12)
- tvhl = self._helper.get_ticklabel_transform(self.major_tick_pad,
- fontprops=fontprops,
- renderer=renderer,
- trans=transform)
- trans, va, ha, a = tvhl
- self.major_ticklabels.set(transform=trans,
- va=va, ha=ha, rotation=a)
-
-
- self.major_ticks.update_locs_angles(tick_loc_angles, renderer)
- self.major_ticklabels.update_locs_labels(tick_loc_labels, renderer)
-
- self.major_ticks.draw(renderer)
- self.major_ticklabels.draw(renderer)
-
- tick_loc_angles = []
- tick_loc_labels = []
- for tick_loc, tick_angle, tick_label in minortick_iter:
- tick_loc_angles.append((tick_loc, tick_angle))
- tick_loc_labels.append((tick_loc, tick_label))
-
- self.minor_ticks.update_locs_angles(tick_loc_angles, renderer)
- self.minor_ticklabels.update_locs_labels(tick_loc_labels, renderer)
-
- self.minor_ticks.draw(renderer)
- self.minor_ticklabels.draw(renderer)
-
- return self.major_ticklabels.get_window_extents(renderer)
-
- def _init_label(self):
- # x in axes coords, y in display coords (to be updated at draw
- # time by _update_label_positions)
- fontprops = font_manager.FontProperties(size=rcParams['axes.labelsize'])
- textprops = dict(fontproperties = fontprops,
- color = rcParams['axes.labelcolor'],
- )
-
- self.label = AxisLabel(0, 0, "",
- fontproperties=fontprops,
- color = rcParams['axes.labelcolor'],
- )
- self.label.set_figure(self.axes.figure)
-
- #self._set_artist_props(label)
-
- def _draw_label(self, renderer, bboxes):
-
- if not self.label.get_visible():
- return
-
- fontprops = font_manager.FontProperties(size=rcParams['axes.labelsize'])
- pad_points = self.LABELPAD + self.major_tick_pad
- xy, tr = self._helper.get_label_pos()
- if xy is None: return
-
- x, y = xy
- tr2, va, ha, a = self._helper.get_label_transform(pad_points, fontprops,
- renderer,
- bboxes=bboxes,
- trans=tr+self.offset_transform)
-
- self.label.set(x=x, y=y,
- transform=tr2,
- va=va, ha=ha, rotation=a)
-
-# if self.label.get_text() == "__from_axes__":
-# label_text = self.axis.get_label().get_text()
-# self.label.set_text(label_text)
-# self.label.draw(renderer)
-# self.label.set_text("__from_axes__")
-# else:
-
- self.label.draw(renderer)
-
-
- def set_label(self, s):
- self.label.set_text(s)
-
-
 def draw(self, renderer):
- 'Draw the axis lines, tick lines and labels'
+ if self._grid_helper is not None:
+ self._grid_helper.update_lim(self.axes)
+ #self.set_transform(self._grid_helper.get_gridlines_transform())
+ gl = self._grid_helper.get_gridlines()
+ if gl:
+ self.set_segments([np.transpose(l) for l in gl])
+ else:
+ self.set_segments([])
+ super(GridlinesCollection, self).draw(renderer)
 
- if not self.get_visible(): return
 
- renderer.open_group(__name__)
 
+class AxisGridLineBase(martist.Artist):
+ def __init__(self, *kl, **kw):
+ super(AxisGridLineBase, self).__init__(*kl, **kw)
 
- dpi_cor = renderer.points_to_pixels(1.)
- self.dpi_transform.clear().scale(dpi_cor, dpi_cor)
 
+class AxisArtist(AxisGridLineBase):
+ """
+ an artist which draws axis (a line along which the n-th axes coord
+ is constant) line, ticks, ticklabels, and axis label.
 
- self._draw_line(renderer)
- bboxes = self._draw_ticks(renderer)
+ It requires an AxisArtistHelper instance.
+ """
 
- #self._draw_offsetText(renderer)
- self._draw_label(renderer, bboxes)
-
- renderer.close_group(__name__)
-
- def get_ticklabel_extents(self, renderer):
- pass
-
- def toggle(self, all=None, ticks=None, ticklabels=None, label=None):
- if all:
- _ticks, _ticklabels, _label = True, True, True
- elif all is not None:
- _ticks, _ticklabels, _label = False, False, False
- else:
- _ticks, _ticklabels, _label = None, None, None
-
- if ticks is not None:
- _ticks = ticks
- if ticklabels is not None:
- _ticklabels = ticklabels
- if label is not None:
- _label = label
-
- if _ticks is not None:
- self.major_ticks.set_visible(_ticks)
- self.minor_ticks.set_visible(_ticks)
- if _ticklabels is not None:
- self.major_ticklabels.set_visible(_ticklabels)
- self.minor_ticklabels.set_visible(_ticklabels)
- if _label is not None:
- self.label.set_visible(_label)
-
-
-class AxisLine(AxisGridLineBase):
- """ a line along which the n-th axes coord is constant."""
-
 LABELPAD = 5
 ZORDER=2.5
 
@@ -920,26 +907,23 @@
 minor_tick_size=None,
 minor_tick_pad=None,
 **kw):
-
+ """
+ axes is also used to follow the axis attribute (tick color, etc).
+ """
 AxisGridLineBase.__init__(self, **kw)
 
 self.axes = axes
 
- self._helper = helper
+ self._axis_artist_helper = helper
 
- #if offset_transform is None:
- # self.offset_transform = IdentityTransform()
- #else:
- # self.offset_transform = offset_transform
-
 if offset is None:
 offset = (0, 0)
 self.dpi_transform = Affine2D()
 self.offset_transform = ScaledTranslation(offset[0], offset[1],
 self.dpi_transform)
 
- self.set_transform(axes.transAxes + \
- self.offset_transform)
+ #self.set_transform(axes.transAxes + \
+ # self.offset_transform)
 
 self._label_visible = True
 self._majortick_visible = True
@@ -948,7 +932,7 @@
 self._minorticklabel_visible = True
 
 
- if self._helper.label_direction in ["left", "right"]:
+ if self._axis_artist_helper.label_direction in ["left", "right"]:
 axis_name = "ytick"
 self.axis = axes.yaxis
 else:
@@ -967,29 +951,35 @@
 
 self._init_line()
 self._init_ticks()
- self._init_offsetText(self._helper.label_direction)
+ self._init_offsetText(self._axis_artist_helper.label_direction)
 self._init_label()
 
 self.set_zorder(self.ZORDER)
 
+ def get_transform(self):
+ return self.axes.transAxes + self.offset_transform
+
+ def get_helper(self):
+ return self._axis_artist_helper
+
+
 def _init_line(self):
- tran = self._helper.get_line_transform() + self.offset_transform
- self.line = BezierPath(self._helper.get_line(),
+ tran = self._axis_artist_helper.get_line_transform(self.axes) \
+ + self.offset_transform
+ self.line = BezierPath(self._axis_artist_helper.get_line(self.axes),
 color=rcParams['axes.edgecolor'],
 linewidth=rcParams['axes.linewidth'],
 transform=tran)
 
- def get_helper(self):
- return self._helper
-
 def _draw_line(self, renderer):
- self.line.set_path(self._helper.get_line())
+ self.line.set_path(self._axis_artist_helper.get_line(self.axes))
 self.line.draw(renderer)
 
 
 def _init_ticks(self):
 
- transform=self._helper.get_tick_transform()+self.offset_transform
+ transform=self._axis_artist_helper.get_tick_transform(self.axes) \
+ + self.offset_transform
 
 self.major_ticks = Ticks(self.major_tick_size,
 axis=self.axis,
@@ -1002,16 +992,17 @@
 size = rcParams['xtick.labelsize']
 
 fontprops = font_manager.FontProperties(size=size)
- tvhl = self._helper.get_ticklabel_transform(self.major_tick_pad,
- fontprops=fontprops,
- renderer=None,
- trans=transform)
+ #tvhl = self._axis_artist_helper.get_ticklabel_transform(
+ tvhl = self._axis_artist_helper.get_ticklabel_offset_transform( \
+ self.axes,
+ self.major_tick_pad,
+ fontprops=fontprops,
+ renderer=None,
+ )
+ #trans=transform)
 trans, vert, horiz, label_a = tvhl
+ trans = transform + trans
 
- #color = rcParams['xtick.color']
- #self.major_ticklabels = TickLabels(size, color=color)
- #self.minor_ticklabels = TickLabels(size, color=color)
-
 self.major_ticklabels = TickLabels(size, axis=self.axis)
 self.minor_ticklabels = TickLabels(size, axis=self.axis)
 
@@ -1040,7 +1031,7 @@
 
 x,y,va,ha = self._offsetText_pos[direction]
 
- #d = self._helper.label_direction
+ #d = self._axis_artist_helper.label_direction
 #fp = font_manager.FontProperties(size=rcParams['xtick.labelsize'])
 #fp = font_manager.FontProperties(size=self.major_ticklabels.get_size())
 self.offsetText = mtext.Annotation("",
@@ -1056,7 +1047,7 @@
 
 
 def _update_offsetText(self):
- self.offsetText.set_text( self._helper.axis.major.formatter.get_offset() )
+ self.offsetText.set_text( self.axis.major.formatter.get_offset() )
 self.offsetText.set_size(self.major_ticklabels.get_size())
 offset = self.major_tick_pad + self.major_ticklabels.get_size() + 2.
 self.offsetText.xytext= (0, offset)
@@ -1072,7 +1063,8 @@
 #major_locs, major_angles,
 #minor_locs, minor_angles):
 
- majortick_iter, minortick_iter = self._helper.get_tick_iterators()
+ majortick_iter, minortick_iter = \
+ self._axis_artist_helper.get_tick_iterators(self.axes)
 
 tick_loc_angles = []
 tick_loc_labels = []
@@ -1081,13 +1073,19 @@
 tick_loc_labels.append((tick_loc, tick_label))
 
 
- transform=self._helper.get_tick_transform()+self.offset_transform
+ transform=self._axis_artist_helper.get_tick_transform(self.axes) \
+ + self.offset_transform
 fontprops = font_manager.FontProperties(size=12)
- tvhl = self._helper.get_ticklabel_transform(self.major_tick_pad,
- fontprops=fontprops,
- renderer=renderer,
- trans=transform)
+ tvhl = self._axis_artist_helper.get_ticklabel_offset_transform( \
+ self.axes,
+ self.major_tick_pad,
+ fontprops=fontprops,
+ renderer=renderer,
+ )
+ #trans=transform)
 trans, va, ha, a = tvhl
+ trans = transform + trans
+
 self.major_ticklabels.set(transform=trans,
 va=va, ha=ha, rotation=a)
 
@@ -1140,14 +1138,18 @@
 
 fontprops = font_manager.FontProperties(size=rcParams['axes.labelsize'])
 pad_points = self.LABELPAD + self.major_tick_pad
- xy, tr = self._helper.get_label_pos()
+ xy, tr = self._axis_artist_helper.get_label_pos(self.axes)
 if xy is None: return
 
 x, y = xy
- tr2, va, ha, a = self._helper.get_label_transform(pad_points, fontprops,
- renderer,
- bboxes=bboxes,
- trans=tr+self.offset_transform)
+ tr2, va, ha, a = self._axis_artist_helper.get_label_offset_transform(\
+ self.axes,
+ pad_points, fontprops,
+ renderer,
+ bboxes=bboxes,
+ )
+ #trans=tr+self.offset_transform)
+ tr2 = (tr+self.offset_transform) + tr2
 
 self.label.set(x=x, y=y,
 transform=tr2,
@@ -1174,6 +1...
 
[truncated message content]
From: <cm...@us...> - 2009年06月02日 02:31:03
Revision: 7174
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7174&view=rev
Author: cmoad
Date: 2009年06月02日 02:30:57 +0000 (2009年6月02日)
Log Message:
-----------
comment fixes
Modified Paths:
--------------
 trunk/matplotlib/release/win32/Makefile
Modified: trunk/matplotlib/release/win32/Makefile
===================================================================
--- trunk/matplotlib/release/win32/Makefile	2009年06月02日 00:31:45 UTC (rev 7173)
+++ trunk/matplotlib/release/win32/Makefile	2009年06月02日 02:30:57 UTC (rev 7174)
@@ -1,11 +1,11 @@
 PYTHON = C:/Python26/python.exe
-SRCDIR = ${PWD}# autoconf needs this path
-WINSRCDIR = `${PWD}/data/mingw_path.sh ${PWD}`# distutils needs windows paths
+SRCDIR = ${PWD}
+WINSRCDIR = `${PWD}/data/mingw_path.sh ${PWD}`
 ZLIBVERSION = 1.2.3
-PNGVERSION = 1.2.33
-FREETYPEVERSION = 2.3.7
-#TCLTKVERSION = 8.4.19# Before Python 2.6
-TCLTKVERSION = 8.5.7# Python 2.6
+PNGVERSION = 1.2.23
+FREETYPEVERSION = 2.3.9
+#TCLTKVERSION = 8.4.19
+TCLTKVERSION = 8.5.7
 MPLVERSION = 0.98.6svn
 
 ## You shouldn't need to configure past this point
@@ -24,7 +24,7 @@
 LDFLAGS += -L${SRCDIR}/libpng-${PNGVERSION}
 LDFLAGS += -L${SRCDIR}/freetype-${FREETYPEVERSION}
 
-PY_INCLUDE = "${WINSRCDIR}/zlib-${ZLIBVERSION};${WINSRCDIR}/libpng-${PNGVERSION};${WINSRCDIR}/freetype-${FREETYPEVERSION}/include;${WINSRCDIR}/tcl${TCLTKVERSION}/generic;${WINSRCDIR}/tcl${TCLTKVERSION}/win;${WINSRCDIR}/tk${TCLTKVERSION}/generic;${WINSRCDIR}/tk${TCLTKVERSION}/win;${WINSRCDIR}/tk${TCLTKVERSION}/xlib"
+PY_INCLUDE = "${WINSRCDIR}\\zlib-${ZLIBVERSION};${WINSRCDIR}/libpng-${PNGVERSION};${WINSRCDIR}/freetype-${FREETYPEVERSION}/include;${WINSRCDIR}/tcl${TCLTKVERSION}/generic;${WINSRCDIR}/tcl${TCLTKVERSION}/win;${WINSRCDIR}/tk${TCLTKVERSION}/generic;${WINSRCDIR}/tk${TCLTKVERSION}/win;${WINSRCDIR}/tk${TCLTKVERSION}/xlib"
 
 PY_LINKER = "${WINSRCDIR}/zlib-${ZLIBVERSION};${WINSRCDIR}/libpng-${PNGVERSION};${WINSRCDIR}/freetype-${FREETYPEVERSION}"
 
@@ -38,8 +38,8 @@
 
 fetch_deps:
 	wget http://www.zlib.net/zlib-${ZLIBVERSION}.tar.gz
-	wget http://internap.dl.sourceforge.net/sourceforge/libpng/libpng-${PNGVERSION}.tar.bz2
-	wget http://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPEVERSION}.tar.bz2
+	wget http://prdownloads.sourceforge.net/libpng/libpng-${PNGVERSION}.tar.bz2
+	wget http://prdownloads.sourceforge.net/freetype/freetype-2.3.9.tar.bz2
 	wget http://prdownloads.sourceforge.net/tcl/tcl${TCLTKVERSION}-src.tar.gz
 	wget http://prdownloads.sourceforge.net/tcl/tk${TCLTKVERSION}-src.tar.gz
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2009年06月02日 01:14:37
Revision: 7173
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7173&view=rev
Author: leejjoon
Date: 2009年06月02日 00:31:45 +0000 (2009年6月02日)
Log Message:
-----------
axes_grid: fix broken spine support
Modified Paths:
--------------
 trunk/matplotlib/examples/axes_grid/simple_axisline.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/ChangeLog
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_rgb.py
 trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py
Modified: trunk/matplotlib/examples/axes_grid/simple_axisline.py
===================================================================
--- trunk/matplotlib/examples/axes_grid/simple_axisline.py	2009年06月01日 22:39:49 UTC (rev 7172)
+++ trunk/matplotlib/examples/axes_grid/simple_axisline.py	2009年06月02日 00:31:45 UTC (rev 7173)
@@ -26,7 +26,8 @@
 
 # make new (right-side) yaxis, but wth some offset
 offset = (20, 0)
- new_axisline = ax.get_grid_helper().new_axisline
+ new_axisline = ax.get_grid_helper().new_fixed_axis
+
 ax.axis["right2"] = new_axisline(loc="right",
 offset=offset)
 ax.axis["right2"].label.set_text("Label Y2")
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/ChangeLog
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/ChangeLog	2009年06月01日 22:39:49 UTC (rev 7172)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/ChangeLog	2009年06月02日 00:31:45 UTC (rev 7173)
@@ -1,3 +1,7 @@
+2009年06月01日 Jae-Joon Lee <lee...@gm...>
+
+	* axislines.py (Axes.toggle_axisline): fix broken spine support.
+
 2009年05月04日 Jae-Joon Lee <lee...@gm...>
 
 	* inset_locator.py (inset_axes, zoomed_inset_axes): axes_class support
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_rgb.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_rgb.py	2009年06月01日 22:39:49 UTC (rev 7172)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_rgb.py	2009年06月02日 00:31:45 UTC (rev 7173)
@@ -10,8 +10,8 @@
 
 pad_size = Size.Fraction(pad, Size.AxesY(ax))
 
- xsize = Size.Fraction(Size.AxesX(ax), (1.-2.*pad)/3.)
- ysize = Size.Fraction(Size.AxesY(ax), (1.-2.*pad)/3.)
+ xsize = Size.Fraction((1.-2.*pad)/3., Size.AxesX(ax))
+ ysize = Size.Fraction((1.-2.*pad)/3., Size.AxesY(ax))
 
 divider.set_horizontal([Size.AxesX(ax), pad_size, xsize])
 divider.set_vertical([ysize, pad_size, ysize, pad_size, ysize])
@@ -51,6 +51,22 @@
 #import matplotlib.axes as maxes
 import axislines
 
+def imshow_rgb(ax, r, g, b, **kwargs):
+ ny, nx = r.shape
+ R = np.zeros([ny, nx, 3], dtype="d")
+ R[:,:,0] = r
+ G = np.zeros_like(R)
+ G[:,:,1] = g
+ B = np.zeros_like(R)
+ B[:,:,2] = b
+
+ RGB = R + G + B
+
+ im_rgb = ax.imshow(RGB, **kwargs)
+
+ return im_rgb
+
+
 class RGBAxes(object):
 def __init__(self, *kl, **kwargs):
 pad = kwargs.pop("pad", 0.0)
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py	2009年06月01日 22:39:49 UTC (rev 7172)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py	2009年06月02日 00:31:45 UTC (rev 7173)
@@ -1249,16 +1249,14 @@
 b = not self._axisline_on
 if b:
 self._axisline_on = True
- #self.frame.set_visible(False)
 for s in self.spines.values():
- s.artist.set_visible(False)
+ s.set_visible(False)
 self.xaxis.set_visible(False)
 self.yaxis.set_visible(False)
 else:
 self._axisline_on = False
- #self.frame.set_visible(True)
 for s in self.spines.values():
- s.artist.set_visible(True)
+ s.set_visible(True)
 self.xaxis.set_visible(True)
 self.yaxis.set_visible(True)
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <as...@us...> - 2009年06月01日 22:39:54
Revision: 7172
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7172&view=rev
Author: astraw
Date: 2009年06月01日 22:39:49 +0000 (2009年6月01日)
Log Message:
-----------
Add set_color() convenience method to Spine class
Modified Paths:
--------------
 trunk/matplotlib/examples/pylab_examples/spine_placement_demo.py
 trunk/matplotlib/lib/matplotlib/spines.py
Modified: trunk/matplotlib/examples/pylab_examples/spine_placement_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/spine_placement_demo.py	2009年06月01日 22:20:26 UTC (rev 7171)
+++ trunk/matplotlib/examples/pylab_examples/spine_placement_demo.py	2009年06月01日 22:39:49 UTC (rev 7172)
@@ -12,7 +12,7 @@
 if loc in ['left','bottom']:
 spine.set_position(('outward',10)) # outward by 10 points
 elif loc in ['right','top']:
- spine.set_edgecolor('none') # don't draw spine
+ spine.set_color('none') # don't draw spine
 else:
 raise ValueError('unknown spine location: %s'%loc)
 
@@ -34,9 +34,9 @@
 ax.set_title('centered spines')
 ax.plot(x,y)
 ax.spines['left'].set_position('center')
-ax.spines['right'].set_edgecolor('none')
+ax.spines['right'].set_color('none')
 ax.spines['bottom'].set_position('center')
-ax.spines['top'].set_edgecolor('none')
+ax.spines['top'].set_color('none')
 ax.xaxis.set_ticks_position('bottom')
 ax.yaxis.set_ticks_position('left')
 
@@ -44,9 +44,9 @@
 ax.set_title('zeroed spines')
 ax.plot(x,y)
 ax.spines['left'].set_position('zero')
-ax.spines['right'].set_edgecolor('none')
+ax.spines['right'].set_color('none')
 ax.spines['bottom'].set_position('zero')
-ax.spines['top'].set_edgecolor('none')
+ax.spines['top'].set_color('none')
 ax.xaxis.set_ticks_position('bottom')
 ax.yaxis.set_ticks_position('left')
 
@@ -54,9 +54,9 @@
 ax.set_title('spines at axes (0.6, 0.1)')
 ax.plot(x,y)
 ax.spines['left'].set_position(('axes',0.6))
-ax.spines['right'].set_edgecolor('none')
+ax.spines['right'].set_color('none')
 ax.spines['bottom'].set_position(('axes',0.1))
-ax.spines['top'].set_edgecolor('none')
+ax.spines['top'].set_color('none')
 ax.xaxis.set_ticks_position('bottom')
 ax.yaxis.set_ticks_position('left')
 
@@ -64,9 +64,9 @@
 ax.set_title('spines at data (1,2)')
 ax.plot(x,y)
 ax.spines['left'].set_position(('data',1))
-ax.spines['right'].set_edgecolor('none')
+ax.spines['right'].set_color('none')
 ax.spines['bottom'].set_position(('data',2))
-ax.spines['top'].set_edgecolor('none')
+ax.spines['top'].set_color('none')
 ax.xaxis.set_ticks_position('bottom')
 ax.yaxis.set_ticks_position('left')
 
@@ -77,7 +77,7 @@
 if loc in spines:
 spine.set_position(('outward',10)) # outward by 10 points
 else:
- spine.set_edgecolor('none') # don't draw spine
+ spine.set_color('none') # don't draw spine
 
 # turn off ticks where there is no spine
 if 'left' in spines:
Modified: trunk/matplotlib/lib/matplotlib/spines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/spines.py	2009年06月01日 22:20:26 UTC (rev 7171)
+++ trunk/matplotlib/lib/matplotlib/spines.py	2009年06月01日 22:39:49 UTC (rev 7172)
@@ -303,3 +303,18 @@
 result = cls(axes,spine_type,path,**kwargs)
 result.set_patch_circle(center,radius)
 return result
+
+ def set_color(self, c):
+ """
+ Set the edgecolor.
+
+ ACCEPTS: matplotlib color arg or sequence of rgba tuples
+
+ .. seealso::
+
+ :meth:`set_facecolor`, :meth:`set_edgecolor`
+ For setting the edge or face color individually.
+ """
+ # The facecolor of a spine is always 'none' by default -- let
+ # the user change it manually if desired.
+ self.set_edgecolor(c)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2009年06月01日 22:20:28
Revision: 7171
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7171&view=rev
Author: efiring
Date: 2009年06月01日 22:20:26 +0000 (2009年6月01日)
Log Message:
-----------
Add set_color method to Patch, to match Collections
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/patches.py
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py	2009年06月01日 21:41:46 UTC (rev 7170)
+++ trunk/matplotlib/lib/matplotlib/patches.py	2009年06月01日 22:20:26 UTC (rev 7171)
@@ -199,6 +199,21 @@
 """alias for set_facecolor"""
 return self.set_facecolor(color)
 
+ def set_color(self, c):
+ """
+ Set both the edgecolor and the facecolor.
+
+ ACCEPTS: matplotlib color arg or sequence of rgba tuples
+
+ .. seealso::
+
+ :meth:`set_facecolor`, :meth:`set_edgecolor`
+ For setting the edge or face color individually.
+ """
+ self.set_facecolor(c)
+ self.set_edgecolor(c)
+
+
 def set_linewidth(self, w):
 """
 Set the patch linewidth in points
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <as...@us...> - 2009年06月01日 21:42:01
Revision: 7169
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7169&view=rev
Author: astraw
Date: 2009年06月01日 21:41:31 +0000 (2009年6月01日)
Log Message:
-----------
use cbook.is_string_like() instead of isinstance() for spines
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/lib/matplotlib/spines.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2009年06月01日 21:41:21 UTC (rev 7168)
+++ trunk/matplotlib/CHANGELOG	2009年06月01日 21:41:31 UTC (rev 7169)
@@ -1,3 +1,5 @@
+2009年06月01日 use cbook.is_string_like() instead of isinstance() for spines - ADS
+
 2009年06月01日 cla() support for spines - ADS
 
 2009年06月01日 Removed support for gtk < 2.4. - EF
Modified: trunk/matplotlib/lib/matplotlib/spines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/spines.py	2009年06月01日 21:41:21 UTC (rev 7168)
+++ trunk/matplotlib/lib/matplotlib/spines.py	2009年06月01日 21:41:31 UTC (rev 7169)
@@ -8,6 +8,7 @@
 import matplotlib.transforms as mtransforms
 import matplotlib.lines as mlines
 import matplotlib.patches as mpatches
+import matplotlib.cbook as cbook
 import warnings
 
 class Spine(martist.Artist):
@@ -87,7 +88,7 @@
 """calculate the offset transform performed by the spine"""
 self._ensure_position_is_set()
 position = self._position
- if isinstance(position,basestring):
+ if cbook.is_string_like(position):
 if position=='center':
 position = ('axes',0.5)
 elif position=='zero':
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing results of 79

<< < 1 2 3 4 > >> (Page 3 of 4)
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 によって変換されたページ (->オリジナル) /