SF.net SVN: matplotlib:[7184] trunk/matplotlib

2009-06-06 Thread jdh2358
Revision: 7184
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7184&view=rev
Author:   jdh2358
Date: 2009-06-06 11:36:10 + (Sat, 06 Jun 2009)

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.

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-checkins mailing lis

SF.net SVN: matplotlib:[7185] trunk/matplotlib/lib/matplotlib

2009-06-06 Thread jdh2358
Revision: 7185
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7185&view=rev
Author:   jdh2358
Date: 2009-06-06 13:26:49 + (Sat, 06 Jun 2009)

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.

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[7186] trunk/matplotlib/lib/matplotlib/artist.py

2009-06-06 Thread jdh2358
Revision: 7186
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7186&view=rev
Author:   jdh2358
Date: 2009-06-06 14:16:40 + (Sat, 06 Jun 2009)

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.

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[7187] trunk/matplotlib/CHANGELOG

2009-06-06 Thread efiring
Revision: 7187
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7187&view=rev
Author:   efiring
Date: 2009-06-06 18:18:54 + (Sat, 06 Jun 2009)

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.

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[7188] trunk/matplotlib/lib/matplotlib

2009-06-06 Thread efiring
Revision: 7188
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7188&view=rev
Author:   efiring
Date: 2009-06-06 18:21:51 + (Sat, 06 Jun 2009)

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.py2009-06-06 18:18:54 UTC 
(rev 7187)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py2009-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.

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins


SF.net SVN: matplotlib:[7189] trunk/matplotlib/lib/matplotlib/colors.py

2009-06-06 Thread efiring
Revision: 7189
  http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7189&view=rev
Author:   efiring
Date: 2009-06-06 21:35:36 + (Sat, 06 Jun 2009)

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.

--
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins