You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
1
(7) |
2
(2) |
3
(3) |
4
|
5
(6) |
6
(6) |
7
(9) |
8
(6) |
9
(2) |
10
(4) |
11
|
12
(3) |
13
(3) |
14
(5) |
15
|
16
(2) |
17
(2) |
18
|
19
(3) |
20
|
21
(2) |
22
|
23
(2) |
24
(7) |
25
(2) |
26
(1) |
27
(1) |
28
|
29
(1) |
30
|
|
|
|
|
Revision: 7244 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7244&view=rev Author: leejjoon Date: 2009年06月29日 15:11:00 +0000 (2009年6月29日) Log Message: ----------- axes_grid: doc update Modified Paths: -------------- trunk/matplotlib/examples/axes_grid/demo_floating_axis.py trunk/matplotlib/lib/mpl_toolkits/axes_grid/grid_helper_curvelinear.py Added Paths: ----------- trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/axislines.rst Added: trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/axislines.rst =================================================================== --- trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/axislines.rst (rev 0) +++ trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/axislines.rst 2009年06月29日 15:11:00 UTC (rev 7244) @@ -0,0 +1,250 @@ +.. _axislines-manual: + +========= +Axislines +========= + +Axislines includes a derived Axes implementation. The +biggest difference is that the artists responsible to draw axis line, +ticks, ticklabel and axis labels are separated out from the mpl's Axis +class, which are much more than artists in the original +mpl. This change was strongly motivated to support curvlinear +grid. Here are a few things that axes_grid.axislines.Axes is different +from original Axes from mpl. + +* Axis elements (axis line(spine), ticks, ticklabel and axis labels) + are drawn by a AxisArtist instance. Unlike Axis, left, right, top + and bottom axis are drawn by separate artists. And each of them may + have different tick location and different tick labels. + +* gridlines are drawn by a Gridlines instance. The change was + motivated that in curvelinear coordinate, a gridline may not cross + axislines (i.e., no associated ticks). In the original Axes class, + gridlines are tied to ticks. + +* ticklines can be rotated if necessary (i.e, along the gridlines) + +In summary, all these changes was to support + +* a curvelinear grid. +* a floating axis + +.. plot:: mpl_toolkits/axes_grid/figures/demo_floating_axis.py + + +*axes_grid.axislines.Axes* defines a *axis* attribute, which is a +dictionary of AxisArtist instances. By default, the dictionary has 4 +AxisArtist instances, responsible for drawing of left, right, bottom +and top axis. + +xaxis and yaxis attributes are still available, however they are set +to not visible. As separate artists are used for rendering axis, some +axis-related method in mpl may have no effect. +In addition to AxisArtist instances, the axes_grid.axislines.Axes will +have *gridlines* attribute (Gridlines), which obviously draws grid +lines. + +In both AxisArtist and Gridlines, the calculation of tick and grid +location is delegated to an instance of GridHelper class. +axes_grid.axislines.Axes class uses GridHelperRectlinear as a grid +helper. The GridHelperRectlinear class is a wrapper around the *xaxis* +and *yaxis* of mpl's original Axes, and it was meant to work as the +way how mpl's original axes works. For example, tick location changes +using set_ticks method and etc. should work as expected. But change in +artist properties (e.g., color) will not work in general, although +some effort has been made so that some often-change attributes (color, +etc.) are respected. + + +AxisArtist +========== + +AxisArtist can be considered as a container artist with following +attributes which will draw ticks, labels, etc. + + * line + * major_ticks, major_ticklabels + * minor_ticks, minor_ticklabels + * offsetText + * label + + +line +---- + +Derived from Line2d class. Responsible for drawing a spinal(?) line. + +major_ticks, minor_ticks +------------------------ + +Derived from Line2d class. Note that ticks are markers. + + +major_ticklabels, minor_ticklabels +---------------------------------- + +Derived from Text. Note that it is not a list of Text artist, but a +single artist (similar to a collection). + +axislabel +--------- + +Derived from Text. + + +Default AxisArtists +------------------- + +By default, following for axis artists are defined.:: + + ax.axis["left"], ax.axis["bottom"], ax.axis["right"], ax.axis["top"] + +The ticklabels and axislabel of the top and the right axis are set to +not visible. + + +HowTo +===== + +1. Changing tick locations and label. + + Same as the original mpl's axes.:: + + ax.set_xticks([1,2,3]) + +2. Changing axis properties like color, etc. + + Change the properties of appropriate artists. For example, to change + the color of the ticklabels:: + + ax.axis["left"].major_ticklabels.set_color("r") + + +GridHelper +========== + +To actually define a curvelinear coordinate, you have to use your own +grid helper. A generalised version of grid helper class is supplied +and this class should be suffice in most of cases. A user may provide +two functions which defines a transformation (and its inverse pair) +from the curved coordinate to (rectlinear) image coordinate. Note that +while ticks and grids are drawn for curved coordinate, the data +transform of the axes itself (ax.transData) is still rectlinear +(image) coordinate. :: + + + from mpl_toolkits.axes_grid.grid_helper_curvelinear \ + import GridHelperCurveLinear + from mpl_toolkits.axes_grid.axislines import Subplot + + # from curved coordinate to rectlinear coordinate. + def tr(x, y): + x, y = np.asarray(x), np.asarray(y) + return x, y-x + + # from rectlinear coordinate to curved coordinate. + def inv_tr(x,y): + x, y = np.asarray(x), np.asarray(y) + return x, y+x + + + grid_helper = GridHelperCurveLinear((tr, inv_tr)) + + ax1 = Subplot(fig, 1, 1, 1, grid_helper=grid_helper) + + fig.add_subplot(ax1) + + +You may use matplotlib's Transform instance instead (but a +inverse transformation must be defined). Often, coordinate range in a +curved coordinate system may have a limited range, or may have +cycles. In those cases, a more customized version of grid helper is +required. :: + + + import mpl_toolkits.axes_grid.angle_helper as angle_helper + + # PolarAxes.PolarTransform takes radian. However, we want our coordinate + # system in degree + tr = Affine2D().scale(np.pi/180., 1.) + PolarAxes.PolarTransform() + + + # extreme finder : find a range of coordinate. + # 20, 20 : number of sampling points along x, y direction + # The first coordinate (longitude, but theta in polar) + # has a cycle of 360 degree. + # The second coordinate (latitude, but radius in polar) has a minimum of 0 + extreme_finder = angle_helper.ExtremeFinderCycle(20, 20, + lon_cycle = 360, + lat_cycle = None, + lon_minmax = None, + lat_minmax = (0, np.inf), + ) + + # Find a grid values appropriate for the coordinate (degree, + # minute, second). The argument is a approximate number of grids. + grid_locator1 = angle_helper.LocatorDMS(12) + + # And also uses an appropriate formatter. Note that,the + # acceptable Locator and Formatter class is a bit different than + # that of mpl's, and you cannot directly use mpl's Locator and + # Formatter here (but may be possible in the future). + tick_formatter1 = angle_helper.FormatterDMS() + + grid_helper = GridHelperCurveLinear(tr, + extreme_finder=extreme_finder, + grid_locator1=grid_locator1, + tick_formatter1=tick_formatter1 + ) + + +Again, the *transData* of the axes is still a rectlinear coordinate +(image coordinate). You may manually do conversion between two +coordinates, or you may use Parasite Axes for convenience.:: + + ax1 = SubplotHost(fig, 1, 2, 2, grid_helper=grid_helper) + + # A parasite axes with given transform + ax2 = ParasiteAxesAuxTrans(ax1, tr, "equal") + # note that ax2.transData == tr + ax1.transData + # Anthing you draw in ax2 will match the ticks and grids of ax1. + ax1.parasites.append(ax2) + + +.. plot:: mpl_toolkits/axes_grid/figures/demo_curvelinear_grid.py + + + +FloatingAxis +============ + +A floating axis is an axis one of whose data coordinate is fixed, i.e, +its location is not fixed in Axes coordinate but changes as axes data +limits changes. A floating axis can be created using +*new_floating_axis* method. However, it is your responsibility that +the resulting AxisArtist is properly added to the axes. A recommended +way is to add it as an item of Axes's axis attribute.:: + + # floating axis whose first (index starts from 0) coordinate + # (theta) is fixed at 60 + + ax1.axis["lat"] = axis = ax1.new_floating_axis(0, 60) + axis.label.set_text(r"$\theta = 60^{\circ}$") + axis.label.set_visible(True) + + +See the first example of this page. + +Current Limitations and TODO's +============================== + +The code need more refinement. Here is a incomplete list of issues and TODO's + +* No easy way to support a user customized tick location (for + curvelinear grid). A new Locator class needs to be created. + +* FloatingAxis may have coordinate limits, e.g., a floating axis of x + = 0, but y only spans from 0 to 1. + +* The location of axislabel of FloatingAxis needs to be optionally + given as a coordinate value. ex, a floating axis of x=0 with label at y=1 Modified: trunk/matplotlib/examples/axes_grid/demo_floating_axis.py =================================================================== --- trunk/matplotlib/examples/axes_grid/demo_floating_axis.py 2009年06月27日 13:13:50 UTC (rev 7243) +++ trunk/matplotlib/examples/axes_grid/demo_floating_axis.py 2009年06月29日 15:11:00 UTC (rev 7244) @@ -1,6 +1,5 @@ """ -A floating axes for curvelinear grid. -. +An experimental support for curvelinear grid. """ @@ -8,6 +7,7 @@ """ polar projection, but in a rectangular box. """ + global ax1 import numpy as np import mpl_toolkits.axes_grid.angle_helper as angle_helper from matplotlib.projections import PolarAxes @@ -40,19 +40,18 @@ ax1 = SubplotHost(fig, 1, 1, 1, grid_helper=grid_helper) - fig.add_subplot(ax1) # Now creates floating axis - grid_helper = ax1.get_grid_helper() + #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) + ax1.axis["lat"] = axis = ax1.new_floating_axis(0, 60) 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) + ax1.axis["lon"] = axis = ax1.new_floating_axis(1, 6) axis.label.set_text(r"$r = 6$") ax1.set_aspect(1.) Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/grid_helper_curvelinear.py =================================================================== --- trunk/matplotlib/lib/mpl_toolkits/axes_grid/grid_helper_curvelinear.py 2009年06月27日 13:13:50 UTC (rev 7243) +++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/grid_helper_curvelinear.py 2009年06月29日 15:11:00 UTC (rev 7244) @@ -14,7 +14,7 @@ """ Helper class for a fixed axis. """ - + def __init__(self, grid_helper, side, nth_coord_ticks=None): """ nth_coord = along which coordinate value varies. @@ -100,7 +100,7 @@ lon_factor, lon_levs) - grid_info["lat_labels"] = grid_finder.tick_formatter1("bottom", + grid_info["lat_labels"] = grid_finder.tick_formatter2("bottom", lat_factor, lat_levs) @@ -321,7 +321,7 @@ if label_direction is None: label_direction = "top" - + _helper = FloatingAxisArtistHelper(self, nth_coord, value, label_direction=label_direction, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7243 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7243&view=rev Author: jswhit Date: 2009年06月27日 13:13:50 +0000 (2009年6月27日) Log Message: ----------- use np.loadtxt instead of mlab.load Modified Paths: -------------- trunk/toolkits/basemap/examples/plotmap_oo.py Modified: trunk/toolkits/basemap/examples/plotmap_oo.py =================================================================== --- trunk/toolkits/basemap/examples/plotmap_oo.py 2009年06月26日 18:11:32 UTC (rev 7242) +++ trunk/toolkits/basemap/examples/plotmap_oo.py 2009年06月27日 13:13:50 UTC (rev 7243) @@ -14,15 +14,14 @@ from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas from mpl_toolkits.basemap import Basemap, shiftgrid from matplotlib.figure import Figure -import numpy +import numpy as np 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. -topoin = load('etopo20data.gz') -lons = load('etopo20lons.gz') -lats = 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) @@ -59,9 +58,9 @@ m.drawstates() # draw parallels and meridians. # label on left, right and bottom of map. -parallels = numpy.arange(0.,80,20.) +parallels = np.arange(0.,80,20.) m.drawparallels(parallels,labels=[1,1,0,1]) -meridians = numpy.arange(10.,360.,30.) +meridians = np.arange(10.,360.,30.) m.drawmeridians(meridians,labels=[1,1,0,1]) # set title. ax.set_title('ETOPO Topography - Lambert Conformal Conic') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7242 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7242&view=rev Author: jswhit Date: 2009年06月26日 18:11:32 +0000 (2009年6月26日) Log Message: ----------- fix url Modified Paths: -------------- trunk/toolkits/basemap/examples/plotsst.py Modified: trunk/toolkits/basemap/examples/plotsst.py =================================================================== --- trunk/toolkits/basemap/examples/plotsst.py 2009年06月25日 05:17:10 UTC (rev 7241) +++ trunk/toolkits/basemap/examples/plotsst.py 2009年06月26日 18:11:32 UTC (rev 7242) @@ -12,7 +12,7 @@ date = datetime.datetime(int(date[0:4]),int(date[4:6]),int(date[6:8])) print date # open dataset. -dataset = NetCDFFile('http://nomads.ncdc.noaa.gov/thredds/dodsC/oisst/totalAagg') +dataset = NetCDFFile('http://nomads.ncdc.noaa.gov/thredds/dodsC/oisst/totalAgg') # find index of desired time. time = dataset.variables['time'] nt = date2index(date, time, calendar='standard') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7241 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7241&view=rev Author: leejjoon Date: 2009年06月25日 05:17:10 +0000 (2009年6月25日) Log Message: ----------- axes_grid: doc update Modified Paths: -------------- trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/index.rst trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/overview.rst trunk/matplotlib/examples/axes_grid/demo_floating_axis.py trunk/matplotlib/lib/mpl_toolkits/axes_grid/grid_helper_curvelinear.py Modified: trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/index.rst =================================================================== --- trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/index.rst 2009年06月25日 04:57:48 UTC (rev 7240) +++ trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/index.rst 2009年06月25日 05:17:10 UTC (rev 7241) @@ -11,3 +11,4 @@ overview.rst axes_divider.rst + axislines.rst Modified: trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/overview.rst =================================================================== --- trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/overview.rst 2009年06月25日 04:57:48 UTC (rev 7240) +++ trunk/matplotlib/doc/mpl_toolkits/axes_grid/users/overview.rst 2009年06月25日 05:17:10 UTC (rev 7241) @@ -388,3 +388,13 @@ .. plot:: mpl_toolkits/axes_grid/figures/inset_locator_demo2.py :include-source: + +Curvelinear Grid +================ + +You can draw a cuvelinear grid and ticks. Also a floating axis can be +created. See :ref:`axislines-manual` for more details. + +.. plot:: mpl_toolkits/axes_grid/figures/demo_floating_axis.py + + Modified: trunk/matplotlib/examples/axes_grid/demo_floating_axis.py =================================================================== --- trunk/matplotlib/examples/axes_grid/demo_floating_axis.py 2009年06月25日 04:57:48 UTC (rev 7240) +++ trunk/matplotlib/examples/axes_grid/demo_floating_axis.py 2009年06月25日 05:17:10 UTC (rev 7241) @@ -40,9 +40,6 @@ 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) Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/grid_helper_curvelinear.py =================================================================== --- trunk/matplotlib/lib/mpl_toolkits/axes_grid/grid_helper_curvelinear.py 2009年06月25日 04:57:48 UTC (rev 7240) +++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/grid_helper_curvelinear.py 2009年06月25日 05:17:10 UTC (rev 7241) @@ -315,10 +315,13 @@ def new_floating_axis(self, nth_coord, value, tick_direction="in", - label_direction="top", + label_direction=None, axes=None, ): + if label_direction is None: + label_direction = "top" + _helper = FloatingAxisArtistHelper(self, nth_coord, value, label_direction=label_direction, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7240 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7240&view=rev Author: leejjoon Date: 2009年06月25日 04:57:48 +0000 (2009年6月25日) Log Message: ----------- legend supports CircleCollection. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/collections.py trunk/matplotlib/lib/matplotlib/legend.py Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2009年06月24日 21:01:53 UTC (rev 7239) +++ trunk/matplotlib/lib/matplotlib/collections.py 2009年06月25日 04:57:48 UTC (rev 7240) @@ -995,6 +995,10 @@ self._paths = [mpath.Path.unit_circle()] __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd + def get_sizes(self): + "return sizes of circles" + return self._sizes + def draw(self, renderer): # sizes is the area of the circle circumscribing the polygon # in points^2 Modified: trunk/matplotlib/lib/matplotlib/legend.py =================================================================== --- trunk/matplotlib/lib/matplotlib/legend.py 2009年06月24日 21:01:53 UTC (rev 7239) +++ trunk/matplotlib/lib/matplotlib/legend.py 2009年06月25日 04:57:48 UTC (rev 7240) @@ -31,7 +31,8 @@ from matplotlib.font_manager import FontProperties from matplotlib.lines import Line2D from matplotlib.patches import Patch, Rectangle, Shadow, FancyBboxPatch -from matplotlib.collections import LineCollection, RegularPolyCollection +from matplotlib.collections import LineCollection, RegularPolyCollection, \ + CircleCollection from matplotlib.transforms import Bbox, BboxBase, TransformedBbox, BboxTransformTo from matplotlib.offsetbox import HPacker, VPacker, TextArea, DrawingArea @@ -439,7 +440,8 @@ # manually set their transform to the self.get_transform(). for handle in handles: - if isinstance(handle, RegularPolyCollection): + if isinstance(handle, RegularPolyCollection) or \ + isinstance(handle, CircleCollection): npoints = self.scatterpoints else: npoints = self.numpoints @@ -531,6 +533,31 @@ p.set_clip_path(None) handle_list.append(p) + elif isinstance(handle, CircleCollection): + + ydata = height*self._scatteryoffsets + + size_max, size_min = max(handle.get_sizes()),\ + min(handle.get_sizes()) + # we may need to scale these sizes by "markerscale" + # attribute. But other handle types does not seem + # to care about this attribute and it is currently ignored. + if self.scatterpoints < 4: + sizes = [.5*(size_max+size_min), size_max, + size_min] + else: + sizes = (size_max-size_min)*np.linspace(0,1,self.scatterpoints)+size_min + + p = type(handle)(sizes, + offsets=zip(xdata_marker,ydata), + transOffset=self.get_transform(), + ) + + p.update_from(handle) + p.set_figure(self.figure) + p.set_clip_box(None) + p.set_clip_path(None) + handle_list.append(p) else: handle_list.append(None) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7239 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7239&view=rev Author: jdh2358 Date: 2009年06月24日 21:01:53 +0000 (2009年6月24日) Log Message: ----------- some tweaks to csv2rec and rec2csv Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/doc/api/api_changes.rst trunk/matplotlib/doc/devel/release_guide.rst trunk/matplotlib/lib/matplotlib/mlab.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009年06月24日 18:53:48 UTC (rev 7238) +++ trunk/matplotlib/CHANGELOG 2009年06月24日 21:01:53 UTC (rev 7239) @@ -1,3 +1,8 @@ +2009年06月24日 Add withheader option to mlab.rec2csv and changed + use_mrecords default to False in mlab.csv2rec since this is + partially broken - JDH + + 2009年06月24日 backend_agg.draw_marker quantizes the main path (as in the draw_path). - JJL Modified: trunk/matplotlib/doc/api/api_changes.rst =================================================================== --- trunk/matplotlib/doc/api/api_changes.rst 2009年06月24日 18:53:48 UTC (rev 7238) +++ trunk/matplotlib/doc/api/api_changes.rst 2009年06月24日 21:01:53 UTC (rev 7239) @@ -1,3 +1,4 @@ + =========== API Changes =========== @@ -20,7 +21,10 @@ Changes beyond 0.98.x ===================== -* Axes instanaces no longer have a "frame" attribute. Instead, use the +* changed use_mrecords default to False in mlab.csv2rec since this is + partially broken + +* Axes instances no longer have a "frame" attribute. Instead, use the new "spines" attribute. Spines is a dictionary where the keys are the names of the spines (e.g. 'left','right' and so on) and the values are the artists that draw the spines. For normal Modified: trunk/matplotlib/doc/devel/release_guide.rst =================================================================== --- trunk/matplotlib/doc/devel/release_guide.rst 2009年06月24日 18:53:48 UTC (rev 7238) +++ trunk/matplotlib/doc/devel/release_guide.rst 2009年06月24日 21:01:53 UTC (rev 7239) @@ -64,16 +64,18 @@ or off any platform specific build options you need. Importantly, you also need to make sure that you delete the :file:`build` dir after any changes to file:`setup.cfg` before rebuilding since cruft - in the :file:`build` dir can get carried along. I will add this to - the devel release notes, + in the :file:`build` dir can get carried along. * on windows, unix2dos the rc file * We have a Makefile for the OS X builds in the mpl source dir :file:`release/osx`, so use this to prepare the OS X releases. +* We have a Makefile for the win32 mingw builds in the mpl source dir + :file:`release/win32` which you can use this to prepare the windows + releases, but this is currently broken for python2.6 as described at + http://www.nabble.com/binary-installers-for-python2.6--libpng-segfault%2C-MSVCR90.DLL-and-%09mingw-td23971661.html - .. _release-candidate-testing: Release candidate testing: Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2009年06月24日 18:53:48 UTC (rev 7238) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2009年06月24日 21:01:53 UTC (rev 7239) @@ -2052,7 +2052,7 @@ def csv2rec(fname, comments='#', skiprows=0, checkrows=0, delimiter=',', converterd=None, names=None, missing='', missingd=None, - use_mrecords=True): + use_mrecords=False): """ Load data from comma/space/tab delimited file in *fname* into a numpy record array and return the record array. @@ -2560,7 +2560,7 @@ def rec2csv(r, fname, delimiter=',', formatd=None, missing='', - missingd=None): + missingd=None, withheader=True): """ Save the data from numpy recarray *r* into a comma-/space-/tab-delimited file. The record array dtype names @@ -2569,6 +2569,9 @@ *fname*: can be a filename or a file handle. Support for gzipped files is automatic, if the filename ends in '.gz' + *withheader*: if withheader is False, do not write the attribute + names in the first row + .. seealso:: :func:`csv2rec` @@ -2595,7 +2598,8 @@ fh, opened = cbook.to_filehandle(fname, 'w', return_opened=True) writer = csv.writer(fh, delimiter=delimiter) header = r.dtype.names - writer.writerow(header) + if withheader: + writer.writerow(header) # Our list of specials for missing values mvals = [] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7238 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7238&view=rev Author: jswhit Date: 2009年06月24日 18:53:48 +0000 (2009年6月24日) Log Message: ----------- add code to import pyplot as necessary 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:18:55 UTC (rev 7237) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2009年06月24日 18:53:48 UTC (rev 7238) @@ -2543,6 +2543,9 @@ Other \**kwargs passed on to matplotlib.pyplot.scatter. """ ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt # allow callers to override the hold state by passing hold=True|False b = ax.ishold() h = kwargs.pop('hold',None) @@ -2611,6 +2614,9 @@ returns an matplotlib.image.AxesImage instance. """ ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt kwargs['extent']=(self.llcrnrx,self.urcrnrx,self.llcrnry,self.urcrnry) # use origin='lower', unless overridden. if not kwargs.has_key('origin'): @@ -2653,6 +2659,9 @@ Other \**kwargs passed on to matplotlib.pyplot.pcolor. """ ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt # 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) @@ -2691,6 +2700,9 @@ Other \**kwargs passed on to matplotlib.pyplot.pcolormesh. """ ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt # allow callers to override the hold state by passing hold=True|False b = ax.ishold() h = kwargs.pop('hold',None) @@ -2725,6 +2737,9 @@ Other \*args and \**kwargs passed on to matplotlib.pyplot.contour. """ ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt # make sure x is monotonically increasing - if not, # print warning suggesting that the data be shifted in longitude # with the shiftgrid function. @@ -2789,6 +2804,9 @@ Other \*args and \**kwargs passed on to matplotlib.pyplot.scatter. """ ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt # make sure x is monotonically increasing - if not, # print warning suggesting that the data be shifted in longitude # with the shiftgrid function. @@ -2850,6 +2868,9 @@ Other \*args and \**kwargs passed on to matplotlib.pyplot.quiver. """ ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt # allow callers to override the hold state by passing hold=True|False b = ax.ishold() h = kwargs.pop('hold',None) @@ -2887,6 +2908,9 @@ you have %s""" % _matplotlib_version) raise NotImplementedError(msg) ax = kwargs.pop('ax', None) or self._check_ax() + # if ax kwarg not supplied, and ax attribute not set, import pyplot. + if self.ax is None and kwargs.pop('ax', None) is None: + import matplotlib.pyplot as plt # allow callers to override the hold state by passing hold=True|False b = ax.ishold() h = kwargs.pop('hold',None) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7237 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7237&view=rev Author: jswhit Date: 2009年06月24日 18:18:55 +0000 (2009年6月24日) 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.
Revision: 7236 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7236&view=rev Author: jswhit Date: 2009年06月24日 18:11:30 +0000 (2009年6月24日) 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.
Revision: 7235 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7235&view=rev Author: leejjoon Date: 2009年06月24日 05:51:52 +0000 (2009年6月24日) 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.
Revision: 7234 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7234&view=rev Author: leejjoon Date: 2009年06月24日 05:49:37 +0000 (2009年6月24日) 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.
Revision: 7233 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7233&view=rev Author: leejjoon Date: 2009年06月24日 05:46:08 +0000 (2009年6月24日) 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]
Revision: 7231 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7231&view=rev Author: jswhit Date: 2009年06月23日 12:39:21 +0000 (2009年6月23日) 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.
Revision: 7232 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7232&view=rev Author: jswhit Date: 2009年06月23日 12:47:49 +0000 (2009年6月23日) 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.
Revision: 7230 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7230&view=rev Author: leejjoon Date: 2009年06月21日 18:53:49 +0000 (2009年6月21日) 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 (2009年6月21日) | 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.
Revision: 7229 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7229&view=rev Author: leejjoon Date: 2009年06月21日 18:44:53 +0000 (2009年6月21日) 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.
Revision: 7228 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7228&view=rev Author: leejjoon Date: 2009年06月19日 04:49:38 +0000 (2009年6月19日) 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 (2009年6月19日) | 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.
Revision: 7227 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7227&view=rev Author: leejjoon Date: 2009年06月19日 04:39:24 +0000 (2009年6月19日) 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.
Revision: 7226 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7226&view=rev Author: leejjoon Date: 2009年06月19日 04:33:44 +0000 (2009年6月19日) 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.
Revision: 7225 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7225&view=rev Author: jswhit Date: 2009年06月17日 02:18:39 +0000 (2009年6月17日) 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.
Revision: 7224 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7224&view=rev Author: jswhit Date: 2009年06月17日 02:06:27 +0000 (2009年6月17日) 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.
Revision: 7223 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7223&view=rev Author: jswhit Date: 2009年06月16日 18:31:57 +0000 (2009年6月16日) 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.
Revision: 7222 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7222&view=rev Author: heeres Date: 2009年06月16日 09:12:08 +0000 (2009年6月16日) 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.
Revision: 7221 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7221&view=rev Author: jdh2358 Date: 2009年06月14日 17:38:12 +0000 (2009年6月14日) 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.
Revision: 7220 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7220&view=rev Author: jdh2358 Date: 2009年06月14日 17:34:40 +0000 (2009年6月14日) 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.