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
|
|
From: <js...@us...> - 2009-06-24 18:19:54
|
Revision: 7237
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7237&view=rev
Author: jswhit
Date: 2009-06-24 18:18:55 +0000 (Wed, 24 Jun 2009)
Log Message:
-----------
simplify _check_ax method
Modified Paths:
--------------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-06-24 18:11:30 UTC (rev 7236)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-06-24 18:18:55 UTC (rev 7237)
@@ -3393,25 +3393,22 @@
raise KeyError("barstyle must be 'simple' or 'fancy'")
return rets
- def _check_ax(self, ax=None):
+ def _check_ax(self):
"""
- Returns the axis on which to draw.
- By default, returns self.ax. If None, set it to plt.gca()
+ Returns the axis on which to draw.
+ Returns self.ax, or if self.ax=None returns plt.gca().
"""
- #
- if ax is None:
- if self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- else:
- ax = self.ax
+ if self.ax is None:
+ try:
+ ax = plt.gca()
+ except:
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
# associate an axes instance with this Basemap instance
# the first time this method is called.
- # self.ax = ax
- #return self.ax
+ #self.ax = ax
+ else:
+ ax = self.ax
return ax
### End of Basemap class
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2009-06-24 18:11:33
|
Revision: 7236
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7236&view=rev
Author: jswhit
Date: 2009-06-24 18:11:30 +0000 (Wed, 24 Jun 2009)
Log Message:
-----------
put ax checking code in a separate private method
Modified Paths:
--------------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-06-24 05:51:52 UTC (rev 7235)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-06-24 18:11:30 UTC (rev 7236)
@@ -1203,14 +1203,7 @@
returns matplotlib.collections.PatchCollection representing map boundary.
"""
# get current axes instance (if none specified).
- if ax is None and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif ax is None and self.ax is not None:
- ax = self.ax
+ ax = ax or self._check_ax()
limb = None
if self.projection in ['ortho','geos'] or (self.projection=='aeqd' and\
self._fulldisk):
@@ -1344,14 +1337,7 @@
if self.resolution is None:
raise AttributeError, 'there are no boundary datasets associated with this Basemap instance'
# get current axes instance (if none specified).
- if ax is None and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif ax is None and self.ax is not None:
- ax = self.ax
+ ax = ax or self._check_ax()
# get axis background color.
axisbgc = ax.get_axis_bgcolor()
npoly = 0
@@ -1414,14 +1400,7 @@
if self.resolution is None:
raise AttributeError, 'there are no boundary datasets associated with this Basemap instance'
# get current axes instance (if none specified).
- if ax is None and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif ax is None and self.ax is not None:
- ax = self.ax
+ ax = ax or self._check_ax()
coastlines = LineCollection(self.coastsegs,antialiaseds=(antialiased,))
coastlines.set_color(color)
coastlines.set_linewidth(linewidth)
@@ -1461,14 +1440,7 @@
if not hasattr(self,'cntrysegs'):
self.cntrysegs, types = self._readboundarydata('countries')
# get current axes instance (if none specified).
- if ax is None and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif ax is None and self.ax is not None:
- ax = self.ax
+ ax = ax or self._check_ax()
countries = LineCollection(self.cntrysegs,antialiaseds=(antialiased,))
countries.set_color(color)
countries.set_linewidth(linewidth)
@@ -1508,14 +1480,7 @@
if not hasattr(self,'statesegs'):
self.statesegs, types = self._readboundarydata('states')
# get current axes instance (if none specified).
- if ax is None and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif ax is None and self.ax is not None:
- ax = self.ax
+ ax = ax or self._check_ax()
states = LineCollection(self.statesegs,antialiaseds=(antialiased,))
states.set_color(color)
states.set_linewidth(linewidth)
@@ -1555,14 +1520,7 @@
if not hasattr(self,'riversegs'):
self.riversegs, types = self._readboundarydata('rivers')
# get current axes instance (if none specified).
- if ax is None and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif ax is None and self.ax is not None:
- ax = self.ax
+ ax = ax or self._check_ax()
rivers = LineCollection(self.riversegs,antialiaseds=(antialiased,))
rivers.set_color(color)
rivers.set_linewidth(linewidth)
@@ -1703,14 +1661,7 @@
# draw shape boundaries using LineCollection.
if drawbounds:
# get current axes instance (if none specified).
- if ax is None and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif ax is None and self.ax is not None:
- ax = self.ax
+ ax = ax or self._check_ax()
# make LineCollections for each polygon.
lines = LineCollection(shpsegs,antialiaseds=(1,))
lines.set_color(color)
@@ -1783,14 +1734,7 @@
associated with each parallel.
"""
# get current axes instance (if none specified).
- if ax is None and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif ax is None and self.ax is not None:
- ax = self.ax
+ ax = ax or self._check_ax()
# don't draw meridians past latmax, always draw parallel at latmax.
if latmax is None: latmax = 80.
# offset for labels.
@@ -2043,14 +1987,7 @@
associated with each meridian.
"""
# get current axes instance (if none specified).
- if ax is None and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif ax is None and self.ax is not None:
- ax = self.ax
+ ax = ax or self._check_ax()
# don't draw meridians past latmax, always draw parallel at latmax.
if latmax is None: latmax = 80. # unused w/ cyl, merc or miller proj.
# offset for labels.
@@ -2255,16 +2192,7 @@
Other \**kwargs passed on to matplotlib.patches.Polygon.
returns a matplotlib.patches.Polygon object."""
- if not kwargs.has_key('ax') and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif not kwargs.has_key('ax') and self.ax is not None:
- ax = self.ax
- else:
- ax = kwargs.pop('ax')
+ ax = kwargs.pop('ax', None) or self._check_ax()
g = pyproj.Geod(a=self.rmajor,b=self.rminor)
az12,az21,dist = g.inv(lon_0,lat_0,lon_0,lat_0+radius_deg)
seg = [self(lon_0,lat_0+radius_deg)]
@@ -2577,14 +2505,7 @@
or specified axes instance.
"""
# get current axes instance (if none specified).
- if ax is None and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif ax is None and self.ax is not None:
- ax = self.ax
+ ax = ax or self._check_ax()
# update data limits for map domain.
corners = ((self.llcrnrx,self.llcrnry), (self.urcrnrx,self.urcrnry))
ax.update_datalim( corners )
@@ -2621,16 +2542,7 @@
Other \**kwargs passed on to matplotlib.pyplot.scatter.
"""
- if not kwargs.has_key('ax') and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif not kwargs.has_key('ax') and self.ax is not None:
- ax = self.ax
- else:
- ax = kwargs.pop('ax')
+ ax = kwargs.pop('ax', None) or self._check_ax()
# allow callers to override the hold state by passing hold=True|False
b = ax.ishold()
h = kwargs.pop('hold',None)
@@ -2664,16 +2576,7 @@
Other \**kwargs passed on to matplotlib.pyplot.plot.
"""
- if not kwargs.has_key('ax') and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif not kwargs.has_key('ax') and self.ax is not None:
- ax = self.ax
- else:
- ax = kwargs.pop('ax')
+ ax = kwargs.pop('ax', None) or self._check_ax()
# allow callers to override the hold state by passing hold=True|False
b = ax.ishold()
h = kwargs.pop('hold',None)
@@ -2707,16 +2610,7 @@
returns an matplotlib.image.AxesImage instance.
"""
- if not kwargs.has_key('ax') and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif not kwargs.has_key('ax') and self.ax is not None:
- ax = self.ax
- else:
- ax = kwargs.pop('ax')
+ ax = kwargs.pop('ax', None) or self._check_ax()
kwargs['extent']=(self.llcrnrx,self.urcrnrx,self.llcrnry,self.urcrnry)
# use origin='lower', unless overridden.
if not kwargs.has_key('origin'):
@@ -2758,16 +2652,7 @@
Other \**kwargs passed on to matplotlib.pyplot.pcolor.
"""
- if not kwargs.has_key('ax') and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif not kwargs.has_key('ax') and self.ax is not None:
- ax = self.ax
- else:
- ax = kwargs.pop('ax')
+ ax = kwargs.pop('ax', None) or self._check_ax()
# make x,y masked arrays
# (masked where data is outside of projection limb)
x = ma.masked_values(np.where(x > 1.e20,1.e20,x), 1.e20)
@@ -2805,16 +2690,7 @@
Other \**kwargs passed on to matplotlib.pyplot.pcolormesh.
"""
- if not kwargs.has_key('ax') and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif not kwargs.has_key('ax') and self.ax is not None:
- ax = self.ax
- else:
- ax = kwargs.pop('ax')
+ ax = kwargs.pop('ax', None) or self._check_ax()
# allow callers to override the hold state by passing hold=True|False
b = ax.ishold()
h = kwargs.pop('hold',None)
@@ -2848,16 +2724,7 @@
Other \*args and \**kwargs passed on to matplotlib.pyplot.contour.
"""
- if not kwargs.has_key('ax') and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif not kwargs.has_key('ax') and self.ax is not None:
- ax = self.ax
- else:
- ax = kwargs.pop('ax')
+ ax = kwargs.pop('ax', None) or self._check_ax()
# make sure x is monotonically increasing - if not,
# print warning suggesting that the data be shifted in longitude
# with the shiftgrid function.
@@ -2921,16 +2788,7 @@
Other \*args and \**kwargs passed on to matplotlib.pyplot.scatter.
"""
- if not kwargs.has_key('ax') and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif not kwargs.has_key('ax') and self.ax is not None:
- ax = self.ax
- else:
- ax = kwargs.pop('ax')
+ ax = kwargs.pop('ax', None) or self._check_ax()
# make sure x is monotonically increasing - if not,
# print warning suggesting that the data be shifted in longitude
# with the shiftgrid function.
@@ -2991,16 +2849,7 @@
Other \*args and \**kwargs passed on to matplotlib.pyplot.quiver.
"""
- if not kwargs.has_key('ax') and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif not kwargs.has_key('ax') and self.ax is not None:
- ax = self.ax
- else:
- ax = kwargs.pop('ax')
+ ax = kwargs.pop('ax', None) or self._check_ax()
# allow callers to override the hold state by passing hold=True|False
b = ax.ishold()
h = kwargs.pop('hold',None)
@@ -3037,16 +2886,7 @@
barb method requires matplotlib 0.98.3 or higher,
you have %s""" % _matplotlib_version)
raise NotImplementedError(msg)
- if not kwargs.has_key('ax') and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif not kwargs.has_key('ax') and self.ax is not None:
- ax = self.ax
- else:
- ax = kwargs.pop('ax')
+ ax = kwargs.pop('ax', None) or self._check_ax()
# allow callers to override the hold state by passing hold=True|False
b = ax.ishold()
h = kwargs.pop('hold',None)
@@ -3136,16 +2976,7 @@
rgba_ocean = ocean_color
# look for axes instance (as keyword, an instance variable
# or from plt.gca().
- if not kwargs.has_key('ax') and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif not kwargs.has_key('ax') and self.ax is not None:
- ax = self.ax
- else:
- ax = kwargs.pop('ax')
+ ax = kwargs.pop('ax', None) or self._check_ax()
# if lsmask,lsmask_lons,lsmask_lats keywords not given,
# read default land-sea mask in from file.
if lsmask is None or lsmask_lons is None or lsmask_lats is None:
@@ -3267,16 +3098,7 @@
except ImportError:
raise ImportError('warpimage method requires PIL (http://www.pythonware.com/products/pil)')
from matplotlib.image import pil_to_array
- if not kwargs.has_key('ax') and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif not kwargs.has_key('ax') and self.ax is not None:
- ax = self.ax
- else:
- ax = kwargs.pop('ax')
+ ax = kwargs.pop('ax', None) or self._check_ax()
# default image file is blue marble next generation
# from NASA (http://visibleearth.nasa.gov).
if image == "bluemarble":
@@ -3436,14 +3258,7 @@
Extra keyword ``ax`` can be used to override the default axis instance.
"""
# get current axes instance (if none specified).
- if ax is None and self.ax is None:
- try:
- ax = plt.gca()
- except:
- import matplotlib.pyplot as plt
- ax = plt.gca()
- elif ax is None and self.ax is not None:
- ax = self.ax
+ ax = ax or self._check_ax()
# not valid for cylindrical projection
if self.projection == 'cyl':
raise ValueError("cannot draw map scale for projection='cyl'")
@@ -3578,6 +3393,27 @@
raise KeyError("barstyle must be 'simple' or 'fancy'")
return rets
+ def _check_ax(self, ax=None):
+ """
+ Returns the axis on which to draw.
+ By default, returns self.ax. If None, set it to plt.gca()
+ """
+ #
+ if ax is None:
+ if self.ax is None:
+ try:
+ ax = plt.gca()
+ except:
+ import matplotlib.pyplot as plt
+ ax = plt.gca()
+ else:
+ ax = self.ax
+ # associate an axes instance with this Basemap instance
+ # the first time this method is called.
+ # self.ax = ax
+ #return self.ax
+ return ax
+
### End of Basemap class
def _searchlist(a,x):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-06-24 05:53:01
|
Revision: 7235
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7235&view=rev
Author: leejjoon
Date: 2009-06-24 05:51:52 +0000 (Wed, 24 Jun 2009)
Log Message:
-----------
backend_agg.draw_marker quantizes the main path (checking in a missed file)
Modified Paths:
--------------
trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2009-06-24 05:49:37 UTC (rev 7234)
+++ trunk/matplotlib/src/_backend_agg.cpp 2009-06-24 05:51:52 UTC (rev 7235)
@@ -542,13 +542,17 @@
PathIterator marker_path(marker_path_obj);
transformed_path_t marker_path_transformed(marker_path, marker_trans);
quantize_t marker_path_quantized(marker_path_transformed,
- gc.quantize_mode,
+ gc.quantize_mode,
marker_path.total_vertices());
curve_t marker_path_curve(marker_path_quantized);
PathIterator path(path_obj);
transformed_path_t path_transformed(path, trans);
- path_transformed.rewind(0);
+ quantize_t path_quantized(path_transformed,
+ gc.quantize_mode,
+ path.total_vertices());
+ curve_t path_curve(path_quantized);
+ path_curve.rewind(0);
facepair_t face = _get_rgba_face(face_obj, gc.alpha);
@@ -597,7 +601,7 @@
agg::serialized_scanlines_adaptor_aa8::embedded_scanline sl;
if (has_clippath) {
- while (path_transformed.vertex(&x, &y) != agg::path_cmd_stop) {
+ while (path_curve.vertex(&x, &y) != agg::path_cmd_stop) {
if (MPL_notisfinite64(x) || MPL_notisfinite64(y)) {
continue;
}
@@ -618,7 +622,7 @@
agg::render_scanlines(sa, sl, ren);
}
} else {
- while (path_transformed.vertex(&x, &y) != agg::path_cmd_stop) {
+ while (path_curve.vertex(&x, &y) != agg::path_cmd_stop) {
if (MPL_notisfinite64(x) || MPL_notisfinite64(y)) {
continue;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-06-24 05:50:38
|
Revision: 7234
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7234&view=rev
Author: leejjoon
Date: 2009-06-24 05:49:37 +0000 (Wed, 24 Jun 2009)
Log Message:
-----------
backend_agg.draw_marker quantizes the main path
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-06-24 05:46:08 UTC (rev 7233)
+++ trunk/matplotlib/CHANGELOG 2009-06-24 05:49:37 UTC (rev 7234)
@@ -1,3 +1,6 @@
+2009-06-24 backend_agg.draw_marker quantizes the main path (as in the
+ draw_path). - JJL
+
2009-06-24 axes_grid: floating axis support added. - JJL
2009-06-14 Add new command line options to backend_driver.py to support
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-06-24 05:47:10
|
Revision: 7233
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7233&view=rev
Author: leejjoon
Date: 2009-06-24 05:46:08 +0000 (Wed, 24 Jun 2009)
Log Message:
-----------
axes_grid: floating_axis support added
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/axes_grid/scatter_hist.py
trunk/matplotlib/examples/axes_grid/simple_axisline.py
trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_grid.py
trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_size.py
trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py
trunk/matplotlib/lib/mpl_toolkits/axes_grid/grid_finder.py
trunk/matplotlib/lib/mpl_toolkits/axes_grid/grid_helper_curvelinear.py
Added Paths:
-----------
trunk/matplotlib/examples/axes_grid/demo_floating_axis.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-06-23 12:47:49 UTC (rev 7232)
+++ trunk/matplotlib/CHANGELOG 2009-06-24 05:46:08 UTC (rev 7233)
@@ -1,3 +1,5 @@
+2009-06-24 axes_grid: floating axis support added. - JJL
+
2009-06-14 Add new command line options to backend_driver.py to support
running only some directories of tests - JKS
Added: trunk/matplotlib/examples/axes_grid/demo_floating_axis.py
===================================================================
--- trunk/matplotlib/examples/axes_grid/demo_floating_axis.py (rev 0)
+++ trunk/matplotlib/examples/axes_grid/demo_floating_axis.py 2009-06-24 05:46:08 UTC (rev 7233)
@@ -0,0 +1,77 @@
+"""
+A floating axes for curvelinear grid.
+.
+"""
+
+
+def curvelinear_test2(fig):
+ """
+ polar projection, but in a rectangular box.
+ """
+ import numpy as np
+ import mpl_toolkits.axes_grid.angle_helper as angle_helper
+ from matplotlib.projections import PolarAxes
+ from matplotlib.transforms import Affine2D
+
+ from mpl_toolkits.axes_grid.parasite_axes import SubplotHost
+
+ from mpl_toolkits.axes_grid.grid_helper_curvelinear import GridHelperCurveLinear
+
+ # see demo_curvelinear_grid.py for details
+ tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform()
+
+ 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)
+
+ tick_formatter1 = angle_helper.FormatterDMS()
+
+ grid_helper = GridHelperCurveLinear(tr,
+ extreme_finder=extreme_finder,
+ grid_locator1=grid_locator1,
+ tick_formatter1=tick_formatter1
+ )
+
+
+ ax1 = SubplotHost(fig, 1, 1, 1, grid_helper=grid_helper)
+
+ # make ticklabels of right and top axis visible.
+ for axis in ax1.axis.values():
+ axis.toggle(all=False)
+
+ fig.add_subplot(ax1)
+
+ # Now creates floating axis
+
+ grid_helper = ax1.get_grid_helper()
+ # floating axis whose first coordinate (theta) is fixed at 60
+ ax1.axis["lat"] = axis = grid_helper.new_floating_axis(0, 60, axes=ax1)
+ axis.label.set_text(r"$\theta = 60^{\circ}$")
+ axis.label.set_visible(True)
+
+ # floating axis whose second coordinate (r) is fixed at 6
+ ax1.axis["lon"] = axis = grid_helper.new_floating_axis(1, 6, axes=ax1)
+ axis.label.set_text(r"$r = 6$")
+
+ ax1.set_aspect(1.)
+ ax1.set_xlim(-5, 12)
+ ax1.set_ylim(-5, 10)
+
+ ax1.grid(True)
+
+if __name__ == "__main__":
+ import matplotlib.pyplot as plt
+ fig = plt.figure(1, figsize=(5, 5))
+ fig.clf()
+
+ curvelinear_test2(fig)
+
+ plt.draw()
+ plt.show()
+
+
Modified: trunk/matplotlib/examples/axes_grid/scatter_hist.py
===================================================================
--- trunk/matplotlib/examples/axes_grid/scatter_hist.py 2009-06-23 12:47:49 UTC (rev 7232)
+++ trunk/matplotlib/examples/axes_grid/scatter_hist.py 2009-06-24 05:46:08 UTC (rev 7233)
@@ -56,5 +56,5 @@
axHisty.set_xticks([0, 50, 100])
plt.draw()
-#plt.show()
-plt.savefig("a.pdf")
+plt.show()
+#plt.savefig("a.pdf")
Modified: trunk/matplotlib/examples/axes_grid/simple_axisline.py
===================================================================
--- trunk/matplotlib/examples/axes_grid/simple_axisline.py 2009-06-23 12:47:49 UTC (rev 7232)
+++ trunk/matplotlib/examples/axes_grid/simple_axisline.py 2009-06-24 05:46:08 UTC (rev 7233)
@@ -29,7 +29,8 @@
new_axisline = ax.get_grid_helper().new_fixed_axis
ax.axis["right2"] = new_axisline(loc="right",
- offset=offset)
+ offset=offset,
+ axes=ax)
ax.axis["right2"].label.set_text("Label Y2")
ax.plot([-2,3,2])
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_grid.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_grid.py 2009-06-23 12:47:49 UTC (rev 7232)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_grid.py 2009-06-24 05:46:08 UTC (rev 7233)
@@ -143,7 +143,7 @@
-class AxesGrid(object):
+class Grid(object):
"""
A class that creates a grid of Axes. In matplotlib, the axes
location (and size) is specified in the normalized figure
@@ -161,6 +161,269 @@
axes_pad = 0.02,
add_all=True,
share_all=False,
+ share_x=True,
+ share_y=True,
+ #aspect=True,
+ label_mode="L",
+ axes_class=None,
+ ):
+ """
+ Build an :class:`AxesGrid` instance with a grid nrows*ncols
+ :class:`~matplotlib.axes.Axes` in
+ :class:`~matplotlib.figure.Figure` *fig* with
+ *rect=[left, bottom, width, height]* (in
+ :class:`~matplotlib.figure.Figure` coordinates) or
+ the subplot position code (e.g., "121").
+
+ Optional keyword arguments:
+
+ ================ ======== =========================================
+ Keyword Default Description
+ ================ ======== =========================================
+ direction "row" [ "row" | "column" ]
+ axes_pad 0.02 float| pad betweein axes given in inches
+ add_all True [ True | False ]
+ share_all False [ True | False ]
+ aspect True [ True | False ]
+ label_mode "L" [ "L" | "1" | "all" ]
+ axes_class None a type object which must be a subclass
+ of :class:`~matplotlib.axes.Axes`
+ ================ ======== =========================================
+ """
+ self._nrows, self._ncols = nrows_ncols
+
+ if ngrids is None:
+ ngrids = self._nrows * self._ncols
+ else:
+ if (ngrids > self._nrows * self._ncols) or (ngrids <= 0):
+ raise Exception("")
+
+ self.ngrids = ngrids
+
+ self._init_axes_pad(axes_pad)
+
+ if direction not in ["column", "row"]:
+ raise Exception("")
+
+ self._direction = direction
+
+
+ if axes_class is None:
+ axes_class = LocatableAxes
+ axes_class_args = {}
+ else:
+ if isinstance(axes_class, maxes.Axes):
+ axes_class_args = {}
+ else:
+ axes_class, axes_class_args = axes_class
+
+ self.axes_all = []
+ self.axes_column = [[] for i in range(self._ncols)]
+ self.axes_row = [[] for i in range(self._nrows)]
+
+
+ h = []
+ v = []
+ if cbook.is_string_like(rect) or cbook.is_numlike(rect):
+ self._divider = SubplotDivider(fig, rect, horizontal=h, vertical=v,
+ aspect=False)
+ elif len(rect) == 3:
+ kw = dict(horizontal=h, vertical=v, aspect=False)
+ self._divider = SubplotDivider(fig, *rect, **kw)
+ elif len(rect) == 4:
+ self._divider = Divider(fig, rect, horizontal=h, vertical=v,
+ aspect=False)
+ else:
+ raise Exception("")
+
+
+ rect = self._divider.get_position()
+
+ # reference axes
+ self._column_refax = [None for i in range(self._ncols)]
+ self._row_refax = [None for i in range(self._nrows)]
+ self._refax = None
+
+ for i in range(self.ngrids):
+
+ col, row = self._get_col_row(i)
+
+ if share_all:
+ sharex = self._refax
+ sharey = self._refax
+ else:
+ if share_x:
+ sharex = self._column_refax[col]
+ else:
+ sharex = None
+
+ if share_y:
+ sharey = self._row_refax[row]
+ else:
+ sharey = None
+
+ ax = axes_class(fig, rect, sharex=sharex, sharey=sharey,
+ **axes_class_args)
+
+ if share_all:
+ if self._refax is None:
+ self._refax = ax
+ else:
+ if sharex is None:
+ self._column_refax[col] = ax
+ if sharey is None:
+ self._row_refax[row] = ax
+
+ self.axes_all.append(ax)
+ self.axes_column[col].append(ax)
+ self.axes_row[row].append(ax)
+
+ self.axes_llc = self.axes_column[0][-1]
+
+ self._update_locators()
+
+ if add_all:
+ for ax in self.axes_all:
+ fig.add_axes(ax)
+
+ self.set_label_mode(label_mode)
+
+
+ def _init_axes_pad(self, axes_pad):
+ self._axes_pad = axes_pad
+
+ self._horiz_pad_size = Size.Fixed(axes_pad)
+ self._vert_pad_size = Size.Fixed(axes_pad)
+
+
+ def _update_locators(self):
+
+ h = []
+
+ h_ax_pos = []
+ h_cb_pos = []
+
+ for ax in self._column_refax:
+ #if h: h.append(Size.Fixed(self._axes_pad))
+ if h: h.append(self._horiz_pad_size)
+
+ h_ax_pos.append(len(h))
+
+ sz = Size.Scaled(1)
+ h.append(sz)
+
+ v = []
+
+ v_ax_pos = []
+ v_cb_pos = []
+ for ax in self._row_refax[::-1]:
+ #if v: v.append(Size.Fixed(self._axes_pad))
+ if v: v.append(self._vert_pad_size)
+
+ v_ax_pos.append(len(v))
+ sz = Size.Scaled(1)
+ v.append(sz)
+
+
+ for i in range(self.ngrids):
+ col, row = self._get_col_row(i)
+ locator = self._divider.new_locator(nx=h_ax_pos[col],
+ ny=v_ax_pos[self._nrows -1 - row])
+ self.axes_all[i].set_axes_locator(locator)
+
+ self._divider.set_horizontal(h)
+ self._divider.set_vertical(v)
+
+
+
+ def _get_col_row(self, n):
+ if self._direction == "column":
+ col, row = divmod(n, self._nrows)
+ else:
+ row, col = divmod(n, self._ncols)
+
+ return col, row
+
+
+ def __getitem__(self, i):
+ return self.axes_all[i]
+
+
+ def get_geometry(self):
+ """
+ get geometry of the grid. Returns a tuple of two integer,
+ representing number of rows and number of columns.
+ """
+ return self._nrows, self._ncols
+
+ def set_axes_pad(self, axes_pad):
+ "set axes_pad"
+ self._axes_pad = axes_pad
+
+ self._horiz_pad_size.fixed_size = axes_pad
+ self._vert_pad_size.fixed_size = axes_pad
+
+
+ def get_axes_pad(self):
+ "get axes_pad"
+ return self._axes_pad
+
+ def set_aspect(self, aspect):
+ "set aspect"
+ self._divider.set_aspect(aspect)
+
+ def get_aspect(self):
+ "get aspect"
+ return self._divider.get_aspect()
+
+ def set_label_mode(self, mode):
+ "set label_mode"
+ if mode == "all":
+ for ax in self.axes_all:
+ _tick_only(ax, False, False)
+ elif mode == "L":
+ # left-most axes
+ for ax in self.axes_column[0][:-1]:
+ _tick_only(ax, bottom_on=True, left_on=False)
+ # lower-left axes
+ ax = self.axes_column[0][-1]
+ _tick_only(ax, bottom_on=False, left_on=False)
+
+ for col in self.axes_column[1:]:
+ # axes with no labels
+ for ax in col[:-1]:
+ _tick_only(ax, bottom_on=True, left_on=True)
+
+ # bottom
+ ax = col[-1]
+ _tick_only(ax, bottom_on=False, left_on=True)
+
+ elif mode == "1":
+ for ax in self.axes_all:
+ _tick_only(ax, bottom_on=True, left_on=True)
+
+ ax = self.axes_llc
+ _tick_only(ax, bottom_on=False, left_on=False)
+
+
+class AxesGrid(Grid):
+ """
+ A class that creates a grid of Axes. In matplotlib, the axes
+ location (and size) is specified in the normalized figure
+ coordinates. This may not be ideal for images that needs to be
+ displayed with a given aspect ratio. For example, displaying
+ images of a same size with some fixed padding between them cannot
+ be easily done in matplotlib. AxesGrid is used in such case.
+ """
+
+ def __init__(self, fig,
+ rect,
+ nrows_ncols,
+ ngrids = None,
+ direction="row",
+ axes_pad = 0.02,
+ add_all=True,
+ share_all=False,
aspect=True,
label_mode="L",
cbar_mode=None,
@@ -217,6 +480,8 @@
self._colorbar_size = cbar_size
+ self._init_axes_pad(axes_pad)
+
if direction not in ["column", "row"]:
raise Exception("")
@@ -312,7 +577,7 @@
h_ax_pos = []
h_cb_pos = []
for ax in self._column_refax:
- if h: h.append(Size.Fixed(self._axes_pad))
+ if h: h.append(self._horiz_pad_size) #Size.Fixed(self._axes_pad))
h_ax_pos.append(len(h))
@@ -333,7 +598,8 @@
v_ax_pos = []
v_cb_pos = []
for ax in self._row_refax[::-1]:
- if v: v.append(Size.Fixed(self._axes_pad))
+ if v: v.append(self._horiz_pad_size) #Size.Fixed(self._axes_pad))
+
v_ax_pos.append(len(v))
if ax:
sz = Size.AxesY(ax)
@@ -396,75 +662,27 @@
- def _get_col_row(self, n):
- if self._direction == "column":
- col, row = divmod(n, self._nrows)
- else:
- row, col = divmod(n, self._ncols)
- return col, row
+#if __name__ == "__main__":
+if 0:
+ F = plt.figure(1, (7, 6))
+ F.clf()
- def __getitem__(self, i):
- return self.axes_all[i]
+ F.subplots_adjust(left=0.15, right=0.9)
+ grid = Grid(F, 111, # similar to subplot(111)
+ nrows_ncols = (2, 2),
+ direction="row",
+ axes_pad = 0.05,
+ add_all=True,
+ label_mode = "1",
+ )
- def get_geometry(self):
- """
- get geometry of the grid. Returns a tuple of two integer,
- representing number of rows and number of columns.
- """
- return self._nrows, self._ncols
- def set_axes_pad(self, axes_pad):
- "set axes_pad"
- self._axes_pad = axes_pad
- def get_axes_pad(self):
- "get axes_pad"
- return self._axes_pad
-
- def set_aspect(self, aspect):
- "set aspect"
- self._divider.set_aspect(aspect)
-
- def get_aspect(self):
- "get aspect"
- return self._divider.get_aspect()
-
- def set_label_mode(self, mode):
- "set label_mode"
- if mode == "all":
- for ax in self.axes_all:
- _tick_only(ax, False, False)
- elif mode == "L":
- # left-most axes
- for ax in self.axes_column[0][:-1]:
- _tick_only(ax, bottom_on=True, left_on=False)
- # lower-left axes
- ax = self.axes_column[0][-1]
- _tick_only(ax, bottom_on=False, left_on=False)
-
- for col in self.axes_column[1:]:
- # axes with no labels
- for ax in col[:-1]:
- _tick_only(ax, bottom_on=True, left_on=True)
-
- # bottom
- ax = col[-1]
- _tick_only(ax, bottom_on=False, left_on=True)
-
- elif mode == "1":
- for ax in self.axes_all:
- _tick_only(ax, bottom_on=True, left_on=True)
-
- ax = self.axes_llc
- _tick_only(ax, bottom_on=False, left_on=False)
-
-
-
-
if __name__ == "__main__":
+#if 0:
from axes_divider import get_demo_image
F = plt.figure(1, (9, 3.5))
F.clf()
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_size.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_size.py 2009-06-23 12:47:49 UTC (rev 7232)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_size.py 2009-06-24 05:46:08 UTC (rev 7233)
@@ -21,13 +21,14 @@
class Fixed(_Base):
"Simple fixed size with absolute part = *fixed_size* and relative part = 0"
def __init__(self, fixed_size):
- self._fixed_size = fixed_size
+ self.fixed_size = fixed_size
def get_size(self, renderer):
rel_size = 0.
- abs_size = self._fixed_size
+ abs_size = self.fixed_size
return rel_size, abs_size
+
class Scaled(_Base):
"Simple scaled(?) size with absolute part = 0 and relative part = *scalable_size*"
def __init__(self, scalable_size):
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py 2009-06-23 12:47:49 UTC (rev 7232)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py 2009-06-24 05:46:08 UTC (rev 7233)
@@ -54,6 +54,9 @@
from matplotlib.collections import LineCollection
from matplotlib import rcParams
+
+from matplotlib.artist import allow_rasterization
+
import warnings
import numpy as np
@@ -127,7 +130,7 @@
will be axes attribute of the caller artist.
- # LINE
+ # LINE (spinal line?)
def get_line(self, axes):
# path : Path
@@ -168,24 +171,27 @@
"""
+
class _Base(object):
-
+ """
+ Base class for axis helper.
+ """
def __init__(self, label_direction):
+ """
+ label direction must be one of
+ ["left", "right", "bottom", "top",
+ "curved"]
+ """
self.label_direction = label_direction
- #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_offset_transform(self, pad_points, fontprops, renderer,
- bboxes=None,
- #trans=None
- ):
+ def _get_label_offset_transform(self, pad_points, fontprops,
+ renderer, bboxes=None):
"""
Returns (offset-transform, vertical-alignment, horiz-alignment)
@@ -200,6 +206,7 @@
fontprops : font properties for label
renderer : renderer
bboxes=None : list of bboxes (window extents) of the tick labels.
+ This only make sense for axis label.
all the above parameters are used to estimate the offset.
@@ -223,44 +230,44 @@
tr = Affine2D()
if self.label_direction == "left":
tr.translate(-(pad_pixels+w), 0.)
- #trans = trans + tr
return tr, "center", "right"
elif self.label_direction == "right":
tr.translate(+(pad_pixels+w), 0.)
- #trans = trans + tr
return tr, "center", "left"
elif self.label_direction == "bottom":
tr.translate(0, -(pad_pixels+font_size_pixels+h))
- #trans = trans + tr
return tr, "baseline", "center"
elif self.label_direction == "top":
tr.translate(0, +(pad_pixels+h))
- #trans = trans + tr
return tr, "baseline", "center"
+ elif self.label_direction == "curved":
+ #tr.translate(0, +(pad_pixels+h))
+
+ return tr, "baseline", "center"
+
else:
- raise ValueError("")
+ raise ValueError("Unknown label direction : %s" \
+ % (self.label_direction,))
- def get_label_offset_transform(self,
- axes,
+ def get_label_offset_transform(self, axes,
pad_points, fontprops, renderer,
bboxes,
- #trans=None
):
+ """
+ offset transform for axis label.
+ """
- tr, va, ha = self._get_label_offset_transform(pad_points, fontprops,
- renderer,
- bboxes,
- #trans
- )
+ tr, va, ha = self._get_label_offset_transform( \
+ pad_points, fontprops, renderer, bboxes)
a = self._label_angles[self.label_direction]
return tr, va, ha, a
@@ -270,11 +277,12 @@
pad_points, fontprops,
renderer,
):
+ """
+ offset transform for ticklabels.
+ """
- tr, va, ha = self._get_label_offset_transform(pad_points, fontprops,
- renderer,
- None,
- )
+ 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
@@ -282,6 +290,9 @@
class Fixed(_Base):
+ """
+ Helper class for a fixed (in the axes coordinate) axis.
+ """
_default_passthru_pt = dict(left=(0, 0),
right=(1, 0),
@@ -289,8 +300,8 @@
top=(0, 1))
def __init__(self,
- loc, nth_coord=None,
- passingthrough_point=None, label_direction=None):
+ loc,
+ label_direction=None):
"""
nth_coord = along which coordinate value varies
in 2d, nth_coord = 0 -> x axis, nth_coord = 1 -> y axis
@@ -298,23 +309,21 @@
if loc not in ["left", "right", "bottom", "top"]:
raise ValueError("%s" % loc)
- if nth_coord is None:
- if loc in ["left", "right"]:
- nth_coord = 1
- elif loc in ["bottom", "top"]:
- nth_coord = 0
+ #if nth_coord is None:
+ if loc in ["left", "right"]:
+ nth_coord = 1
+ elif loc in ["bottom", "top"]:
+ nth_coord = 0
self.nth_coord = nth_coord
super(AxisArtistHelper.Fixed, self).__init__(loc)
- if passingthrough_point is None:
- passingthrough_point = self._default_passthru_pt[loc]
+ self.passthru_pt = self._default_passthru_pt[loc]
if label_direction is None:
label_direction = loc
- self.passthru_pt = passingthrough_point
_verts = np.array([[0., 0.],
[1., 1.]])
@@ -336,7 +345,7 @@
def get_line_transform(self, axes):
return axes.transAxes
- # LABLE
+ # LABEL
def get_label_pos(self, axes):
"""
@@ -358,11 +367,9 @@
tr, va, ha = self._get_label_offset_transform( \
pad_points, fontprops, renderer, bboxes,
- #trans
)
a = self._label_angles[self.label_direction]
- #tr = axes.transAxes + tr
return tr, va, ha, a
@@ -380,14 +387,12 @@
class Floating(_Base):
def __init__(self, nth_coord,
- passingthrough_point, label_direction, transform):
+ value, label_direction):
self.nth_coord = nth_coord
- self.passingthrough_point = passingthrough_point
+ self._value = value
- self.transform = transform
-
super(AxisArtistHelper.Floating,
self).__init__(label_direction)
@@ -396,72 +401,25 @@
return self.nth_coord
def get_line(self, axes):
- _verts = np.array([[0., 0.],
- [1., 1.]])
+ raise RuntimeError("get_line method should be defined by the derived class")
- fixed_coord = 1-self.nth_coord
- 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, axes):
- _verts = [0.5, 0.5]
-
- fixed_coord = 1-self.nth_coord
- 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, 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
- )
-
- 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
-
-
-
-
-
class AxisArtistHelperRectlinear:
class Fixed(AxisArtistHelper.Fixed):
def __init__(self,
- axes, loc, nth_coord=None,
- passingthrough_point=None, label_direction=None):
+ axes, loc, #nth_coord=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)
+ loc, label_direction)
self.axis = [axes.xaxis, axes.yaxis][self.nth_coord]
@@ -498,7 +456,7 @@
# check if the tick point is inside axes
c2 = tr2ax.transform_point(c)
- delta=0.001
+ delta=0.00001
if 0. -delta<= c2[self.nth_coord] <= 1.+delta:
yield c, angle, l
@@ -508,14 +466,60 @@
class Floating(AxisArtistHelper.Floating):
def __init__(self, axes, nth_coord,
- passingthrough_point, label_direction, transform):
+ passingthrough_point, label_direction):
super(AxisArtistHelperRectlinear.Floating, self).__init__( \
- nth_coord, passingthrough_point, label_direction, transform)
+ nth_coord, passingthrough_point, label_direction)
self.axis = [axes.xaxis, axes.yaxis][self.nth_coord]
+ def get_line(self, axes):
+ _verts = np.array([[0., 0.],
+ [1., 1.]])
+
+ fixed_coord = 1-self.nth_coord
+ trans_passingthrough_point = axes.transData + axes.transAxes.inverted()
+ p = trans_passingthrough_point.transform_point([self._value,
+ self._value])
+ _verts[:,fixed_coord] = p[fixed_coord]
+
+ return Path(_verts)
+
+ def get_line_transform(self, axes):
+ return axes.transAxes
+
+ def get_label_pos(self, axes):
+ _verts = [0.5, 0.5]
+
+ fixed_coord = 1-self.nth_coord
+ trans_passingthrough_point = axes.transData + axes.transAxes.inverted()
+ p = trans_passingthrough_point.transform_point([self._value,
+ self._value])
+ _verts[fixed_coord] = p[fixed_coord]
+ if not (0. <= _verts[fixed_coord] <= 1.):
+ return None, None
+ else:
+ 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)
+
+ a = self._label_angles[self.label_direction]
+ tr = axes.transAxes + tr
+
+ return tr, va, ha, a
+
+
+ def get_tick_transform(self, axes):
+ return axes.transData
+
+
def get_tick_iterators(self, axes):
"""tick_loc, tick_angle, tick_label"""
@@ -531,12 +535,12 @@
minor.formatter.set_locs(minorLocs)
minorLabels = [minor.formatter(val, i) for i, val in enumerate(minorLocs)]
- tr2ax = self.transform + axes.transAxes.inverted()
+ tr2ax = axes.transData + axes.transAxes.inverted()
def _f(locs, labels):
for x, l in zip(locs, labels):
- c = list(self.passingthrough_point) # copy
+ c = [self._value, self._value]
c[self.nth_coord] = x
c1, c2 = tr2ax.transform_point(c)
if 0. <= c1 <= 1. and 0. <= c2 <= 1.:
@@ -573,7 +577,10 @@
def invalidate(self):
self._force_update = True
+ def valid(self):
+ return not self._force_update
+
def get_gridlines(self):
return []
@@ -587,26 +594,10 @@
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 AxisArtistHelper.Fixed(self.axes, loc,
- nth_coord, passingthrough_point)
- else:
- label_direction = loc
- return AxisArtistHelper.Floating(self.axes,
- nth_coord, passingthrough_point,
- label_direction,
- transform)
-
-
def new_fixed_axis(self, loc,
- nth_coord=None, passthrough_point=None,
- #transform=None,
+ nth_coord=None,
tick_direction="in",
label_direction=None,
offset=None,
@@ -617,65 +608,38 @@
warnings.warn("'new_fixed_axis' explicitly requires the axes keyword.")
axes = self.axes
- _helper = AxisArtistHelperRectlinear.Fixed(axes, loc,
- nth_coord,
- passthrough_point)
+ _helper = AxisArtistHelperRectlinear.Fixed(axes, loc, nth_coord)
- axisline = AxisArtist(axes, _helper,
- #tick_direction="in",
- offset=offset,
- )
+ axisline = AxisArtist(axes, _helper, offset=offset)
return axisline
- def new_floating_axis(self, nth_coord=None, passthrough_point=None,
- transform=None,
+ def new_floating_axis(self, nth_coord, value,
tick_direction="in",
label_direction=None,
- axes=None,
- ):
+ axes=None,
+ ):
if axes is None:
warnings.warn("'new_floating_axis' explicitly requires the axes keyword.")
axes = self.axes
+ passthrough_point = (value, value)
+ transform = axes.transData
+
_helper = AxisArtistHelperRectlinear.Floating( \
- axes,
- nth_coord, passthrough_point,
- label_direction,
- transform)
+ axes, nth_coord, value, label_direction)
- axisline = AxisArtist(axes, _helper,
- #tick_direction="in",
- )
+ axisline = AxisArtist(axes, _helper)
+ axisline.line.set_clip_on(True)
+ axisline.line.set_clip_box(axisline.axes.bbox)
return axisline
- def new_axisline_deprecated(self, loc,
- nth_coord=None, passthrough_point=None,
- transform=None,
- tick_direction="in",
- label_direction=None,
- offset=None):
- warnings.warn("new_axisline is deprecated. Use new_fixed_axis "
- "or new_floating_axis instead")
- _helper = self._get_axisline_helper(nth_coord, loc,
- passthrough_point,
- transform)
-
- axisline = AxisArtist(self.axes, _helper,
- #tick_direction="in",
- offset=offset,
- )
-
- return axisline
-
-
-
from matplotlib.lines import Line2D
class Ticks(Line2D):
@@ -691,6 +655,7 @@
kwargs["markeredgewidth"] = "auto"
super(Ticks, self).__init__([0.], [0.], **kwargs)
+ self.set_snap(True)
def get_color(self):
@@ -724,8 +689,8 @@
return self._markeredgewidth
- def update_locs_angles(self, locs_angles, renderer):
- self.locs_angles = locs_angles
+ def update_ticks(self, locs_angles_labels, renderer):
+ self.locs_angles_labels = locs_angles_labels
_tickvert_path = Path([[0., 0.], [0., 1.]])
@@ -763,12 +728,12 @@
offset = renderer.points_to_pixels(size)
marker_scale = Affine2D().scale(offset, offset)
- for loc, angle in self.locs_angles:
+ for loc, angle, _ in self.locs_angles_labels:
marker_rotation = Affine2D().rotate_deg(angle)
#marker_rotation.clear().rotate_deg(angle)
marker_transform = marker_scale + marker_rotation
- locs = path_trans.transform_non_affine(np.array([loc]))
+ locs = path_trans.transform_non_affine(np.array([loc, loc]))
renderer.draw_markers(gc, self._tickvert_path, marker_transform,
Path(locs), path_trans.get_affine())
@@ -780,7 +745,7 @@
class TickLabels(mtext.Text):
def __init__(self, size, **kwargs):
- self._locs_labels = []
+ self.locs_angles_labels = []
self._axis = kwargs.pop("axis", None)
if self._axis is not None:
@@ -790,10 +755,17 @@
super(TickLabels, self).__init__(x=0., y=0., text="",
**kwargs
)
+ self._rotate_ticklabel = None
- def update_locs_labels(self, locs_labels, renderer):
- self._locs_labels = locs_labels
+ def set_rotate_along_line(self, b):
+ self._rotate_ticklabel = b
+ def get_rotate_along_line(self):
+ return self._rotate_ticklabel
+
+ def update_ticks(self, locs_angles_labels, renderer):
+ self.locs_angles_labels = locs_angles_labels
+
def get_color(self):
if self._color == 'auto':
if self._axis is not None:
@@ -809,15 +781,45 @@
def draw(self, renderer):
if not self.get_visible(): return
- for (x, y), l in self._locs_labels:
- self.set_x(x)
- self.set_y(y)
- self.set_text(l)
- super(TickLabels, self).draw(renderer)
+ if self.get_rotate_along_line():
+ # curved axis
+ # save original and adjust some properties
+ tr = self.get_transform()
+ rm = self.get_rotation_mode()
+
+ self.set_rotation_mode("anchor")
+ offset_tr = Affine2D()
+ self.set_transform(tr+offset_tr)
+
+ # estimate pad
+ dd = 5 + renderer.points_to_pixels(self.get_size())
+
+ for (x, y), a, l in self.locs_angles_labels:
+ theta = (a+90.)/180.*np.pi
+ dx, dy = dd * np.cos(theta), dd * np.sin(theta)
+ offset_tr.translate(dx, dy)
+ self.set_rotation(a-180)
+ self.set_x(x)
+ self.set_y(y)
+ self.set_text(l)
+ super(TickLabels, self).draw(renderer)
+ offset_tr.clear()
+
+ # restore original properties
+ self.set_transform(tr)
+ self.set_rotation_mode(rm)
+ else:
+ for (x, y), a, l in self.locs_angles_labels:
+ self.set_x(x)
+ self.set_y(y)
+ self.set_text(l)
+ super(TickLabels, self).draw(renderer)
+
+
def get_window_extents(self, renderer):
bboxes = []
- for (x, y), l in self._locs_labels:
+ for (x, y), a, l in self.locs_angles_labels:
self.set_x(x)
self.set_y(y)
self.set_text(l)
@@ -825,15 +827,10 @@
bboxes.append(self.get_window_extent())
return [b for b in bboxes if b.width!=0 or b.height!=0]
- #if bboxes:
- # return Bbox.union([b for b in bboxes if b.width!=0 or b.height!=0])
- #else:
- # return Bbox.from_bounds(0, 0, 0, 0)
-
class AxisLabel(mtext.Text):
def __init__(self, *kl, **kwargs):
self._axis = kwargs.pop("axis", None)
@@ -872,7 +869,6 @@
def draw(self, renderer):
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])
@@ -882,12 +878,8 @@
-class AxisGridLineBase(martist.Artist):
- def __init__(self, *kl, **kw):
- super(AxisGridLineBase, self).__init__(*kl, **kw)
-
-class AxisArtist(AxisGridLineBase):
+class AxisArtist(martist.Artist):
"""
an artist which draws axis (a line along which the n-th axes coord
is constant) line, ticks, ticklabels, and axis label.
@@ -900,7 +892,6 @@
def __init__(self, axes,
helper,
- #offset_transform=None,
offset=None,
major_tick_size=None,
major_tick_pad=None,
@@ -910,7 +901,7 @@
"""
axes is also used to follow the axis attribute (tick color, etc).
"""
- AxisGridLineBase.__init__(self, **kw)
+ super(AxisArtist, self).__init__(**kw)
self.axes = axes
@@ -922,9 +913,6 @@
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
@@ -956,6 +944,14 @@
self.set_zorder(self.ZORDER)
+ self._rotate_label_along_line = False
+
+ def set_rotate_label_along_line(self, b):
+ self._rotate_label_along_line = b
+
+ def get_rotate_label_along_line(self):
+ return self._rotate_label_along_line
+
def get_transform(self):
return self.axes.transAxes + self.offset_transform
@@ -992,14 +988,10 @@
size = rcParams['xtick.labelsize']
fontprops = font_manager.FontProperties(size=size)
- #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)
+ self.axes, self.major_tick_pad,
+ fontprops=fontprops, renderer=None)
+
trans, vert, horiz, label_a = tvhl
trans = transform + trans
@@ -1031,9 +1023,6 @@
x,y,va,ha = self._offsetText_pos[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("",
xy=(x,y), xycoords="axes fraction",
xytext=(0,0), textcoords="offset points",
@@ -1059,20 +1048,12 @@
def _draw_ticks(self, renderer):
- #majortick_iter, minortick_iter):
- #major_locs, major_angles,
- #minor_locs, minor_angles):
majortick_iter, minortick_iter = \
self._axis_artist_helper.get_tick_iterators(self.axes)
- 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))
+ tick_loc_angle_label = list(majortick_iter)
-
transform=self._axis_artist_helper.get_tick_transform(self.axes) \
+ self.offset_transform
fontprops = font_manager.FontProperties(size=12)
@@ -1082,7 +1063,7 @@
fontprops=fontprops,
renderer=renderer,
)
- #trans=transform)
+
trans, va, ha, a = tvhl
trans = transform + trans
@@ -1090,20 +1071,16 @@
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.update_ticks(tick_loc_angle_label, renderer)
+ self.major_ticklabels.update_ticks(tick_loc_angle_label, 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))
+ tick_loc_angle_label = list(minortick_iter)
- self.minor_ticks.update_locs_angles(tick_loc_angles, renderer)
- self.minor_ticklabels.update_locs_labels(tick_loc_labels, renderer)
+ self.minor_ticks.update_ticks(tick_loc_angle_label, renderer)
+ self.minor_ticklabels.update_ticks(tick_loc_angle_label, renderer)
self.minor_ticks.draw(renderer)
self.minor_ticklabels.draw(renderer)
@@ -1113,9 +1090,11 @@
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'],
@@ -1129,7 +1108,6 @@
self.label.set_figure(self.axes.figure)
- #self._set_artist_props(label)
def _draw_label(self, renderer, bboxes):
@@ -1137,31 +1115,50 @@
return
fontprops = font_manager.FontProperties(size=rcParams['axes.labelsize'])
- pad_points = self.LABELPAD + self.major_tick_pad
- xy, tr = self._axis_artist_helper.get_label_pos(self.axes)
- if xy is None: return
- x, y = xy
- 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
+ pad_points = self.major_tick_pad
- self.label.set(x=x, y=y,
- transform=tr2,
- va=va, ha=ha, rotation=a)
+ if self.get_rotate_label_along_line():
+ xy, tr, label_a = self._axis_artist_helper.get_label_pos( \
+ self.axes, with_angle=True)
+ if xy is None: return
-# if self.label.get_text() == "__from_axes__":
-# label_text = self._helper.axis.get_label().get_text()
-# self.label.set_text(label_text)
-# self.label.draw(renderer)
-# self.label.set_text("__from_axes__")
-# else:
+ x, y = xy
+ offset_tr = Affine2D()
+ if self.major_ticklabels.get_visible():
+ dd = renderer.points_to_pixels(self.major_ticklabels.get_size() \
+ + pad_points + 2*self.LABELPAD )
+ else:
+ dd = renderer.points_to_pixels(pad_points + 2*self.LABELPAD)
+
+ theta = label_a - 0.5 * np.pi #(label_a)/180.*np.pi
+ dx, dy = dd * np.cos(theta), dd * np.sin(theta)
+ offset_tr.translate(dx, dy)
+ tr2 = (tr+offset_tr) #+ tr2
+
+ self.label.set(x=x, y=y,
+ rotation_mode="anchor",
+ transform=tr2,
+ va="center", ha="center",
+ rotation=label_a/np.pi*180.)
+ else:
+ xy, tr = self._axis_artist_helper.get_label_pos(self.axes)
+ if xy is None: return
+
+ x, y = xy
+ tr2, va, ha, a = self._axis_artist_helper.get_label_offset_transform(\
+ self.axes,
+ pad_points+2*self.LABELPAD, fontprops,
+ renderer,
+ bboxes=bboxes,
+ )
+ tr2 = (tr+self.offset_transform) + tr2
+
+ self.label.set(x=x, y=y,
+ transform=tr2,
+ va=va, ha=ha, rotation=a)
+
self.label.draw(renderer)
@@ -1169,6 +1166,7 @@
self.label.set_text(s)
+ @allow_rasterization
def draw(self, renderer):
'Draw the axis lines, tick lines and labels'
@@ -1239,8 +1237,6 @@
else:
self._grid_helper = GridHelperRectlinear(self)
- #if self._grid_helper.axes is None:
- # self._grid_helper.set_axes(self)
self._axisline_on = True
super(Axes, self).__init__(*kl, **kw)
@@ -1269,7 +1265,7 @@
super(Axes, self)._init_axis()
- def _init_axislines(self):
+ def _init_axis_artists(self):
self._axislines = self.AxisDict(self)
new_fixed_axis = self.get_grid_helper().new_fixed_axis
for loc in ["bottom", "top", "left", "right"]:
@@ -1285,7 +1281,7 @@
axis = property(_get_axislines)
- def new_gridlines(self, grid_helper=None):
+ def _init_gridlines(self, grid_helper=None):
gridlines = GridlinesCollection(None, transform=self.transData,
colors=rcParams['grid.color'],
linestyles=rcParams['grid.linestyle'],
@@ -1296,14 +1292,14 @@
gridlines.set_grid_helper(grid_helper)
gridlines.set_clip_on(True)
- return gridlines
+ self.gridlines = gridlines
def cla(self):
# gridlines need to b created before cla() since cla calls grid()
- self.gridlines = self.new_gridlines()
+ self._init_gridlines()
super(Axes, self).cla()
- self._init_axislines()
+ self._init_axis_artists()
def get_grid_helper(self):
return self._grid_helper
@@ -1322,9 +1318,6 @@
if len(kwargs):
martist.setp(self.gridlines, **kwargs)
- #def get_gridlines(self):
- # return self._grid_helper.get_gridlines()
-
def get_children(self):
if self._axisline_on:
children = self._axislines.values()+[self.gridlines]
@@ -1334,10 +1327,22 @@
return children
def invalidate_grid_helper(self):
- #self._grid_helper.update_lim(self, force_update=True)
self._grid_helper.invalidate()
+ def new_floating_axis(self, nth_coord, value,
+ tick_direction="in",
+ label_direction=None,
+ ):
+ gh = self.get_grid_helper()
+ axis = gh.new_floating_axis(nth_coord, value,
+ tick_direction=tick_direction,
+ label_direction=label_direction,
+ axes=self)
+ return axis
+
+
+
def draw(self, renderer, inframe=False):
if not self._axisline_on:
@@ -1359,8 +1364,6 @@
if not self._axisline_on:
return bb0
-
- #artists = []
bb = [bb0]
for axisline in self._axislines.values():
@@ -1397,13 +1400,12 @@
super(AxesZero, self).__init__(*kl, **kw)
- def _init_axislines(self):
- super(AxesZero, self)._init_axislines()
+ def _init_axis_artists(self):
+ super(AxesZero, self)._init_axis_artists()
new_floating_axis = self._grid_helper.new_floating_axis
xaxis_zero = new_floating_axis(nth_coord=0,
- passthrough_point=(0.,0.),
- transform=self.transData,
+ value=0.,
tick_direction="in",
label_direction="bottom",
axes=self)
@@ -1413,8 +1415,7 @@
self._axislines["xzero"] = xaxis_zero
yaxis_zero = new_floating_axis(nth_coord=1,
- passthrough_point=(0.,0.),
- transform=self.transData,
+ value=0.,
tick_direction="in",
label_direction="left",
axes=self)
@@ -1428,6 +1429,8 @@
if __name__ == "__main__":
+ import matplotlib.pyplot as plt
+
fig = plt.figure(1, (4,3))
ax = SubplotZero(fig, 1, 1, 1)
@@ -1441,7 +1444,8 @@
xx = np.arange(0, 2*np.pi, 0.01)
ax.plot(xx, np.sin(xx))
-
+ ax.set_ylabel("Test")
+ plt.draw()
plt.show()
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/grid_finder.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/grid_finder.py 2009-06-23 12:47:49 UTC (rev 7232)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/grid_finder.py 2009-06-24 05:46:08 UTC (rev 7233)
@@ -5,6 +5,7 @@
clip_line_to_rect = clip_path.clip_line_to_rect
import matplotlib.ticker as mticker
+from matplotlib.transforms import Transform
# extremes finder
@@ -51,9 +52,11 @@
tick_formatter1=None,
tick_formatter2=None):
"""
- transform : transfrom from the image coordinate (which will be
the transData of the axes to the world coordinate.
locator1, locator2 : grid locator for 1st and 2nd axis.
+
+ Derived must define "transform_xy, inv_transform_xy"
+ (may use update_transform)
"""
super(GridFinderBase, self).__init__()
@@ -63,16 +66,14 @@
self.tick_formatter1 = tick_formatter1
self.tick_formatter2 = tick_formatter2
-
def get_grid_info(self,
- transform_xy, inv_transform_xy,
x1, y1, x2, y2):
"""
lon_values, lat_values : list of grid values. if integer is given,
rough number of grids in each direction.
"""
- extremes = self.extreme_finder(transform_xy, x1, y1, x2, y2)
+ extremes = self.extreme_finder(self.inv_transform_xy, x1, y1, x2, y2)
# min & max rage of lat (or lon) for each grid line will be drawn.
# i.e., gridline of lon=0 will be drawn from lat_min to lat_max.
@@ -93,8 +94,7 @@
lat_values = np.asarray(lat_levs[:lat_n]/lat_factor)
- lon_lines, lat_lines = self._get_raw_grid_lines(inv_transform_xy,
- lon_values,
+ lon_lines, lat_lines = self._get_raw_grid_lines(lon_values,
lat_values,
lon_min, lon_max,
lat_min, lat_max)
@@ -132,23 +132,21 @@
return grid_info
- def _get_raw_grid_lines(self, inv_transform_xy,
+ def _get_raw_grid_lines(self,
lon_values, lat_values,
lon_min, lon_max, lat_min, lat_max):
lons_i = np.linspace(lon_min, lon_max, 100) # for interpolation
lats_i = np.linspace(lat_min, lat_max, 100)
- lon_lines = [inv_transform_xy(np.zeros_like(lats_i)+lon, lats_i) \
+ lon_lines = [self.transform_xy(np.zeros_like(lats_i)+lon, lats_i) \
for lon in lon_values]
- lat_lines = [inv_transform_xy(lons_i, np.zeros_like(lons_i)+lat) \
+ lat_lines = [self.transform_xy(lons_i, np.zeros_like(lons_i)+lat) \
for lat in lat_values]
return lon_lines, lat_lines
-
-
def _clip_grid_lines_and_find_ticks(self, lines, values, levs, bb):
gi = dict()
gi["values"] = []
@@ -174,76 +172,45 @@
return gi
- def _update_label_deprecated(self):
- pass
+ def update_transform(self, aux_trans):
+ if isinstance(aux_trans, Transform):
+ def transform_xy(x, y):
+ x, y = np.asarray(x), np.asarray(y)
+ ll1 = np.concatenate((x[:,np.newaxis], y[:,np.newaxis]), 1)
+ ll2 = aux_trans.transform(ll1)
+ lon, lat = ll2[:,0], ll2[:,1]
+ return lon, lat
- def _find_grid_values_deprecated(self, x1, y1, x2, y2, den_x, den_y):
- """
- values_lon, values_lat : list of grid values. if integer is given,
- rough number of grids in each direction.
- """
- nx, ny = den_x * 20, den_y*20
+ def inv_transform_xy(x, y):
+ x, y = np.asarray(x), np.asarray(y)
+ ll1 = np.concatenate((x[:,np.newaxis], y[:,np.newaxis]), 1)
+ ll2 = aux_trans.inverted().transform(ll1)
+ lon, lat = ll2[:,0], ll2[:,1]
+ return lon, lat
- extremes = self.get_extremes(x1, y1, x2, y2, nx, ny)
- lon_min, lon_max, lat_min, lat_max = extremes
+ else:
+ transform_xy, inv_transform_xy = aux_trans
- lon_levs, lon_n, lon_factor = \
- self.grid_locator1(lon_min, lon_max)
- lat_levs, lat_n, lat_factor = \
- self.grid_locator2(lat_min, lat_max)
+ self.transform_xy = transform_xy
+ self.inv_transform_xy = inv_transform_xy
- return lon_levs, lon_n, lon_factor, lat_levs, lat_n, lat_factor
+ def update(self, **kw):
+ for k in kw:
+ if k in ["extreme_finder",
+ "grid_locator1",
+ "grid_locator2",
+ "tick_formatter1",
+ "tick_formatter2"]:
+ setattr(self, k, kw[k])
+ else:
+ raise ValueError("unknwonw update property")
-class GridFinder(GridFinderBase):
- def __init__(self,
- transform_xy, inv_transform_xy,
- extreme_finder=None,
- grid_locator1=None,
- grid_locator2=None,
- tick_formatter1=None,
- tick_formatter2=None):
- """
- transform : transfrom from the image coordinate (which will be
- the transData of the axes to the world coordinate.
- locator1, locator2 : grid locator for 1st and 2nd axis.
- """
- if extreme_finder is None:
- extreme_finder = ExtremeFinderSimple(20, 20)
- if grid_locator1 is None:
- grid_locator1 = MaxNLocator()
- if grid_locator2 is None:
- grid_locator2 = MaxNLocator()
- if tick_formatter1 is None:
- tick_formatter1 = FormatterPrettyPrint()
- if tick_formatter2 is None:
- tick_formatter2 = FormatterPrettyPrint()
+class GridFinder(GridFinderBase):
- super(GridFinder, self).__init__( \
- extreme_finder,
- grid_locator1,
- grid_locator2,
- tick_formatter1,
- tick_formatter2)
-
- self._transform_xy = transform_xy
- self._inv_transform_xy = inv_transform_xy
-
-
- def get_grid_info(self,
- x1, y1, x2, y2):
-
- return super(GridFinder,self).get_grid_info( \
- self._inv_transform_xy, self._transform_xy,
- x1, y1, x2, y2)
-
-
-
-class GridFinderMplTransform(GridFinderBase):
-
def __init__(self,
transform,
extreme_finder=None,
@@ -254,6 +221,9 @@
"""
transform : transfrom from the image coordinate (which will be
the transData of the axes to the world coordinate.
+
+ or transfor...
[truncated message content] |
|
From: <js...@us...> - 2009-06-23 13:15:40
|
Revision: 7231
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7231&view=rev
Author: jswhit
Date: 2009-06-23 12:39:21 +0000 (Tue, 23 Jun 2009)
Log Message:
-----------
change mlab.load to np.loadtxt
Modified Paths:
--------------
trunk/toolkits/basemap/examples/contour_demo.py
trunk/toolkits/basemap/examples/maskoceans.py
trunk/toolkits/basemap/examples/panelplot.py
trunk/toolkits/basemap/examples/plotmap.py
trunk/toolkits/basemap/examples/plotmap_masked.py
trunk/toolkits/basemap/examples/plotmap_shaded.py
trunk/toolkits/basemap/examples/polarmaps.py
trunk/toolkits/basemap/examples/simpletest.py
trunk/toolkits/basemap/examples/simpletest_oo.py
trunk/toolkits/basemap/examples/test.py
Modified: trunk/toolkits/basemap/examples/contour_demo.py
===================================================================
--- trunk/toolkits/basemap/examples/contour_demo.py 2009-06-21 18:53:49 UTC (rev 7230)
+++ trunk/toolkits/basemap/examples/contour_demo.py 2009-06-23 12:39:21 UTC (rev 7231)
@@ -1,14 +1,13 @@
from mpl_toolkits.basemap import Basemap, shiftgrid
import numpy as np
import matplotlib.pyplot as plt
-import matplotlib.mlab as mlab
# examples of filled contour plots on map projections.
# read in data on lat/lon grid.
-hgt = mlab.load('500hgtdata.gz')
-lons = mlab.load('500hgtlons.gz')
-lats = mlab.load('500hgtlats.gz')
+hgt = np.loadtxt('500hgtdata.gz')
+lons = np.loadtxt('500hgtlons.gz')
+lats = np.loadtxt('500hgtlats.gz')
# shift data so lons go from -180 to 180 instead of 0 to 360.
hgt,lons = shiftgrid(180.,hgt,lons,start=False)
lons, lats = np.meshgrid(lons, lats)
Modified: trunk/toolkits/basemap/examples/maskoceans.py
===================================================================
--- trunk/toolkits/basemap/examples/maskoceans.py 2009-06-21 18:53:49 UTC (rev 7230)
+++ trunk/toolkits/basemap/examples/maskoceans.py 2009-06-23 12:39:21 UTC (rev 7231)
@@ -1,13 +1,12 @@
from mpl_toolkits.basemap import Basemap, shiftgrid, maskoceans, interp
import numpy as np
import matplotlib.pyplot as plt
-import matplotlib.mlab as mlab
# example showing how to mask out 'wet' areas on a contour or pcolor plot.
-topodatin = mlab.load('etopo20data.gz')
-lonsin = mlab.load('etopo20lons.gz')
-latsin = mlab.load('etopo20lats.gz')
+topodatin = np.loadtxt('etopo20data.gz')
+lonsin = np.loadtxt('etopo20lons.gz')
+latsin = np.loadtxt('etopo20lats.gz')
# shift data so lons go from -180 to 180 instead of 20 to 380.
topoin,lons1 = shiftgrid(180.,topodatin,lonsin,start=False)
Modified: trunk/toolkits/basemap/examples/panelplot.py
===================================================================
--- trunk/toolkits/basemap/examples/panelplot.py 2009-06-21 18:53:49 UTC (rev 7230)
+++ trunk/toolkits/basemap/examples/panelplot.py 2009-06-23 12:39:21 UTC (rev 7231)
@@ -3,13 +3,12 @@
from matplotlib.ticker import MultipleLocator
import numpy as np
import matplotlib.pyplot as plt
-import matplotlib.mlab as mlab
# read in data on lat/lon grid.
-hgt = mlab.load('500hgtdata.gz')
-lons = mlab.load('500hgtlons.gz')
-lats = mlab.load('500hgtlats.gz')
+hgt = np.loadtxt('500hgtdata.gz')
+lons = np.loadtxt('500hgtlons.gz')
+lats = np.loadtxt('500hgtlats.gz')
lons, lats = np.meshgrid(lons, lats)
# Example to show how to make multi-panel plots.
Modified: trunk/toolkits/basemap/examples/plotmap.py
===================================================================
--- trunk/toolkits/basemap/examples/plotmap.py 2009-06-21 18:53:49 UTC (rev 7230)
+++ trunk/toolkits/basemap/examples/plotmap.py 2009-06-23 12:39:21 UTC (rev 7231)
@@ -7,13 +7,12 @@
from mpl_toolkits.basemap import Basemap, shiftgrid
import numpy as np
import matplotlib.pyplot as plt
-import matplotlib.mlab as mlab
# read in topo data (on a regular lat/lon grid)
# longitudes go from 20 to 380.
-topoin = mlab.load('etopo20data.gz')
-lons = mlab.load('etopo20lons.gz')
-lats = mlab.load('etopo20lats.gz')
+topoin = np.loadtxt('etopo20data.gz')
+lons = np.loadtxt('etopo20lons.gz')
+lats = np.loadtxt('etopo20lats.gz')
# shift data so lons go from -180 to 180 instead of 20 to 380.
topoin,lons = shiftgrid(180.,topoin,lons,start=False)
@@ -30,18 +29,19 @@
fig=plt.figure(figsize=(8,8))
# add an axes, leaving room for colorbar on the right.
ax = fig.add_axes([0.1,0.1,0.7,0.7])
+# associate this axes with the Basemap instance.
+m.ax = ax
# plot image over map with imshow.
im = m.imshow(topodat,plt.cm.jet)
# setup colorbar axes instance.
pos = ax.get_position()
l, b, w, h = pos.bounds
cax = plt.axes([l+w+0.075, b, 0.05, h])
-plt.colorbar(cax=cax) # draw colorbar
-plt.axes(ax) # make the original axes current again
+plt.colorbar(im,cax=cax) # draw colorbar
# plot blue dot on boulder, colorado and label it as such.
xpt,ypt = m(-104.237,40.125)
m.plot([xpt],[ypt],'bo')
-plt.text(xpt+100000,ypt+100000,'Boulder')
+ax.text(xpt+100000,ypt+100000,'Boulder')
# draw coastlines and political boundaries.
m.drawcoastlines()
m.drawcountries()
@@ -53,6 +53,5 @@
meridians = np.arange(10.,360.,30.)
m.drawmeridians(meridians,labels=[1,1,0,1])
# set title.
-plt.title('ETOPO Topography - Lambert Conformal Conic')
-#plt.savefig('plotmap.pdf')
+ax.set_title('ETOPO Topography - Lambert Conformal Conic')
plt.show()
Modified: trunk/toolkits/basemap/examples/plotmap_masked.py
===================================================================
--- trunk/toolkits/basemap/examples/plotmap_masked.py 2009-06-21 18:53:49 UTC (rev 7230)
+++ trunk/toolkits/basemap/examples/plotmap_masked.py 2009-06-23 12:39:21 UTC (rev 7231)
@@ -9,14 +9,13 @@
import numpy.ma as ma
import numpy as np
import matplotlib.pyplot as plt
-import matplotlib.mlab as mlab
import matplotlib.colors as colors
# read in topo data (on a regular lat/lon grid)
# longitudes go from 20 to 380.
-topoin = mlab.load('etopo20data.gz')
-lonsin = mlab.load('etopo20lons.gz')
-latsin = mlab.load('etopo20lats.gz')
+topoin = np.loadtxt('etopo20data.gz')
+lonsin = np.loadtxt('etopo20lons.gz')
+latsin = np.loadtxt('etopo20lats.gz')
# shift data so lons go from -180 to 180 instead of 20 to 380.
topoin,lonsin = shiftgrid(180.,topoin,lonsin,start=False)
@@ -33,6 +32,8 @@
fig=plt.figure(figsize=(8,8))
# add an axes, leaving room for colorbar on the right.
ax = fig.add_axes([0.1,0.1,0.7,0.7])
+# associate this axes with the Basemap instance.
+m.ax = ax
# make topodat a masked array, masking values lower than sea level.
topodat = np.where(topodat < 0.,1.e10,topodat)
topodatm = ma.masked_values(topodat, 1.e10)
@@ -44,12 +45,11 @@
pos = ax.get_position()
l, b, w, h = pos.bounds
cax = plt.axes([l+w+0.075, b, 0.05, h])
-plt.colorbar(cax=cax) # draw colorbar
-plt.axes(ax) # make the original axes current again
+plt.colorbar(im,cax=cax) # draw colorbar
# plot blue dot on boulder, colorado and label it as such.
xpt,ypt = m(-104.237,40.125)
m.plot([xpt],[ypt],'bo')
-plt.text(xpt+100000,ypt+100000,'Boulder')
+ax.text(xpt+100000,ypt+100000,'Boulder')
# draw coastlines and political boundaries.
m.drawcoastlines()
m.drawcountries()
@@ -61,5 +61,5 @@
meridians = np.arange(10.,360.,30.)
m.drawmeridians(meridians,labels=[1,1,0,1])
# set title.
-plt.title('Masked ETOPO Topography - via imshow')
+ax.set_title('Masked ETOPO Topography - via imshow')
plt.show()
Modified: trunk/toolkits/basemap/examples/plotmap_shaded.py
===================================================================
--- trunk/toolkits/basemap/examples/plotmap_shaded.py 2009-06-21 18:53:49 UTC (rev 7230)
+++ trunk/toolkits/basemap/examples/plotmap_shaded.py 2009-06-23 12:39:21 UTC (rev 7231)
@@ -6,7 +6,6 @@
from mpl_toolkits.basemap import Basemap, shiftgrid
import numpy as np
import matplotlib.pyplot as plt
-import matplotlib.mlab as mlab
try:
from matplotlib.colors import LightSource
except ImportError:
@@ -15,9 +14,9 @@
# read in topo data (on a regular lat/lon grid)
# longitudes go from 20 to 380.
-topoin = mlab.load('etopo20data.gz')
-lons = mlab.load('etopo20lons.gz')
-lats = mlab.load('etopo20lats.gz')
+topoin = np.loadtxt('etopo20data.gz')
+lons = np.loadtxt('etopo20lons.gz')
+lats = np.loadtxt('etopo20lats.gz')
# shift data so lons go from -180 to 180 instead of 20 to 380.
topoin,lons = shiftgrid(180.,topoin,lons,start=False)
Modified: trunk/toolkits/basemap/examples/polarmaps.py
===================================================================
--- trunk/toolkits/basemap/examples/polarmaps.py 2009-06-21 18:53:49 UTC (rev 7230)
+++ trunk/toolkits/basemap/examples/polarmaps.py 2009-06-23 12:39:21 UTC (rev 7231)
@@ -8,13 +8,12 @@
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
-import matplotlib.mlab as mlab
# read in topo data (on a regular lat/lon grid)
# longitudes go from 20 to 380.
-etopo = mlab.load('etopo20data.gz')
-lons = mlab.load('etopo20lons.gz')
-lats = mlab.load('etopo20lats.gz')
+etopo = np.loadtxt('etopo20data.gz')
+lons = np.loadtxt('etopo20lons.gz')
+lats = np.loadtxt('etopo20lats.gz')
print 'min/max etopo20 data:'
print etopo.min(),etopo.max()
Modified: trunk/toolkits/basemap/examples/simpletest.py
===================================================================
--- trunk/toolkits/basemap/examples/simpletest.py 2009-06-21 18:53:49 UTC (rev 7230)
+++ trunk/toolkits/basemap/examples/simpletest.py 2009-06-23 12:39:21 UTC (rev 7231)
@@ -1,11 +1,10 @@
from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
-import matplotlib.mlab as mlab
# read in topo data (on a regular lat/lon grid)
-etopo=mlab.load('etopo20data.gz')
-lons=mlab.load('etopo20lons.gz')
-lats=mlab.load('etopo20lats.gz')
+etopo=np.loadtxt('etopo20data.gz')
+lons=np.loadtxt('etopo20lons.gz')
+lats=np.loadtxt('etopo20lats.gz')
# create Basemap instance for Robinson projection.
m = Basemap(projection='robin',lon_0=0.5*(lons[0]+lons[-1]))
# make filled contour plot.
Modified: trunk/toolkits/basemap/examples/simpletest_oo.py
===================================================================
--- trunk/toolkits/basemap/examples/simpletest_oo.py 2009-06-21 18:53:49 UTC (rev 7230)
+++ trunk/toolkits/basemap/examples/simpletest_oo.py 2009-06-23 12:39:21 UTC (rev 7231)
@@ -8,15 +8,13 @@
from mpl_toolkits.basemap import Basemap
from matplotlib.figure import Figure
import numpy as np
-import matplotlib.mlab as mlab
import matplotlib.cm as cm
-from matplotlib.mlab import load
# read in topo data (on a regular lat/lon grid)
# longitudes go from 20 to 380.
-etopo = mlab.load('etopo20data.gz')
-lons = mlab.load('etopo20lons.gz')
-lats = mlab.load('etopo20lats.gz')
+etopo = np.loadtxt('etopo20data.gz')
+lons = np.loadtxt('etopo20lons.gz')
+lats = np.loadtxt('etopo20lats.gz')
# create figure.
fig = Figure()
canvas = FigureCanvas(fig)
Modified: trunk/toolkits/basemap/examples/test.py
===================================================================
--- trunk/toolkits/basemap/examples/test.py 2009-06-21 18:53:49 UTC (rev 7230)
+++ trunk/toolkits/basemap/examples/test.py 2009-06-23 12:39:21 UTC (rev 7231)
@@ -6,14 +6,13 @@
from mpl_toolkits.basemap import Basemap, shiftgrid
import numpy as np
import matplotlib.pyplot as plt
-import matplotlib.mlab as mlab
import matplotlib.colors as colors
# read in topo data (on a regular lat/lon grid)
# longitudes go from 20 to 380.
-topodatin = mlab.load('etopo20data.gz')
-lonsin = mlab.load('etopo20lons.gz')
-latsin = mlab.load('etopo20lats.gz')
+topodatin = np.loadtxt('etopo20data.gz')
+lonsin = np.loadtxt('etopo20lons.gz')
+latsin = np.loadtxt('etopo20lats.gz')
# shift data so lons go from -180 to 180 instead of 20 to 380.
topoin,lons = shiftgrid(180.,topodatin,lonsin,start=False)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2009-06-23 13:15:21
|
Revision: 7232
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7232&view=rev
Author: jswhit
Date: 2009-06-23 12:47:49 +0000 (Tue, 23 Jun 2009)
Log Message:
-----------
fix bug in spines
Modified Paths:
--------------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-06-23 12:39:21 UTC (rev 7231)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-06-23 12:47:49 UTC (rev 7232)
@@ -1266,7 +1266,7 @@
ax.frame.set_linewidth(linewidth)
except AttributeError:
for spine in ax.spines.itervalues():
- ax.spines[spine].set_linewidth(linewidth)
+ spine.set_linewidth(linewidth)
if self.projection not in ['geos','ortho']:
if fill_color is not None:
ax.axesPatch.set_facecolor(fill_color)
@@ -1274,7 +1274,7 @@
ax.frame.set_edgecolor(color)
except AttributeError:
for spine in ax.spines.itervalues():
- ax.spines[spine].set_edgecolor(color)
+ spine.set_edgecolor(color)
ax.set_frame_on(True)
# FIXME? should zorder be set separately for edge and background?
if zorder is not None:
@@ -1283,14 +1283,14 @@
ax.frame.set_zorder(zorder)
except AttributeError:
for spine in ax.spines.itervalues():
- ax.spines[spine].set_zorder(zorder)
+ spine.set_zorder(zorder)
else:
# use axesPatch for fill_color, frame for border line props.
try:
ax.frame.set_edgecolor(color)
except AttributeError:
for spine in ax.spines.itervalues():
- ax.spines[spine].set_edgecolor(color)
+ spine.set_edgecolor(color)
ax.set_frame_on(True)
# FIXME? should zorder be set separately for edge and background?
if zorder is not None:
@@ -1299,7 +1299,7 @@
ax.frame.set_zorder(zorder)
except AttributeError:
for spine in ax.spines.itervalues():
- ax.spines[spine].set_zorder(zorder)
+ spine.set_zorder(zorder)
# for geos or ortho projections, also
# draw and fill map projection limb, clipped
# to rectangular region.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-06-21 18:53:51
|
Revision: 7230
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7230&view=rev
Author: leejjoon
Date: 2009-06-21 18:53:49 +0000 (Sun, 21 Jun 2009)
Log Message:
-----------
Merged revisions 7229 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint
........
r7229 | leejjoon | 2009-06-21 14:44:53 -0400 (Sun, 21 Jun 2009) | 2 lines
fixed axes.scatter bug that circular symbol style is ignored
........
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7227
+ /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7229
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-06-21 18:44:53 UTC (rev 7229)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-06-21 18:53:49 UTC (rev 7230)
@@ -5287,7 +5287,7 @@
syms = { # a dict from symbol to (numsides, angle)
's' : (4,math.pi/4.0,0), # square
- 'o' : (20,3,0), # circle
+ 'o' : (0,0,3), # circle
'^' : (3,0,0), # triangle up
'>' : (3,math.pi/2.0,0), # triangle right
'v' : (3,math.pi,0), # triangle down
@@ -5375,7 +5375,7 @@
numsides, rotation = marker[0], marker[2]
sym = True
- if marker[1] in (1,2):
+ if marker[1] in (1,2,3):
symstyle = marker[1]
else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-06-21 18:45:40
|
Revision: 7229
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7229&view=rev
Author: leejjoon
Date: 2009-06-21 18:44:53 +0000 (Sun, 21 Jun 2009)
Log Message:
-----------
fixed axes.scatter bug that circular symbol style is ignored
Modified Paths:
--------------
branches/v0_98_5_maint/lib/matplotlib/axes.py
Modified: branches/v0_98_5_maint/lib/matplotlib/axes.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/axes.py 2009-06-19 04:49:38 UTC (rev 7228)
+++ branches/v0_98_5_maint/lib/matplotlib/axes.py 2009-06-21 18:44:53 UTC (rev 7229)
@@ -5018,7 +5018,7 @@
syms = { # a dict from symbol to (numsides, angle)
's' : (4,math.pi/4.0,0), # square
- 'o' : (20,3,0), # circle
+ 'o' : (0,0,3), # circle
'^' : (3,0,0), # triangle up
'>' : (3,math.pi/2.0,0), # triangle right
'v' : (3,math.pi,0), # triangle down
@@ -5095,7 +5095,7 @@
numsides, rotation = marker[0], marker[2]
sym = True
- if marker[1] in (1,2):
+ if marker[1] in (1,2,3):
symstyle = marker[1]
else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-06-19 04:49:40
|
Revision: 7228
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7228&view=rev
Author: leejjoon
Date: 2009-06-19 04:49:38 +0000 (Fri, 19 Jun 2009)
Log Message:
-----------
Merged revisions 7227 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint
This is duplicate fix of r7226 in the trunk.
........
r7227 | leejjoon | 2009-06-19 00:39:24 -0400 (Fri, 19 Jun 2009) | 1 line
fix sf bug 2806283 (patch by Joonas Paalasmaa)
........
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-7211
+ /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7227
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,7176,7209-7211
+ /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,7209-7211,7227
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,7176,7209-7211
+ /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,7209-7211,7227
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,7176,7209-7211
+ /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,7209-7211,7227
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,7176,7209-7211
+ /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,7209-7211,7227
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,7176,7209-7211
+ /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,7209-7211,7227
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,7176,7209-7211
+ /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,7209-7211,7227
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,7176,7209-7211
+ /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,7209-7211,7227
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-06-19 04:39:25
|
Revision: 7227
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7227&view=rev
Author: leejjoon
Date: 2009-06-19 04:39:24 +0000 (Fri, 19 Jun 2009)
Log Message:
-----------
fix sf bug 2806283 (patch by Joonas Paalasmaa)
Modified Paths:
--------------
branches/v0_98_5_maint/lib/matplotlib/colorbar.py
Modified: branches/v0_98_5_maint/lib/matplotlib/colorbar.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/colorbar.py 2009-06-19 04:33:44 UTC (rev 7226)
+++ branches/v0_98_5_maint/lib/matplotlib/colorbar.py 2009-06-19 04:39:24 UTC (rev 7227)
@@ -29,6 +29,7 @@
import matplotlib.patches as patches
import matplotlib.collections as collections
import matplotlib.contour as contour
+import matplotlib.artist as martist
make_axes_kw_doc = '''
@@ -625,9 +626,10 @@
self.mappable = mappable
kw['cmap'] = mappable.cmap
kw['norm'] = mappable.norm
- kw['alpha'] = mappable.get_alpha()
+
if isinstance(mappable, contour.ContourSet):
CS = mappable
+ kw['alpha'] = mappable.get_alpha()
kw['boundaries'] = CS._levels
kw['values'] = CS.cvalues
kw['extend'] = CS.extend
@@ -638,6 +640,9 @@
if not CS.filled:
self.add_lines(CS)
else:
+ if isinstance(mappable, martist.Artist):
+ kw['alpha'] = mappable.get_alpha()
+
ColorbarBase.__init__(self, ax, **kw)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-06-19 04:33:45
|
Revision: 7226
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7226&view=rev
Author: leejjoon
Date: 2009-06-19 04:33:44 +0000 (Fri, 19 Jun 2009)
Log Message:
-----------
fix sf bug 2806283 (patch by Joonas Paalasmaa)
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/colorbar.py
Modified: trunk/matplotlib/lib/matplotlib/colorbar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/colorbar.py 2009-06-17 02:18:39 UTC (rev 7225)
+++ trunk/matplotlib/lib/matplotlib/colorbar.py 2009-06-19 04:33:44 UTC (rev 7226)
@@ -29,6 +29,7 @@
import matplotlib.patches as patches
import matplotlib.collections as collections
import matplotlib.contour as contour
+import matplotlib.artist as martist
make_axes_kw_doc = '''
@@ -626,9 +627,10 @@
self.mappable = mappable
kw['cmap'] = mappable.cmap
kw['norm'] = mappable.norm
- kw['alpha'] = mappable.get_alpha()
+
if isinstance(mappable, contour.ContourSet):
CS = mappable
+ kw['alpha'] = mappable.get_alpha()
kw['boundaries'] = CS._levels
kw['values'] = CS.cvalues
kw['extend'] = CS.extend
@@ -639,6 +641,9 @@
if not CS.filled:
self.add_lines(CS)
else:
+ if isinstance(mappable, martist.Artist):
+ kw['alpha'] = mappable.get_alpha()
+
ColorbarBase.__init__(self, ax, **kw)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2009-06-17 02:18:50
|
Revision: 7225
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7225&view=rev
Author: jswhit
Date: 2009-06-17 02:18:39 +0000 (Wed, 17 Jun 2009)
Log Message:
-----------
ax.frame replaced with ax.spines
Modified Paths:
--------------
trunk/toolkits/basemap/Changelog
Modified: trunk/toolkits/basemap/Changelog
===================================================================
--- trunk/toolkits/basemap/Changelog 2009-06-17 02:06:27 UTC (rev 7224)
+++ trunk/toolkits/basemap/Changelog 2009-06-17 02:18:39 UTC (rev 7225)
@@ -1,4 +1,6 @@
version 0.99.4 (not yet released)
+ * ax.frame replaced with ax.spines to maintain compatibility
+ with matplotlib spines support.
* added latmax kwarg to drawparallels and drawmeridians
(patch from Chris Murphy).
* added new example "plotmap_shaded.py" (shaded relief plot).
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2009-06-17 02:16:57
|
Revision: 7224
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7224&view=rev
Author: jswhit
Date: 2009-06-17 02:06:27 +0000 (Wed, 17 Jun 2009)
Log Message:
-----------
axes.frame replaced by axes.spines
Modified Paths:
--------------
trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py
===================================================================
--- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-06-16 18:31:57 UTC (rev 7223)
+++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009-06-17 02:06:27 UTC (rev 7224)
@@ -1262,24 +1262,44 @@
limb.set_zorder(zorder)
else: # all other projections are rectangular.
# use axesPatch for fill_color, frame for border line props.
- ax.frame.set_linewidth(linewidth)
+ try:
+ ax.frame.set_linewidth(linewidth)
+ except AttributeError:
+ for spine in ax.spines.itervalues():
+ ax.spines[spine].set_linewidth(linewidth)
if self.projection not in ['geos','ortho']:
if fill_color is not None:
ax.axesPatch.set_facecolor(fill_color)
- ax.frame.set_edgecolor(color)
+ try:
+ ax.frame.set_edgecolor(color)
+ except AttributeError:
+ for spine in ax.spines.itervalues():
+ ax.spines[spine].set_edgecolor(color)
ax.set_frame_on(True)
# FIXME? should zorder be set separately for edge and background?
if zorder is not None:
ax.axesPatch.set_zorder(zorder)
- ax.frame.set_zorder(zorder)
+ try:
+ ax.frame.set_zorder(zorder)
+ except AttributeError:
+ for spine in ax.spines.itervalues():
+ ax.spines[spine].set_zorder(zorder)
else:
# use axesPatch for fill_color, frame for border line props.
- ax.frame.set_edgecolor(color)
+ try:
+ ax.frame.set_edgecolor(color)
+ except AttributeError:
+ for spine in ax.spines.itervalues():
+ ax.spines[spine].set_edgecolor(color)
ax.set_frame_on(True)
# FIXME? should zorder be set separately for edge and background?
if zorder is not None:
ax.axesPatch.set_zorder(zorder)
- ax.frame.set_zorder(zorder)
+ try:
+ ax.frame.set_zorder(zorder)
+ except AttributeError:
+ for spine in ax.spines.itervalues():
+ ax.spines[spine].set_zorder(zorder)
# for geos or ortho projections, also
# draw and fill map projection limb, clipped
# to rectangular region.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2009-06-16 18:31:58
|
Revision: 7223
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7223&view=rev
Author: jswhit
Date: 2009-06-16 18:31:57 +0000 (Tue, 16 Jun 2009)
Log Message:
-----------
add "python-dev" package suggestion.
Modified Paths:
--------------
trunk/toolkits/basemap/README
Modified: trunk/toolkits/basemap/README
===================================================================
--- trunk/toolkits/basemap/README 2009-06-16 09:12:08 UTC (rev 7222)
+++ trunk/toolkits/basemap/README 2009-06-16 18:31:57 UTC (rev 7223)
@@ -17,6 +17,11 @@
PIL (http://pythonware.com/products/pil) is optional (only
needed for Basemap warpimage and bluemarble methods).
+On linux, if your python was installed via a package management system, make
+sure the corresponding "python-dev" package is also installed. Otherwise, you
+may not have the python header (Python.h), which is required to build python
+C extensions.
+
**Copyright**
source code from proj.4 (http://proj.maptools.org) is included in the
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <he...@us...> - 2009-06-16 09:12:10
|
Revision: 7222
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7222&view=rev
Author: heeres
Date: 2009-06-16 09:12:08 +0000 (Tue, 16 Jun 2009)
Log Message:
-----------
Remove axes3d.py
Removed Paths:
-------------
trunk/matplotlib/lib/matplotlib/axes3d.py
Deleted: trunk/matplotlib/lib/matplotlib/axes3d.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes3d.py 2009-06-14 17:38:12 UTC (rev 7221)
+++ trunk/matplotlib/lib/matplotlib/axes3d.py 2009-06-16 09:12:08 UTC (rev 7222)
@@ -1 +0,0 @@
-raise NotImplementedError('axes3d is not supported in matplotlib-0.98. You may want to try the 0.91.x maintenance branch')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-14 17:38:15
|
Revision: 7221
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7221&view=rev
Author: jdh2358
Date: 2009-06-14 17:38:12 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
fixed a press/release pan bug when mouse button=2 as described in sf bug 2805312
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/backend_bases.py
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py 2009-06-14 17:34:40 UTC (rev 7220)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2009-06-14 17:38:12 UTC (rev 7221)
@@ -2007,6 +2007,9 @@
def release_pan(self, event):
'the release mouse button callback in pan/zoom mode'
+
+ if self._button_pressed is None:
+ return
self.canvas.mpl_disconnect(self._idDrag)
self._idDrag=self.canvas.mpl_connect('motion_notify_event', self.mouse_move)
for a, ind in self._xypress:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-14 17:34:41
|
Revision: 7220
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7220&view=rev
Author: jdh2358
Date: 2009-06-14 17:34:40 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
fixed errorbar Nx2 docstring bug as described in sf bug 2804502
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-06-14 17:24:45 UTC (rev 7219)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-06-14 17:34:40 UTC (rev 7220)
@@ -4725,12 +4725,12 @@
Optional keyword arguments:
- *xerr*/*yerr*: [ scalar | N, Nx1, Nx2 array-like ]
+ *xerr*/*yerr*: [ scalar | N, Nx1, or 2xN array-like ]
If a scalar number, len(N) array-like object, or an Nx1 array-like
object, errorbars are drawn +/- value.
- If a rank-1, Nx2 Numpy array, errorbars are drawn at -column1 and
- +column2
+ If a rank-1, 2xN numpy array, errorbars are drawn at -row1 and
+ +row2
*fmt*: '-'
The plot format symbol for *y*. If *fmt* is *None*, just plot the
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-14 17:24:47
|
Revision: 7219
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7219&view=rev
Author: jdh2358
Date: 2009-06-14 17:24:45 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
added variant of sf patch 2805653 for specgram kwargs pass thru to imshow
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-06-14 05:38:11 UTC (rev 7218)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-06-14 17:24:45 UTC (rev 7219)
@@ -7530,14 +7530,14 @@
def specgram(self, x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
window=mlab.window_hanning, noverlap=128,
cmap=None, xextent=None, pad_to=None, sides='default',
- scale_by_freq=None):
+ scale_by_freq=None, **kwargs):
"""
call signature::
specgram(x, NFFT=256, Fs=2, Fc=0, detrend=mlab.detrend_none,
window=mlab.window_hanning, noverlap=128,
cmap=None, xextent=None, pad_to=None, sides='default',
- scale_by_freq=None)
+ scale_by_freq=None, **kwargs)
Compute a spectrogram of data in *x*. Data are split into
*NFFT* length segments and the PSD of each section is
@@ -7562,8 +7562,13 @@
The default is (0,max(bins)), where bins is the return
value from :func:`mlab.specgram`
- Return value is (*Pxx*, *freqs*, *bins*, *im*):
+ *kwargs*:
+ Additional kwargs are passed on to imshow which makes the
+ specgram image
+
+ Return value is (*Pxx*, *freqs*, *bins*, *im*):
+
- *bins* are the time points the spectrogram is calculated over
- *freqs* is an array of frequencies
- *Pxx* is a len(times) x len(freqs) array of power
@@ -7590,7 +7595,7 @@
xmin, xmax = xextent
freqs += Fc
extent = xmin, xmax, freqs[0], freqs[-1]
- im = self.imshow(Z, cmap, extent=extent)
+ im = self.imshow(Z, cmap, extent=extent, **kwargs)
self.axis('auto')
return Pxx, freqs, bins, im
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jo...@us...> - 2009-06-14 05:38:12
|
Revision: 7218
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7218&view=rev
Author: jouni
Date: 2009-06-14 05:38:11 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
Extend backend_driver.py to support running only some test directories
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/examples/tests/backend_driver.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-06-14 01:32:20 UTC (rev 7217)
+++ trunk/matplotlib/CHANGELOG 2009-06-14 05:38:11 UTC (rev 7218)
@@ -1,3 +1,6 @@
+2009-06-14 Add new command line options to backend_driver.py to support
+ running only some directories of tests - JKS
+
2009-06-13 partial cleanup of mlab and its importation in pylab - EF
2009-06-13 Introduce a rotation_mode property for the Text artist. See
Modified: trunk/matplotlib/examples/tests/backend_driver.py
===================================================================
--- trunk/matplotlib/examples/tests/backend_driver.py 2009-06-14 01:32:20 UTC (rev 7217)
+++ trunk/matplotlib/examples/tests/backend_driver.py 2009-06-14 05:38:11 UTC (rev 7218)
@@ -3,30 +3,40 @@
This is used to drive many of the examples across the backends, for
regression testing, and comparing backend efficiency.
-The script takes one or more arguments specifying backends
-to be tested, e.g.
+You can specify the backends to be tested either via the --backends
+switch, which takes a comma-separated list, or as separate arguments,
+e.g.
python backend_driver.py agg ps cairo.png cairo.ps
-would test the agg and ps backends, and the cairo backend with
-output to png and ps files.
+would test the agg and ps backends, and the cairo backend with output
+to png and ps files. If no arguments are given, a default list of
+backends will be tested.
-If no arguments are given, a default list of backends will be
-tested.
+Interspersed with the backend arguments can be switches for the Python
+interpreter executing the tests. If entering such arguments causes an
+option parsing error with the driver script, separate them from driver
+switches with a --.
"""
from __future__ import division
-import os, time, sys, glob
-
+import os, time, sys, glob, string
+from optparse import OptionParser
import matplotlib.rcsetup as rcsetup
+from matplotlib.cbook import Bunch, dedent
all_backends = list(rcsetup.all_backends) # to leave the original list alone
all_backends.extend(['cairo.png', 'cairo.ps', 'cairo.pdf', 'cairo.svg'])
-pylab_dir = os.path.join('..', 'pylab_examples')
-pylab_files = [
+# actual physical directory for each dir
+dirs = dict(pylab = os.path.join('..', 'pylab_examples'),
+ api = os.path.join('..', 'api'),
+ units = os.path.join('..', 'units'),
+ mplot3d = os.path.join('..', 'mplot3d'))
-
+# files in each dir
+files = dict()
+files['pylab'] = [
'accented_text.py',
'alignment_test.py',
'annotation_demo.py',
@@ -196,8 +206,7 @@
]
-api_dir = os.path.join('..', 'api')
-api_files = [
+files['api'] = [
'agg_oo.py',
'barchart_demo.py',
'bbox_intersect.py',
@@ -228,8 +237,7 @@
'watermark_text.py',
]
-units_dir = os.path.join('..', 'units')
-units_files = [
+files['units'] = [
'annotate_with_units.py',
#'artist_tests.py', # broken, fixme
'bar_demo2.py',
@@ -241,8 +249,7 @@
]
-mplot3d_dir = os.path.join('..', 'mplot3d')
-mplot3d_files = [
+files['mplot3d'] = [
'2dcollections3d_demo.py',
'bars3d_demo.py',
'contour3d_demo.py',
@@ -263,8 +270,8 @@
# examples that generate multiple figures
excluded = {
- pylab_dir : ['__init__.py', 'toggle_images.py',],
- units_dir : ['__init__.py', 'date_support.py',],
+ 'pylab' : ['__init__.py', 'toggle_images.py',],
+ 'units' : ['__init__.py', 'date_support.py',],
}
def report_missing(dir, flist):
@@ -278,24 +285,16 @@
flist = set(flist)
missing = list(pyfiles-flist-exclude)
missing.sort()
- print '%s files not tested: %s'%(dir, ', '.join(missing))
+ if missing:
+ print '%s files not tested: %s'%(dir, ', '.join(missing))
+def report_all_missing(directories):
+ for f in directories:
+ report_missing(dirs[f], files[f])
-report_missing(pylab_dir, pylab_files)
-report_missing(api_dir, api_files)
-report_missing(units_dir, units_files)
-report_missing(mplot3d_dir, mplot3d_files)
-files = (
- [os.path.join(api_dir, fname) for fname in api_files] +
- [os.path.join(pylab_dir, fname) for fname in pylab_files] +
- [os.path.join(units_dir, fname) for fname in units_files] +
- [os.path.join(mplot3d_dir, fname) for fname in mplot3d_files]
- )
-
# tests known to fail on a given backend
-
failbackend = dict(
svg = ('tex_demo.py', ),
agg = ('hyperlinks.py', ),
@@ -317,7 +316,7 @@
def run(arglist):
os.system(' '.join(arglist))
-def drive(backend, python=['python'], switches = []):
+def drive(backend, directories, python=['python'], switches = []):
exclude = failbackend.get(backend, [])
# Clear the destination directory for the examples
@@ -329,8 +328,12 @@
else:
os.mkdir(backend)
failures = []
- for fullpath in files:
+ testcases = [os.path.join(dirs[d], fname)
+ for d in directories
+ for fname in files[d]]
+
+ for fullpath in testcases:
print ('\tdriving %-40s' % (fullpath)),
sys.stdout.flush()
@@ -376,21 +379,64 @@
tmpfile.close()
start_time = time.time()
program = [x % {'name': basename} for x in python]
- ret = run(program + [tmpfile_name, switchstring])
+ ret = run(program + [tmpfile_name] + switches)
end_time = time.time()
print (end_time - start_time), ret
- #os.system('%s %s %s' % (python, tmpfile_name, switchstring))
+ #os.system('%s %s %s' % (python, tmpfile_name, ' '.join(switches)))
os.remove(tmpfile_name)
if ret:
failures.append(fullpath)
return failures
+def parse_options():
+ doc = __doc__.split('\n\n')
+ op = OptionParser(description=doc[0].strip(),
+ usage='%prog [options] [--] [backends and switches]',
+ epilog='\n'.join(doc[1:]))
+ op.disable_interspersed_args()
+ op.set_defaults(dirs='pylab,api,units,mplot3d',
+ clean=False, coverage=False, valgrind=False)
+ op.add_option('-d', '--dirs', '--directories', type='string',
+ dest='dirs', help=dedent('''
+ Run only the tests in these directories; comma-separated list of
+ one or more of: pylab (or pylab_examples), api, units, mplot3d'''))
+ op.add_option('-b', '--backends', type='string', dest='backends',
+ help=dedent('''
+ Run tests only for these backends; comma-separated list of
+ one or more of: agg, ps, svg, pdf, template, cairo,
+ cairo.png, cairo.ps, cairo.pdf, cairo.svg. Default is everything
+ except cairo.'''))
+ op.add_option('--clean', action='store_true', dest='clean',
+ help='Remove result directories, run no tests')
+ op.add_option('-c', '--coverage', action='store_true', dest='coverage',
+ help='Run in coverage.py')
+ op.add_option('-v', '--valgrind', action='store_true', dest='valgrind',
+ help='Run in valgrind')
+ options, args = op.parse_args()
+ switches = [x for x in args if x.startswith('--')]
+ backends = [x.lower() for x in args if not x.startswith('--')]
+ if options.backends:
+ backends += map(string.lower, options.backends.split(','))
+
+ result = Bunch(
+ dirs = options.dirs.split(','),
+ backends = backends or ['agg', 'ps', 'svg', 'pdf', 'template'],
+ clean = options.clean,
+ coverage = options.coverage,
+ valgrind = options.valgrind,
+ switches = switches)
+ if 'pylab_examples' in result.dirs:
+ result.dirs[result.dirs.index('pylab_examples')] = 'pylab'
+ #print result
+ return result
+
if __name__ == '__main__':
times = {}
failures = {}
- default_backends = ['agg', 'ps', 'svg', 'pdf', 'template']
- if len(sys.argv)==2 and sys.argv[1]=='--clean':
+ options = parse_options()
+
+ if options.clean:
localdirs = [d for d in glob.glob('*') if os.path.isdir(d)]
all_backends_set = set(all_backends)
for d in localdirs:
@@ -405,38 +451,31 @@
print 'all clean...'
raise SystemExit
- if '--coverage' in sys.argv:
+ if options.coverage:
python = ['coverage.py', '-x']
- sys.argv.remove('--coverage')
- elif '--valgrind' in sys.argv:
+ elif options.valgrind:
python = ['valgrind', '--tool=memcheck', '--leak-check=yes',
'--log-file=%(name)s', 'python']
- sys.argv.remove('--valgrind')
elif sys.platform == 'win32':
python = [r'c:\Python24\python.exe']
else:
python = ['python']
- backends = []
- switches = []
- if sys.argv[1:]:
- backends = [b.lower() for b in sys.argv[1:] if b.lower() in all_backends]
- switches = [s for s in sys.argv[1:] if s.startswith('--')]
- if not backends:
- backends = default_backends
- for backend in backends:
- switchstring = ' '.join(switches)
- print 'testing %s %s' % (backend, switchstring)
+
+ report_all_missing(options.dirs)
+ for backend in options.backends:
+ print 'testing %s %s' % (backend, ' '.join(options.switches))
t0 = time.time()
- failures[backend] = drive(backend, python, switches)
+ failures[backend] = \
+ drive(backend, options.dirs, python, options.switches)
t1 = time.time()
times[backend] = (t1-t0)/60.0
# print times
for backend, elapsed in times.items():
- print 'Backend %s took %1.2f minutes to complete' % ( backend, elapsed)
+ print 'Backend %s took %1.2f minutes to complete' % (backend, elapsed)
failed = failures[backend]
if failed:
print ' Failures: ', failed
- if 'Template' in times:
+ if 'template' in times:
print '\ttemplate ratio %1.3f, template residual %1.3f' % (
- elapsed/times['Template'], elapsed-times['Template'])
+ elapsed/times['template'], elapsed-times['template'])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2009-06-14 02:14:34
|
Revision: 7217
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7217&view=rev
Author: efiring
Date: 2009-06-14 01:32:20 +0000 (Sun, 14 Jun 2009)
Log Message:
-----------
partial cleanup of mlab and of the pylab imports from mlab
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/cbook.py
trunk/matplotlib/lib/matplotlib/mlab.py
trunk/matplotlib/lib/matplotlib/pylab.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-06-13 21:13:14 UTC (rev 7216)
+++ trunk/matplotlib/CHANGELOG 2009-06-14 01:32:20 UTC (rev 7217)
@@ -1,3 +1,5 @@
+2009-06-13 partial cleanup of mlab and its importation in pylab - EF
+
2009-06-13 Introduce a rotation_mode property for the Text artist. See
examples/pylab_examples/demo_text_rotation_mode.py -JJL
Modified: trunk/matplotlib/lib/matplotlib/cbook.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/cbook.py 2009-06-13 21:13:14 UTC (rev 7216)
+++ trunk/matplotlib/lib/matplotlib/cbook.py 2009-06-14 01:32:20 UTC (rev 7217)
@@ -761,36 +761,6 @@
-
-# python 2.2 dicts don't have pop--but we don't support 2.2 any more
-def popd(d, *args):
- """
- Should behave like python2.3 :meth:`dict.pop` method; *d* is a
- :class:`dict`::
-
- # returns value for key and deletes item; raises a KeyError if key
- # is not in dict
- val = popd(d, key)
-
- # returns value for key if key exists, else default. Delete key,
- # val item if it exists. Will not raise a KeyError
- val = popd(d, key, default)
-
- """
- warnings.warn("Use native python dict.pop method", DeprecationWarning)
- # warning added 2008/07/22
- if len(args)==1:
- key = args[0]
- val = d[key]
- del d[key]
- elif len(args)==2:
- key, default = args
- val = d.get(key, default)
- try: del d[key]
- except KeyError: pass
- return val
-
-
class maxdict(dict):
"""
A dictionary with a maximum size; this doesn't override all the
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2009-06-13 21:13:14 UTC (rev 7216)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2009-06-14 01:32:20 UTC (rev 7217)
@@ -130,39 +130,12 @@
care--function signatures may differ):
-:meth:`conv`
- convolution (numpy.convolve)
-
-:meth:`corrcoef`
- The matrix of correlation coefficients
-
-:meth:`hist`
- Histogram (numpy.histogram)
-
-:meth:`linspace`
- Linear spaced array from min to max
-
:meth:`load`
load ASCII file - use numpy.loadtxt
-:meth:`meshgrid`
- Make a 2D grid from 2 1 arrays (numpy.meshgrid)
-
-:meth:`polyfit`
- least squares best polynomial fit of x to y (numpy.polyfit)
-
-:meth:`polyval`
- evaluate a vector for a vector of polynomial coeffs (numpy.polyval)
-
:meth:`save`
save ASCII file - use numpy.savetxt
-:meth:`trapz`
- trapeziodal integration (trapz(x,y) -> numpy.trapz(y,x))
-
-:meth:`vander`
- the Vandermonde matrix (numpy.vander)
-
"""
from __future__ import division
@@ -176,20 +149,6 @@
import matplotlib.cbook as cbook
-def linspace(*args, **kw):
- warnings.warn("use numpy.linspace", DeprecationWarning)
- return np.linspace(*args, **kw)
-
-def meshgrid(x,y):
- warnings.warn("use numpy.meshgrid", DeprecationWarning)
- return np.meshgrid(x,y)
-
-def mean(x, dim=None):
- warnings.warn("Use numpy.mean(x) or x.mean()", DeprecationWarning)
- if len(x)==0: return None
- return np.mean(x, axis=dim)
-
-
def logspace(xmin,xmax,N):
return np.exp(np.linspace(np.log(xmin), np.log(xmax), N))
@@ -205,12 +164,6 @@
"No window function; simply return x"
return x
-#from numpy import convolve as conv
-def conv(x, y, mode=2):
- 'convolve x with y'
- warnings.warn("Use numpy.convolve(x, y, mode='full')", DeprecationWarning)
- return np.convolve(x,y,mode)
-
def detrend(x, key=None):
if key is None or key=='constant':
return detrend_mean(x)
@@ -537,111 +490,7 @@
cohere.__doc__ = cohere.__doc__ % kwdocd
-def corrcoef(*args):
- """
- corrcoef(*X*) where *X* is a matrix returns a matrix of correlation
- coefficients for the columns of *X*
- corrcoef(*x*, *y*) where *x* and *y* are vectors returns the matrix of
- correlation coefficients for *x* and *y*.
-
- Numpy arrays can be real or complex.
-
- The correlation matrix is defined from the covariance matrix *C*
- as
-
- .. math::
-
- r_{ij} = \\frac{C_{ij}}{\\sqrt{C_{ii}C_{jj}}}
- """
- warnings.warn("Use numpy.corrcoef", DeprecationWarning)
- kw = dict(rowvar=False)
- return np.corrcoef(*args, **kw)
-
-
-def polyfit(*args, **kwargs):
- u"""
- polyfit(*x*, *y*, *N*)
-
- Do a best fit polynomial of order *N* of *y* to *x*. Return value
- is a vector of polynomial coefficients [pk ... p1 p0]. Eg, for
- *N* = 2::
-
- p2*x0^2 + p1*x0 + p0 = y1
- p2*x1^2 + p1*x1 + p0 = y1
- p2*x2^2 + p1*x2 + p0 = y2
- .....
- p2*xk^2 + p1*xk + p0 = yk
-
-
- Method: if *X* is a the Vandermonde Matrix computed from *x* (see
- `vandermonds
- <http://mathworld.wolfram.com/VandermondeMatrix.html>`_), then the
- polynomial least squares solution is given by the '*p*' in
-
- X*p = y
-
- where *X* is a (len(*x*) \N{MULTIPLICATION SIGN} *N* + 1) matrix,
- *p* is a *N*+1 length vector, and *y* is a (len(*x*)
- \N{MULTIPLICATION SIGN} 1) vector.
-
- This equation can be solved as
-
- .. math::
-
- p = (X_t X)^-1 X_t y
-
- where :math:`X_t` is the transpose of *X* and -1 denotes the
- inverse. Numerically, however, this is not a good method, so we
- use :func:`numpy.linalg.lstsq`.
-
- For more info, see `least squares fitting
- <http://mathworld.wolfram.com/LeastSquaresFittingPolynomial.html>`_,
- but note that the *k*'s and *n*'s in the superscripts and
- subscripts on that page. The linear algebra is correct, however.
-
- .. seealso::
-
- :func:`polyval`
- polyval function
- """
- warnings.warn("use numpy.polyfit", DeprecationWarning)
- return np.polyfit(*args, **kwargs)
-
-
-def polyval(*args, **kwargs):
- """
- *y* = polyval(*p*, *x*)
-
- *p* is a vector of polynomial coeffients and *y* is the polynomial
- evaluated at *x*.
-
- Example code to remove a polynomial (quadratic) trend from y::
-
- p = polyfit(x, y, 2)
- trend = polyval(p, x)
- resid = y - trend
-
- .. seealso::
-
- :func:`polyfit`
- polyfit function
- """
- warnings.warn("use numpy.polyval", DeprecationWarning)
- return np.polyval(*args, **kwargs)
-
-def vander(*args, **kwargs):
- """
- *X* = vander(*x*, *N* = *None*)
-
- The Vandermonde matrix of vector *x*. The *i*-th column of *X* is the
- the *i*-th power of *x*. *N* is the maximum power to compute; if *N* is
- *None* it defaults to len(*x*).
- """
- warnings.warn("Use numpy.vander()", DeprecationWarning)
- return np.vander(*args, **kwargs)
-
-
def donothing_callback(*args):
pass
@@ -826,24 +675,6 @@
#S = -1.0*np.sum(p*log(p))
return S
-def hist(y, bins=10, normed=0):
- """
- Return the histogram of *y* with *bins* equally sized bins. If
- bins is an array, use those bins. Return value is (*n*, *x*)
- where *n* is the count for each bin in *x*.
-
- If *normed* is *False*, return the counts in the first element of
- the returned tuple. If *normed* is *True*, return the probability
- density :math:`\\frac{n}{(len(y)\mathrm{dbin}}`.
-
- If *y* has rank > 1, it will be raveled. If *y* is masked, only the
- unmasked values will be used.
-
- Credits: the Numeric 22 documentation
- """
- warnings.warn("Use numpy.histogram()", DeprecationWarning)
- return np.histogram(y, bins=bins, range=None, normed=normed)
-
def normpdf(x, *args):
"Return the normal pdf evaluated at *x*; args provides *mu*, *sigma*"
mu, sigma = args
@@ -879,14 +710,7 @@
res, = np.nonzero(np.ravel(condition))
return res
-def trapz(x, y):
- """
- Trapezoidal integral of *y*(*x*).
- """
- warnings.warn("Use numpy.trapz(y,x) instead of trapz(x,y)", DeprecationWarning)
- return np.trapz(y, x)
-
def longest_contiguous_ones(x):
"""
Return the indices of the longest stretch of contiguous ones in *x*,
@@ -1203,6 +1027,8 @@
*x* is a very long trajectory from a map, and *fprime* returns the
derivative of *x*.
+ This function will be removed from matplotlib.
+
Returns :
.. math::
@@ -1221,6 +1047,9 @@
It also seems that this function's name is badly misspelled.
"""
+
+ warnings.warn("This does not belong in matplotlib and will be removed", DeprecationWarning) # 2009/06/13
+
return np.mean(np.log(np.absolute(fprime(x))))
class FIFOBuffer:
@@ -1330,6 +1159,8 @@
Save the data in *X* to file *fname* using *fmt* string to convert the
data to strings.
+ Deprecated. Use numpy.savetxt.
+
*fname* can be a filename or a file handle. If the filename ends
in '.gz', the file is automatically saved in compressed gzip
format. The :func:`load` function understands gzipped files
@@ -1346,6 +1177,8 @@
for comma-separated values.
"""
+ warnings.warn("use numpy.savetxt", DeprecationWarning) # 2009/06/13
+
if cbook.is_string_like(fname):
if fname.endswith('.gz'):
import gzip
@@ -1377,6 +1210,8 @@
"""
Load ASCII data from *fname* into an array and return the array.
+ Deprecated: use numpy.loadtxt.
+
The data must be regular, same number of values in every row
*fname* can be a filename or a file handle. Support for gzipped
@@ -1429,6 +1264,8 @@
Exercises many of these options.
"""
+ warnings.warn("use numpy.loadtxt", DeprecationWarning) # 2009/06/13
+
if converters is None: converters = {}
fh = cbook.to_filehandle(fname)
X = []
@@ -1720,33 +1557,6 @@
return np.array(map(fn,*args))
-#from numpy import zeros_like
-def zeros_like(a):
- """
- Return an array of zeros of the shape and typecode of *a*.
- """
- warnings.warn("Use numpy.zeros_like(a)", DeprecationWarning)
- return np.zeros_like(a)
-
-#from numpy import sum as sum_flat
-def sum_flat(a):
- """
- Return the sum of all the elements of *a*, flattened out.
-
- It uses ``a.flat``, and if *a* is not contiguous, a call to
- ``ravel(a)`` is made.
- """
- warnings.warn("Use numpy.sum(a) or a.sum()", DeprecationWarning)
- return np.sum(a)
-
-#from numpy import mean as mean_flat
-def mean_flat(a):
- """
- Return the mean of all the elements of *a*, flattened out.
- """
- warnings.warn("Use numpy.mean(a) or a.mean()", DeprecationWarning)
- return np.mean(a)
-
def rms_flat(a):
"""
Return the root mean square of all the elements of *a*, flattened out.
@@ -1852,14 +1662,6 @@
return np.arange(npts)*delta+xini
# end frange()
-#import numpy.diag as diagonal_matrix
-def diagonal_matrix(diag):
- """
- Return square diagonal matrix whose non-zero elements are given by the
- input array.
- """
- warnings.warn("Use numpy.diag(d)", DeprecationWarning)
- return np.diag(diag)
def identity(n, rank=2, dtype='l', typecode=None):
"""
@@ -1962,73 +1764,11 @@
"""
return np.prod(X.shape)==np.max(X.shape)
-#from numpy import fromfunction as fromfunction_kw
-def fromfunction_kw(function, dimensions, **kwargs):
- """
- Drop-in replacement for :func:`numpy.fromfunction`.
-
- Allows passing keyword arguments to the desired function.
-
- Call it as (keywords are optional)::
-
- fromfunction_kw(MyFunction, dimensions, keywords)
-
- The function ``MyFunction`` is responsible for handling the
- dictionary of keywords it will receive.
- """
- warnings.warn("Use numpy.fromfunction()", DeprecationWarning)
- return np.fromfunction(function, dimensions, **kwargs)
-
### end fperez numutils code
-def rem(x,y):
- """
- Deprecated - see :func:`numpy.remainder`
- """
- raise NotImplementedError('Deprecated - see numpy.remainder')
-
-def norm(x,y=2):
- """
- Deprecated - see :func:`numpy.linalg.norm`
- """
- raise NotImplementedError('Deprecated - see numpy.linalg.norm')
-
-
-def orth(A):
- """
- Deprecated - needs clean room implementation
- """
- raise NotImplementedError('Deprecated - needs clean room implementation')
-
-def rank(x):
- """
- Deprecated - see :func:`numpy.rank`
- """
- raise NotImplementedError('Deprecated - see numpy.rank')
-
-def sqrtm(x):
- """
- Deprecated - needs clean room implementation
- """
- raise NotImplementedError('Deprecated - see scipy.linalg.sqrtm')
-
-
-def mfuncC(f, x):
- """
- Deprecated
- """
- raise NotImplementedError('Deprecated - needs clean room implementation')
-
-def approx_real(x):
- """
- Deprecated - needs clean room implementation
- """
- raise NotImplementedError('Deprecated - needs clean room implementation')
-
#helpers for loading, saving, manipulating and viewing numpy record arrays
-
def safe_isnan(x):
':func:`numpy.isnan` for arbitrary types'
if cbook.is_string_like(x):
@@ -2047,15 +1787,6 @@
except TypeError: return False
else: return b
-def rec_append_field(rec, name, arr, dtype=None):
- """
- Return a new record array with field name populated with data from
- array *arr*. This function is Deprecated. Please use
- :func:`rec_append_fields`.
- """
- warnings.warn("use rec_append_fields", DeprecationWarning)
- return rec_append_fields(rec, name, arr, dtype)
-
def rec_append_fields(rec, names, arrs, dtypes=None):
"""
Return a new record array with field names populated with data
@@ -2114,7 +1845,7 @@
if cbook.is_string_like(names):
names = names.split(',')
-
+
arrays = []
for name in names:
arrays.append(rec[name])
@@ -2745,7 +2476,7 @@
if fields is not None:
r = rec_keep_fields(r, fields)
-
+
if cbook.is_numlike(precision):
precision = [precision]*len(r.dtype)
Modified: trunk/matplotlib/lib/matplotlib/pylab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pylab.py 2009-06-13 21:13:14 UTC (rev 7216)
+++ trunk/matplotlib/lib/matplotlib/pylab.py 2009-06-14 01:32:20 UTC (rev 7217)
@@ -150,12 +150,12 @@
_Statistics
+ amax - the maximum along dimension m
+ amin - the minimum along dimension m
corrcoef - correlation coefficient
cov - covariance matrix
- amax - the maximum along dimension m
mean - the mean along dimension m
median - the median along dimension m
- amin - the minimum along dimension m
norm - the norm of vector x
prod - the product along dimension m
ptp - the max-min along dimension m
@@ -185,12 +185,14 @@
_Other
angle - the angle of a complex array
- griddata - interpolate irregularly distributed data to a regular grid
- load - load ASCII data into array
+ griddata - interpolate irregularly distributed data to a regular grid
+ load - Deprecated--please use loadtxt.
+ loadtxt - load ASCII data into array.
polyfit - fit x, y to an n-th order polynomial
polyval - evaluate an n-th order polynomial
roots - the roots of the polynomial coefficients in p
- save - save an array to an ASCII file
+ save - Deprecated--please use savetxt.
+ savetxt - save an array to an ASCII file.
trapz - trapezoidal integration
__end
@@ -198,12 +200,9 @@
"""
import sys, warnings
-from cbook import flatten, is_string_like, exception_to_str, popd, \
+from cbook import flatten, is_string_like, exception_to_str, \
silent_list, iterable, dedent
-import numpy as np
-from numpy import ma
-
from matplotlib import mpl # pulls in most modules
from matplotlib.dates import date2num, num2date,\
@@ -214,45 +213,38 @@
DayLocator, HourLocator, MinuteLocator, SecondLocator,\
rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, MONTHLY,\
WEEKLY, DAILY, HOURLY, MINUTELY, SECONDLY, relativedelta
-import matplotlib.dates
+import matplotlib.dates # Do we need this at all?
+
# bring all the symbols in so folks can import them from
# pylab in one fell swoop
-from matplotlib.mlab import window_hanning, window_none,\
- conv, detrend, detrend_mean, detrend_none, detrend_linear,\
- polyfit, polyval, entropy, normpdf, griddata,\
- levypdf, find, trapz, prepca, rem, norm, orth, rank,\
- sqrtm, prctile, center_matrix, rk4, exp_safe, amap,\
- sum_flat, mean_flat, rms_flat, l1norm, l2norm, norm, frange,\
- diagonal_matrix, base_repr, binary_repr, log2, ispower2,\
- bivariate_normal, load, save
-from matplotlib.mlab import stineman_interp, slopes, \
- stineman_interp, inside_poly, poly_below, poly_between, \
+## We are still importing too many things from mlab; more cleanup is needed.
+
+from matplotlib.mlab import griddata, stineman_interp, slopes, \
+ inside_poly, poly_below, poly_between, \
is_closed_polygon, path_length, distances_along_curve, vector_lengths
-from numpy import *
-from numpy.fft import *
-from numpy.random import *
-from numpy.linalg import *
-
-from matplotlib.mlab import window_hanning, window_none, conv, detrend, demean, \
+from matplotlib.mlab import window_hanning, window_none, detrend, demean, \
detrend_mean, detrend_none, detrend_linear, entropy, normpdf, levypdf, \
find, longest_contiguous_ones, longest_ones, prepca, prctile, prctile_rank, \
center_matrix, rk4, bivariate_normal, get_xyz_where, get_sparse_matrix, dist, \
dist_point_to_segment, segments_intersect, fftsurr, liaupunov, movavg, \
save, load, exp_safe, \
- amap, rms_flat, l1norm, l2norm, norm_flat, frange, diagonal_matrix, identity, \
- base_repr, binary_repr, log2, ispower2, fromfunction_kw, rem, norm, orth, rank, sqrtm,\
- mfuncC, approx_real, rec_append_field, rec_drop_fields, rec_join, csv2rec, rec2csv, isvector
+ amap, rms_flat, l1norm, l2norm, norm_flat, frange, identity, \
+ base_repr, binary_repr, log2, ispower2, \
+ rec_append_fields, rec_drop_fields, rec_join, csv2rec, rec2csv, isvector
+from numpy import *
+from numpy.fft import *
+from numpy.random import *
+from numpy.linalg import *
-
-
-
from matplotlib.pyplot import *
# provide the recommended module abbrevs in the pylab namespace
import matplotlib.pyplot as plt
import numpy as np
+import numpy.ma as ma
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <he...@us...> - 2009-06-13 21:13:17
|
Revision: 7216
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7216&view=rev
Author: heeres
Date: 2009-06-13 21:13:14 +0000 (Sat, 13 Jun 2009)
Log Message:
-----------
mplot3d: fix Axes3D.grid(), add axes3d.grid to matplotlibrc
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/rcsetup.py
trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py
trunk/matplotlib/matplotlibrc.template
Modified: trunk/matplotlib/lib/matplotlib/rcsetup.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/rcsetup.py 2009-06-13 16:54:31 UTC (rev 7215)
+++ trunk/matplotlib/lib/matplotlib/rcsetup.py 2009-06-13 21:13:14 UTC (rev 7216)
@@ -441,6 +441,7 @@
'axes.unicode_minus' : [True, validate_bool],
'polaraxes.grid' : [True, validate_bool], # display polar grid or not
+ 'axes3d.grid' : [True, validate_bool], # display 3d grid
#legend properties
'legend.fancybox' : [False,validate_bool],
Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2009-06-13 16:54:31 UTC (rev 7215)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2009-06-13 21:13:14 UTC (rev 7216)
@@ -8,7 +8,7 @@
2D matplotlib figure.
"""
-from matplotlib.axes import Axes
+from matplotlib.axes import Axes, rcParams
from matplotlib import cbook
from matplotlib.transforms import Bbox
from matplotlib import collections
@@ -316,6 +316,7 @@
self.figure.canvas.mpl_disconnect(cid)
self.cids = []
Axes.cla(self)
+ self.grid(rcParams['axes3d.grid'])
def _button_press(self, event):
self.button_pressed = event.button
@@ -482,6 +483,12 @@
label.update(kwargs)
return label
+ def grid(self, on=True, **kwargs):
+ '''
+ Set / unset 3D grid.
+ '''
+ self._draw_grid = on
+
def text(self, x, y, z, s, zdir=None):
'''Add text to the plot.'''
text = Axes.text(self, x, y, s)
Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py 2009-06-13 16:54:31 UTC (rev 7215)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py 2009-06-13 21:13:14 UTC (rev 7216)
@@ -43,6 +43,7 @@
tick.tick1line.set_linestyle('-')
tick.tick1line.set_marker('')
tick.tick1line.set_data(tickxs, tickys)
+ tick.gridline.set_data(0, 0)
class Axis(maxis.XAxis):
@@ -143,7 +144,8 @@
# filter locations here so that no extra grid lines are drawn
interval = self.get_view_interval()
- majorLocs = [loc for loc in majorLocs if interval[0] < loc < interval[1]]
+ majorLocs = [loc for loc in majorLocs if \
+ interval[0] < loc < interval[1]]
self.major.formatter.set_locs(majorLocs)
majorLabels = [self.major.formatter(val, i)
for i, val in enumerate(majorLocs)]
@@ -230,9 +232,10 @@
xyz2[i][newindex] = newval
lines = zip(xyz1, xyz0, xyz2)
- self.gridlines.set_segments(lines)
- self.gridlines.set_color([(0.9,0.9,0.9,1)] * len(lines))
- self.gridlines.draw(renderer, project=True)
+ if self.axes._draw_grid:
+ self.gridlines.set_segments(lines)
+ self.gridlines.set_color([(0.9,0.9,0.9,1)] * len(lines))
+ self.gridlines.draw(renderer, project=True)
# Draw ticks
tickdir = info['tickdir']
Modified: trunk/matplotlib/matplotlibrc.template
===================================================================
--- trunk/matplotlib/matplotlibrc.template 2009-06-13 16:54:31 UTC (rev 7215)
+++ trunk/matplotlib/matplotlibrc.template 2009-06-13 21:13:14 UTC (rev 7216)
@@ -210,6 +210,7 @@
# rather than hypen. See http://en.wikipedia.org/wiki/Plus_sign#Plus_sign
#polaraxes.grid : True # display grid on polar axes
+#axes3d.grid : True # display grid on 3d axes
### TICKS
# see http://matplotlib.sourceforge.net/api/axis_api.html#matplotlib.axis.Tick
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-06-13 16:54:38
|
Revision: 7215
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7215&view=rev
Author: leejjoon
Date: 2009-06-13 16:54:31 +0000 (Sat, 13 Jun 2009)
Log Message:
-----------
Introduce a rotation_mode property for the Text artist
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/text.py
Added Paths:
-----------
trunk/matplotlib/examples/pylab_examples/demo_text_rotation_mode.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-06-13 12:09:29 UTC (rev 7214)
+++ trunk/matplotlib/CHANGELOG 2009-06-13 16:54:31 UTC (rev 7215)
@@ -1,3 +1,6 @@
+2009-06-13 Introduce a rotation_mode property for the Text artist. See
+ examples/pylab_examples/demo_text_rotation_mode.py -JJL
+
2009-06-07 add support for bz2 files per sf support request 2794556 -
JDH
Added: trunk/matplotlib/examples/pylab_examples/demo_text_rotation_mode.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/demo_text_rotation_mode.py (rev 0)
+++ trunk/matplotlib/examples/pylab_examples/demo_text_rotation_mode.py 2009-06-13 16:54:31 UTC (rev 7215)
@@ -0,0 +1,45 @@
+
+#clf()
+from mpl_toolkits.axes_grid.axes_grid import AxesGrid
+
+def test_rotation_mode(fig, mode, subplot_location):
+ ha_list = "left center right".split()
+ va_list = "top center baseline bottom".split()
+ grid = AxesGrid(fig, subplot_location,
+ nrows_ncols=(len(va_list), len(ha_list)),
+ share_all=True, aspect=True, #label_mode='1',
+ cbar_mode=None)
+
+ for ha, ax in zip(ha_list, grid.axes_row[-1]):
+ ax.axis["bottom"].label.set_text(ha)
+
+ grid.axes_row[0][1].set_title(mode, size="large")
+
+ for va, ax in zip(va_list, grid.axes_column[0]):
+ ax.axis["left"].label.set_text(va)
+
+ i = 0
+ for va in va_list:
+ for ha in ha_list:
+ ax = grid[i]
+ for axis in ax.axis.values():
+ axis.toggle(ticks=False, ticklabels=False)
+
+ ax.text(0.5, 0.5, "Tpg",
+ size="large", rotation=40,
+ bbox=dict(boxstyle="square,pad=0.",
+ ec="none", fc="0.5", alpha=0.5),
+ ha=ha, va=va,
+ rotation_mode=mode)
+ ax.axvline(0.5)
+ ax.axhline(0.5)
+ i += 1
+
+if 1:
+ import matplotlib.pyplot as plt
+ fig = plt.figure(1, figsize=(5.5,4 ))
+ fig.clf()
+
+ test_rotation_mode(fig, "default", 121)
+ test_rotation_mode(fig, "anchor", 122)
+ plt.show()
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py 2009-06-13 12:09:29 UTC (rev 7214)
+++ trunk/matplotlib/lib/matplotlib/text.py 2009-06-13 16:54:31 UTC (rev 7215)
@@ -69,6 +69,7 @@
name or fontname string eg, ['Sans' | 'Courier' | 'Helvetica' ...]
position (x,y)
rotation [ angle in degrees 'vertical' | 'horizontal'
+ rotation_mode [ None | 'anchor']
size or fontsize [ size in points | relative size eg 'smaller', 'x-large' ]
style or fontstyle [ 'normal' | 'italic' | 'oblique']
text string
@@ -144,6 +145,7 @@
fontproperties=None, # defaults to FontProperties()
rotation=None,
linespacing=None,
+ rotation_mode=None,
**kwargs
):
"""
@@ -175,6 +177,7 @@
if linespacing is None:
linespacing = 1.2 # Maybe use rcParam later.
self._linespacing = linespacing
+ self.set_rotation_mode(rotation_mode)
self.update(kwargs)
#self.set_bbox(dict(pad=0))
@@ -214,6 +217,24 @@
'return the text angle as float in degrees'
return get_rotation(self._rotation) # string_or_number -> number
+ def set_rotation_mode(self, m):
+ """
+ set text rotation mode. If "anchor", the un-rotated text
+ will first aligned according to their *ha* and
+ *va*, and then will be rotated with the alignement
+ reference point as a origin. If None (default), the text will be
+ rotated first then will be aligned.
+ """
+ if m is None or m in ["anchor", "default"]:
+ self._rotation_mode = m
+ else:
+ raise ValueError("Unknown rotation_mode : %s" % repr(m))
+
+ def get_rotation_mode(self):
+ "get text rotation mode"
+ return self._rotation_mode
+
+
def update_from(self, other):
'Copy properties from other to self'
Artist.update_from(self, other)
@@ -268,7 +289,7 @@
# For multiline text, increase the line spacing when the
# text net-height(excluding baseline) is larger than that
# of a "l" (e.g., use of superscripts), which seems
- # what TeX does.
+ # what TeX does.
d_yoffset = max(0, (h-d)-(lp_h-lp_bl))
@@ -315,17 +336,34 @@
halign = self._horizontalalignment
valign = self._verticalalignment
- # compute the text location in display coords and the offsets
- # necessary to align the bbox with that location
- if halign=='center': offsetx = (xmin + width/2.0)
- elif halign=='right': offsetx = (xmin + width)
- else: offsetx = xmin
+ rotation_mode = self.get_rotation_mode()
+ if rotation_mode != "anchor":
+ # compute the text location in display coords and the offsets
+ # necessary to align the bbox with that location
+ if halign=='center': offsetx = (xmin + width/2.0)
+ elif halign=='right': offsetx = (xmin + width)
+ else: offsetx = xmin
- if valign=='center': offsety = (ymin + height/2.0)
- elif valign=='top': offsety = (ymin + height)
- elif valign=='baseline': offsety = (ymin + height) - baseline
- else: offsety = ymin
+ if valign=='center': offsety = (ymin + height/2.0)
+ elif valign=='top': offsety = (ymin + height)
+ elif valign=='baseline': offsety = (ymin + height) - baseline
+ else: offsety = ymin
+ else:
+ xmin1, ymin1 = cornersHoriz[0]
+ xmax1, ymax1 = cornersHoriz[2]
+ if halign=='center': offsetx = (xmin1 + xmax1)/2.0
+ elif halign=='right': offsetx = xmax1
+ else: offsetx = xmin1
+
+ if valign=='center': offsety = (ymin1 + ymax1)/2.0
+ elif valign=='top': offsety = ymax1
+ elif valign=='baseline': offsety = ymax1 - baseline
+ else: offsety = ymin1
+
+ offsetx, offsety = M.transform_point((offsetx, offsety))
+
+
xmin -= offsetx
ymin -= offsety
@@ -1562,8 +1600,8 @@
See :meth:`set_annotation_clip` for the meaning of return values.
"""
return self._annotation_clip
-
+
def update_positions(self, renderer):
"Update the pixel positions of the annotated point and the text."
xy_pixel = self._get_position_xy(renderer)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jo...@us...> - 2009-06-13 12:09:34
|
Revision: 7214
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7214&view=rev
Author: jouni
Date: 2009-06-13 12:09:29 +0000 (Sat, 13 Jun 2009)
Log Message:
-----------
Call current mplot3d demos from backend_driver.py
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-12 19:41:58 UTC (rev 7213)
+++ trunk/matplotlib/examples/tests/backend_driver.py 2009-06-13 12:09:29 UTC (rev 7214)
@@ -243,7 +243,18 @@
mplot3d_dir = os.path.join('..', 'mplot3d')
mplot3d_files = [
- 'demo.py',
+ '2dcollections3d_demo.py',
+ 'bars3d_demo.py',
+ 'contour3d_demo.py',
+ 'contour3d_demo2.py',
+ 'contourf3d_demo.py',
+ 'lines3d_demo.py',
+ 'polys3d_demo.py',
+ 'scatter3d_demo.py',
+ 'surface3d_demo.py',
+ 'surface3d_demo2.py',
+ 'text3d_demo.py',
+ 'wire3d_demo.py',
]
# dict from dir to files we know we don't want to test (eg examples
@@ -273,6 +284,7 @@
report_missing(pylab_dir, pylab_files)
report_missing(api_dir, api_files)
report_missing(units_dir, units_files)
+report_missing(mplot3d_dir, mplot3d_files)
files = (
[os.path.join(api_dir, fname) for fname in api_files] +
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-06-12 19:43:02
|
Revision: 7213
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7213&view=rev
Author: jdh2358
Date: 2009-06-12 19:41:58 +0000 (Fri, 12 Jun 2009)
Log Message:
-----------
readded the long lost IndexFormatter
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/manual_axis.py
trunk/matplotlib/lib/matplotlib/ticker.py
Modified: trunk/matplotlib/examples/pylab_examples/manual_axis.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/manual_axis.py 2009-06-12 13:46:48 UTC (rev 7212)
+++ trunk/matplotlib/examples/pylab_examples/manual_axis.py 2009-06-12 19:41:58 UTC (rev 7213)
@@ -1,10 +1,11 @@
"""
-matplotlib is fairly rigid about how and where it draws it xaxis and
-yaxis, and it is a frequent request to be able to place these in other
-locations. While it is not possible to customize matplotlib's
-internal axis objects in this way, it is not too hard to simply turn
-them off and draw your own axis lines, tick lines, and tick labels
-where and how you want them
+The techniques here are no longer required with the new support for
+spines in matplotlib -- see
+http://matplotlib.sourceforge.net/examples/pylab_examples/spine_placement_demo.html.
+
+This example should be considered deprecated and is left just for demo
+purposes for folks wanting to make a pseudo-axis
+
"""
import numpy as np
Modified: trunk/matplotlib/lib/matplotlib/ticker.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/ticker.py 2009-06-12 13:46:48 UTC (rev 7212)
+++ trunk/matplotlib/lib/matplotlib/ticker.py 2009-06-12 19:41:58 UTC (rev 7213)
@@ -80,6 +80,9 @@
:class:`NullFormatter`
no labels on the ticks
+:class:`IndexFormatter`
+ set the strings from a list of labels
+
:class:`FixedFormatter`
set the strings manually for the labels
@@ -203,6 +206,24 @@
"""
return s
+class IndexFormatter:
+ """
+ format the position x to the nearest i-th label where i=int(x+0.5)
+ """
+ def __init__(self, labels):
+ self.labels = labels
+ self.n = len(labels)
+ def __call__(self, x, pos=None):
+ 'Return the format for tick val x at position pos; pos=None indicated unspecified'
+ i = int(x+0.5)
+ if i<0:
+ return ''
+ elif i>=self.n:
+ return ''
+ else:
+ return self.labels[i]
+
+
class NullFormatter(Formatter):
'Always return the empty string'
def __call__(self, x, pos=None):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|