SourceForge logo
SourceForge logo
Menu

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

You can subscribe to this list here.

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


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



Showing results of 126

1 2 3 .. 6 > >> (Page 1 of 6)
From: <ef...@us...> - 2010年06月30日 21:14:40
Revision: 8480
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8480&view=rev
Author: efiring
Date: 2010年06月30日 21:14:31 +0000 (2010年6月30日)
Log Message:
-----------
doc changes for last commit
Modified Paths:
--------------
 trunk/matplotlib/CHANGELOG
 trunk/matplotlib/doc/api/api_changes.rst
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG	2010年06月30日 21:07:36 UTC (rev 8479)
+++ trunk/matplotlib/CHANGELOG	2010年06月30日 21:14:31 UTC (rev 8480)
@@ -1,3 +1,11 @@
+2010年06月30日 Added autoscale convenience method and corresponding
+ pyplot function for simplified control of autoscaling;
+ and changed axis, set_xlim, and set_ylim so that by
+ default, they turn off the autoscaling on the relevent
+ axis or axes. Therefore one can call set_xlim before
+ plotting a line, for example, and the limits will be
+ retained. - EF
+
 2010年06月20日 Added Axes.tick_params and corresponding pyplot function
 to control tick and tick label appearance after an Axes
 has been created. - EF
Modified: trunk/matplotlib/doc/api/api_changes.rst
===================================================================
--- trunk/matplotlib/doc/api/api_changes.rst	2010年06月30日 21:07:36 UTC (rev 8479)
+++ trunk/matplotlib/doc/api/api_changes.rst	2010年06月30日 21:14:31 UTC (rev 8480)
@@ -10,11 +10,22 @@
 Changes beyond 0.99.x
 =====================
 
-* There are four new Axes methods with corresponding pyplot
+* The default behavior of :meth:`matplotlib.axes.Axes.set_xlim`,
+ :meth:`matplotlib.axes.Axes.set_ylim`, and
+ :meth:`matplotlib.axes.Axes.axis`, and their corresponding
+ pyplot functions, has been changed: when view limits are
+ set explicitly with one of these methods, autoscaling is turned
+ off for the matching axis. A new *auto* kwarg is available to
+ control this behavior.
+
+* There are five new Axes methods with corresponding pyplot
 functions to facilitate autoscaling, tick location, and tick
 label formatting, and the general appearance of ticks and
 tick labels:
 
+ + :meth:`matplotlib.axes.Axes.autoscale` turns autoscaling
+ on or off, and applies it.
+
 + :meth:`matplotlib.axes.Axes.margins` sets margins used to
 autoscale the :attr:`matplotlib.axes.Axes.viewLim` based on
 the :attr:`matplotlib.axes.Axes.dataLim`.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2010年06月30日 21:07:43
Revision: 8479
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8479&view=rev
Author: efiring
Date: 2010年06月30日 21:07:36 +0000 (2010年6月30日)
Log Message:
-----------
set_xlim, set_ylim: turn off autoscaling; added autoscale method
Modified Paths:
--------------
 trunk/matplotlib/boilerplate.py
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/lib/matplotlib/blocking_input.py
 trunk/matplotlib/lib/matplotlib/image.py
 trunk/matplotlib/lib/matplotlib/projections/polar.py
 trunk/matplotlib/lib/matplotlib/pylab.py
 trunk/matplotlib/lib/matplotlib/pyplot.py
 trunk/matplotlib/lib/matplotlib/tests/test_dates.py
 trunk/matplotlib/lib/matplotlib/widgets.py
 trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
Modified: trunk/matplotlib/boilerplate.py
===================================================================
--- trunk/matplotlib/boilerplate.py	2010年06月30日 16:31:23 UTC (rev 8478)
+++ trunk/matplotlib/boilerplate.py	2010年06月30日 21:07:36 UTC (rev 8479)
@@ -109,6 +109,7 @@
 'locator_params',
 'tick_params',
 'margins',
+ 'autoscale',
 )
 
 cmappable = {
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2010年06月30日 16:31:23 UTC (rev 8478)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2010年06月30日 21:07:36 UTC (rev 8479)
@@ -1715,7 +1715,46 @@
 """
 return self._rasterization_zorder
 
+ def autoscale(self, enable=True, axis='both', tight=None):
+ """
+ Convenience method for simple axis view autoscaling.
+ It turns autoscaling on or off, and then,
+ if autoscaling for either axis is on, it performs
+ the autoscaling on the specified axis or axes.
 
+ *enable*: [True | False | None]
+ True (default) turns autoscaling on, False turns it off.
+ None leaves the autoscaling state unchanged.
+
+ *axis*: ['x' | 'y' | 'both']
+ which axis to operate on; default is 'both'
+
+ *tight*: [True | False | None]
+ If True, set view limits to data limits;
+ if False, let the locator and margins expand the view limits;
+ if None, use tight scaling if the only artist is an image,
+ otherwise treat *tight* as False.
+ The *tight* setting is retained for future autoscaling
+ until it is explicitly changed.
+
+
+ Returns None.
+ """
+ if enable is None:
+ scalex = True
+ scaley = True
+ else:
+ scalex = False
+ scaley = False
+ if axis in ['x', 'both']:
+ self._autoscaleXon = bool(enable)
+ scalex = self._autoscaleXon
+ if axis in ['y', 'both']:
+ self._autoscaleYon = bool(enable)
+ scaley = self._autoscaleYon
+ self.autoscale_view(tight=tight, scalex=scalex, scaley=scaley)
+
+
 def autoscale_view(self, tight=None, scalex=True, scaley=True):
 """
 autoscale the view limits using the data limits. You can
@@ -2209,7 +2248,7 @@
 def invert_xaxis(self):
 "Invert the x-axis."
 left, right = self.get_xlim()
- self.set_xlim(right, left)
+ self.viewLim.intervalx = (right, left)
 
 def xaxis_inverted(self):
 'Returns True if the x-axis is inverted.'
@@ -2233,6 +2272,7 @@
 """
 Set the lower and upper numerical bounds of the x-axis.
 This method will honor axes inversion regardless of parameter order.
+ It will not change the _autoscaleXon attribute.
 """
 if upper is None and iterable(lower):
 lower,upper = lower
@@ -2244,14 +2284,14 @@
 
 if self.xaxis_inverted():
 if lower < upper:
- self.set_xlim(upper, lower)
+ self.set_xlim(upper, lower, auto=None)
 else:
- self.set_xlim(lower, upper)
+ self.set_xlim(lower, upper, auto=None)
 else:
 if lower < upper:
- self.set_xlim(lower, upper)
+ self.set_xlim(lower, upper, auto=None)
 else:
- self.set_xlim(upper, lower)
+ self.set_xlim(upper, lower, auto=None)
 
 def get_xlim(self):
 """
@@ -2259,32 +2299,45 @@
 """
 return tuple(self.viewLim.intervalx)
 
- def set_xlim(self, xmin=None, xmax=None, emit=True, **kwargs):
+ def set_xlim(self, xmin=None, xmax=None, emit=True, auto=False):
 """
 call signature::
 
- set_xlim(self, *args, **kwargs)
+ set_xlim(self, *args, **kwargs):
 
- Set the limits for the xaxis
+ Set the data limits for the xaxis
 
- Returns the current xlimits as a length 2 tuple: [*xmin*, *xmax*]
-
 Examples::
 
- set_xlim((valmin, valmax))
- set_xlim(valmin, valmax)
- set_xlim(xmin=1) # xmax unchanged
- set_xlim(xmax=1) # xmin unchanged
+ set_xlim((left, right))
+ set_xlim(left, right)
+ set_xlim(xmin=1) # right unchanged
+ set_xlim(xmax=1) # left unchanged
 
 Keyword arguments:
 
 *xmin*: scalar
- the min of the ylim
+ the left xlim
 *xmax*: scalar
- the max of the ylim
+ the right xlim
 *emit*: [ True | False ]
 notify observers of lim change
+ *auto*: [ True | False | None ]
+ turn *x* autoscaling on (True), off (False; default),
+ or leave unchanged (None)
 
+ Note: the kwarg terminology may be confusing. The first value,
+ *xmin*, is the left, and the second, *xmax*, is the right.
+ For example, suppose *x* is years before present.
+ Then one might use::
+
+ set_ylim(5000, 0)
+
+ so 5000 years ago is on the left of the plot and the
+ present is on the right.
+
+ Returns the current xlimits as a length 2 tuple
+
 ACCEPTS: len(2) sequence of floats
 """
 if xmax is None and iterable(xmin):
@@ -2307,6 +2360,8 @@
 xmin, xmax = self.xaxis.limit_range_for_scale(xmin, xmax)
 
 self.viewLim.intervalx = (xmin, xmax)
+ if auto is not None:
+ self._autoscaleXon = bool(auto)
 
 if emit:
 self.callbacks.process('xlim_changed', self)
@@ -2391,25 +2446,26 @@
 
 def invert_yaxis(self):
 "Invert the y-axis."
- left, right = self.get_ylim()
- self.set_ylim(right, left)
+ bottom, top = self.get_ylim()
+ self.viewLim.intervaly = (top, bottom)
 
 def yaxis_inverted(self):
 'Returns True if the y-axis is inverted.'
- left, right = self.get_ylim()
- return right < left
+ bottom, top = self.get_ylim()
+ return top < bottom
 
 def get_ybound(self):
 "Return y-axis numerical bounds in the form of lowerBound < upperBound"
- left, right = self.get_ylim()
- if left < right:
- return left, right
+ bottom, top = self.get_ylim()
+ if bottom < top:
+ return bottom, top
 else:
- return right, left
+ return top, bottom
 
 def set_ybound(self, lower=None, upper=None):
 """Set the lower and upper numerical bounds of the y-axis.
 This method will honor axes inversion regardless of parameter order.
+ It will not change the _autoscaleYon attribute.
 """
 if upper is None and iterable(lower):
 lower,upper = lower
@@ -2421,14 +2477,14 @@
 
 if self.yaxis_inverted():
 if lower < upper:
- self.set_ylim(upper, lower)
+ self.set_ylim(upper, lower, auto=None)
 else:
- self.set_ylim(lower, upper)
+ self.set_ylim(lower, upper, auto=None)
 else:
 if lower < upper:
- self.set_ylim(lower, upper)
+ self.set_ylim(lower, upper, auto=None)
 else:
- self.set_ylim(upper, lower)
+ self.set_ylim(upper, lower, auto=None)
 
 def get_ylim(self):
 """
@@ -2436,28 +2492,43 @@
 """
 return tuple(self.viewLim.intervaly)
 
- def set_ylim(self, ymin=None, ymax=None, emit=True, **kwargs):
+ def set_ylim(self, ymin=None, ymax=None, emit=True, auto=False):
 """
 call signature::
 
 set_ylim(self, *args, **kwargs):
 
- Set the limits for the yaxis; v = [ymin, ymax]::
+ Set the data limits for the yaxis
 
- set_ylim((valmin, valmax))
- set_ylim(valmin, valmax)
- set_ylim(ymin=1) # ymax unchanged
- set_ylim(ymax=1) # ymin unchanged
+ Examples::
 
+ set_ylim((bottom, top))
+ set_ylim(bottom, top)
+ set_ylim(ymin=1) # top unchanged
+ set_ylim(ymax=1) # bottom unchanged
+
 Keyword arguments:
 
 *ymin*: scalar
- the min of the ylim
+ the bottom ylim
 *ymax*: scalar
- the max of the ylim
+ the top ylim
 *emit*: [ True | False ]
 notify observers of lim change
+ *auto*: [ True | False | None ]
+ turn *y* autoscaling on (True), off (False; default),
+ or leave unchanged (None)
 
+ Note: the kwarg terminology may be confusing. The first value,
+ *ymin*, is the bottom, and the second, *ymax*, is the top.
+ For example, suppose *y* is depth in the ocean.
+ Then one might use::
+
+ set_ylim(5000, 0)
+
+ so 5000 m depth is at the bottom of the plot and the
+ surface, 0 m, is at the top.
+
 Returns the current ylimits as a length 2 tuple
 
 ACCEPTS: len(2) sequence of floats
@@ -2480,7 +2551,10 @@
 
 ymin, ymax = mtransforms.nonsingular(ymin, ymax, increasing=False)
 ymin, ymax = self.yaxis.limit_range_for_scale(ymin, ymax)
+
 self.viewLim.intervaly = (ymin, ymax)
+ if auto is not None:
+ self._autoscaleYon = bool(auto)
 
 if emit:
 self.callbacks.process('ylim_changed', self)
@@ -6647,14 +6721,10 @@
 im.autoscale_None()
 im.set_url(url)
 
- xmin, xmax, ymin, ymax = im.get_extent()
+ # update ax.dataLim, and, if autoscaling, set viewLim
+ # to tightly fit the image, regardless of dataLim.
+ im.set_extent(im.get_extent())
 
- corners = (xmin, ymin), (xmax, ymax)
- self.update_datalim(corners)
- if self._autoscaleXon:
- self.set_xlim((xmin, xmax))
- if self._autoscaleYon:
- self.set_ylim((ymin, ymax))
 self.images.append(im)
 im._remove_method = lambda h: self.images.remove(h)
 
Modified: trunk/matplotlib/lib/matplotlib/blocking_input.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/blocking_input.py	2010年06月30日 16:31:23 UTC (rev 8478)
+++ trunk/matplotlib/lib/matplotlib/blocking_input.py	2010年06月30日 21:07:36 UTC (rev 8479)
@@ -19,6 +19,7 @@
 
 from matplotlib import path, verbose
 from matplotlib.cbook import is_sequence_of_strings
+import matplotlib.lines as mlines
 
 class BlockingInput(object):
 """
@@ -222,18 +223,10 @@
 
 # If desired plot up click
 if self.show_clicks:
-
- # make sure we don't mess with the axes zoom
- xlim = event.inaxes.get_xlim()
- ylim = event.inaxes.get_ylim()
-
- # plot the clicks
- self.marks.extend(
- event.inaxes.plot([event.xdata,], [event.ydata,], 'r+') )
-
- # before we draw, make sure to reset the limits
- event.inaxes.set_xlim(xlim)
- event.inaxes.set_ylim(ylim)
+ line = mlines.Line2D([event.xdata], [event.ydata],
+ marker='+', color='r')
+ event.inaxes.add_line(line)
+ self.marks.append(line)
 self.fig.canvas.draw()
 
 
@@ -247,16 +240,9 @@
 
 if self.show_clicks:
 
- # make sure we don't mess with the axes zoom
- xlim = event.inaxes.get_xlim()
- ylim = event.inaxes.get_ylim()
-
 mark = self.marks.pop(index)
 mark.remove()
 
- # before we draw, make sure to reset the limits
- event.inaxes.set_xlim(xlim)
- event.inaxes.set_ylim(ylim)
 self.fig.canvas.draw()
 # NOTE: I do NOT understand why the above 3 lines does not work
 # for the keyboard backspace event on windows XP wxAgg.
@@ -275,20 +261,11 @@
 def cleanup(self,event=None):
 # clean the figure
 if self.show_clicks:
- if event:
- # make sure we don't mess with the axes zoom
- xlim = event.inaxes.get_xlim()
- ylim = event.inaxes.get_ylim()
 
 for mark in self.marks:
 mark.remove()
 self.marks = []
 
- if event:
- # before we draw, make sure to reset the limits
- event.inaxes.set_xlim(xlim)
- event.inaxes.set_ylim(ylim)
-
 self.fig.canvas.draw()
 
 # Call base class to remove callbacks
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py	2010年06月30日 16:31:23 UTC (rev 8478)
+++ trunk/matplotlib/lib/matplotlib/image.py	2010年06月30日 21:07:36 UTC (rev 8479)
@@ -605,6 +605,12 @@
 def set_extent(self, extent):
 """
 extent is data axes (left, right, bottom, top) for making image plots
+
+ This updates ax.dataLim, and, if autoscaling, sets viewLim
+ to tightly fit the image, regardless of dataLim. Autoscaling
+ state is not changed, so following this with ax.autoscale_view
+ will redo the autoscaling in accord with dataLim.
+
 """
 self._extent = extent
 
@@ -612,9 +618,9 @@
 corners = (xmin, ymin), (xmax, ymax)
 self.axes.update_datalim(corners)
 if self.axes._autoscaleXon:
- self.axes.set_xlim((xmin, xmax))
+ self.axes.set_xlim((xmin, xmax), auto=None)
 if self.axes._autoscaleYon:
- self.axes.set_ylim((ymin, ymax))
+ self.axes.set_ylim((ymin, ymax), auto=None)
 
 def get_extent(self):
 'get the image extent: left, right, bottom, top'
Modified: trunk/matplotlib/lib/matplotlib/projections/polar.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/projections/polar.py	2010年06月30日 16:31:23 UTC (rev 8478)
+++ trunk/matplotlib/lib/matplotlib/projections/polar.py	2010年06月30日 21:07:36 UTC (rev 8479)
@@ -336,12 +336,13 @@
 def get_rmin(self):
 return self.viewLim.ymin
 
- def set_rlim(self, rmin=None, rmax=None):
- self.viewLim.y0 = rmin
- self.viewLim.y1 = rmax
+ def set_rlim(self, *args, **kwargs):
+ if 'rmin' in kwargs:
+ kwargs['ymin'] = kwargs.pop('rmin')
+ if 'rmax' in kwargs:
+ kwargs['ymax'] = kwargs.pop('rmax')
+ return self.set_ylim(*args, **kwargs)
 
- set_ylim = set_rlim
-
 def set_yscale(self, *args, **kwargs):
 Axes.set_yscale(self, *args, **kwargs)
 self.yaxis.set_major_locator(
Modified: trunk/matplotlib/lib/matplotlib/pylab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pylab.py	2010年06月30日 16:31:23 UTC (rev 8478)
+++ trunk/matplotlib/lib/matplotlib/pylab.py	2010年06月30日 21:07:36 UTC (rev 8479)
@@ -17,6 +17,7 @@
 axhspan - draw a horizontal bar across axes
 axvspan - draw a vertical bar across axes
 axis - Set or return the current axis limits
+ autoscale - turn axis autoscaling on or off, and apply it
 bar - make a bar chart
 barh - a horizontal bar chart
 broken_barh - a set of horizontal bars with gaps
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py	2010年06月30日 16:31:23 UTC (rev 8478)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py	2010年06月30日 21:07:36 UTC (rev 8479)
@@ -2132,7 +2132,7 @@
 # This function was autogenerated by boilerplate.py. Do not edit as
 # changes will be lost
 @autogen_docstring(Axes.hexbin)
-def hexbin(x, y, C=None, gridsize=100, bins=None, xscale='linear', yscale='linear', extent=None, cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, edgecolors='none', reduce_C_function=np.mean, mincnt=None, marginals=False, hold=None, **kwargs):
+def hexbin(x, y, C=None, gridsize=100, bins=None, xscale='linear', yscale='linear', extent=None, cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, edgecolors='none', reduce_C_function=np.mean, mincnt=None, marginals=False, hold=None, **kwargs):
 ax = gca()
 # allow callers to override the hold state by passing hold=True|False
 washold = ax.ishold()
@@ -2186,7 +2186,7 @@
 # This function was autogenerated by boilerplate.py. Do not edit as
 # changes will be lost
 @autogen_docstring(Axes.imshow)
-def imshow(X, cmap=None, norm=None, aspect=None, interpolation=None, alpha=1.0, vmin=None, vmax=None, origin=None, extent=None, shape=None, filternorm=1, filterrad=4.0, imlim=None, resample=None, url=None, hold=None, **kwargs):
+def imshow(X, cmap=None, norm=None, aspect=None, interpolation=None, alpha=None, vmin=None, vmax=None, origin=None, extent=None, shape=None, filternorm=1, filterrad=4.0, imlim=None, resample=None, url=None, hold=None, **kwargs):
 ax = gca()
 # allow callers to override the hold state by passing hold=True|False
 washold = ax.ishold()
@@ -2366,7 +2366,7 @@
 # This function was autogenerated by boilerplate.py. Do not edit as
 # changes will be lost
 @autogen_docstring(Axes.scatter)
-def scatter(x, y, s=20, c='b', marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=1.0, linewidths=None, faceted=True, verts=None, hold=None, **kwargs):
+def scatter(x, y, s=20, c='b', marker='o', cmap=None, norm=None, vmin=None, vmax=None, alpha=None, linewidths=None, faceted=True, verts=None, hold=None, **kwargs):
 ax = gca()
 # allow callers to override the hold state by passing hold=True|False
 washold = ax.ishold()
@@ -2608,8 +2608,8 @@
 # This function was autogenerated by boilerplate.py. Do not edit as
 # changes will be lost
 @docstring.copy_dedent(Axes.grid)
-def grid(b=None, **kwargs):
- ret = gca().grid(b, **kwargs)
+def grid(b=None, which='major', **kwargs):
+ ret = gca().grid(b, which, **kwargs)
 draw_if_interactive()
 return ret
 
@@ -2679,6 +2679,14 @@
 
 # This function was autogenerated by boilerplate.py. Do not edit as
 # changes will be lost
+...@do...py_dedent(Axes.autoscale)
+def autoscale(enable=True, axis='both', tight=None):
+ ret = gca().autoscale(enable, axis, tight)
+ draw_if_interactive()
+ return ret
+
+# This function was autogenerated by boilerplate.py. Do not edit as
+# changes will be lost
 def autumn():
 '''
 set the default colormap to autumn and apply to current image if any.
@@ -2902,4 +2910,3 @@
 draw_if_interactive()
 
 
-
Modified: trunk/matplotlib/lib/matplotlib/tests/test_dates.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/tests/test_dates.py	2010年06月30日 16:31:23 UTC (rev 8478)
+++ trunk/matplotlib/lib/matplotlib/tests/test_dates.py	2010年06月30日 21:07:36 UTC (rev 8479)
@@ -77,7 +77,7 @@
 tf = datetime.datetime(2000, 1, 20)
 fig = plt.figure()
 ax = fig.add_subplot(1,1,1)
- ax.set_xlim((t0,tf))
+ ax.set_xlim((t0,tf), auto=True)
 ax.plot([],[])
 from matplotlib.dates import DayLocator, DateFormatter, HourLocator
 ax.xaxis.set_major_locator(DayLocator())
Modified: trunk/matplotlib/lib/matplotlib/widgets.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/widgets.py	2010年06月30日 16:31:23 UTC (rev 8478)
+++ trunk/matplotlib/lib/matplotlib/widgets.py	2010年06月30日 21:07:36 UTC (rev 8479)
@@ -131,7 +131,7 @@
 event.canvas.release_mouse(self.ax)
 if not self.eventson:
 return
- if event.inaxes != self.ax: 
+ if event.inaxes != self.ax:
 return
 for cid, func in self.observers.items():
 func(event)
@@ -253,10 +253,10 @@
 self.drag_active = True
 event.canvas.grab_mouse(self.ax)
 
- if not self.drag_active: 
+ if not self.drag_active:
 return
- 
- elif ((event.name == 'button_release_event') 
+
+ elif ((event.name == 'button_release_event')
 or (event.name == 'button_press_event' and event.inaxes != self.ax)):
 self.drag_active = False
 event.canvas.release_mouse(self.ax)
@@ -1134,7 +1134,7 @@
 self.validButtons = button
 elif isinstance(button, int):
 self.validButtons = [button]
- 
+
 assert(spancoords in ('data', 'pixels'))
 
 self.spancoords = spancoords
@@ -1165,7 +1165,7 @@
 if self.validButtons is not None:
 if not event.button in self.validButtons:
 return True
- 
+
 # If no button was pressed yet ignore the event if it was out
 # of the axes
 if self.eventpress == None:
Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py	2010年06月30日 16:31:23 UTC (rev 8478)
+++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py	2010年06月30日 21:07:36 UTC (rev 8479)
@@ -93,8 +93,8 @@
 ydwl = (0.95/self.dist)
 ydw = (0.9/self.dist)
 
- Axes.set_xlim(self, -xdwl, xdw)
- Axes.set_ylim(self, -ydwl, ydw)
+ Axes.set_xlim(self, -xdwl, xdw, auto=None)
+ Axes.set_ylim(self, -ydwl, ydw, auto=None)
 
 def create_axes(self):
 self.w_xaxis = axis3d.XAxis('x', self.xy_viewLim.intervalx,
@@ -361,7 +361,7 @@
 button or buttons to use to zoom the 3D axes.
 Default = 3.
 ============ =======================================================
- 
+
 """
 self.button_pressed = None
 canv = self.figure.canvas
@@ -1083,21 +1083,21 @@
 dx, dy, dz can be arrays or scalars.
 
 *color* can be:
- 
+
 - A single color value, to color all bars the same color.
- 
+
 - An array of colors of length N bars, to color each bar
 independently.
- 
+
 - An array of colors of length 6, to color the faces of the
 bars similarly.
- 
+
 - An array of colors of length 6 * N bars, to color each face
 independently.
 
 When coloring the faces of the boxes specifically, this is
 the order of the coloring:
- 
+
 1. -Z (bottom of box)
 2. +Z (top of box)
 3. -Y
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8478
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8478&view=rev
Author: ryanmay
Date: 2010年06月30日 16:31:23 +0000 (2010年6月30日)
Log Message:
-----------
Force timer interval to int. This silences an exception for Tk and a warning from GTK when a float is given.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backend_bases.py
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py	2010年06月29日 21:44:19 UTC (rev 8477)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py	2010年06月30日 16:31:23 UTC (rev 8478)
@@ -944,6 +944,9 @@
 return self._interval
 
 def _set_interval(self, interval):
+ # Force to int since none of the backends actually support fractional
+ # milliseconds, and some error or give warnings.
+ interval = int(interval)
 self._interval = interval
 self._timer_set_interval()
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <as...@us...> - 2010年06月29日 21:44:25
Revision: 8477
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8477&view=rev
Author: astraw
Date: 2010年06月29日 21:44:19 +0000 (2010年6月29日)
Log Message:
-----------
docs: build with makefile produced by Sphinx
Modified Paths:
--------------
 trunk/matplotlib/doc/make.py
Modified: trunk/matplotlib/doc/make.py
===================================================================
--- trunk/matplotlib/doc/make.py	2010年06月29日 13:30:09 UTC (rev 8476)
+++ trunk/matplotlib/doc/make.py	2010年06月29日 21:44:19 UTC (rev 8477)
@@ -52,12 +52,8 @@
 # Produce pdf.
 os.chdir('build/latex')
 
- # Copying the makefile produced by sphinx...
- if (os.system('pdflatex Matplotlib.tex') or
- os.system('pdflatex Matplotlib.tex') or
- os.system('makeindex -s python.ist Matplotlib.idx') or
- os.system('makeindex -s python.ist modMatplotlib.idx') or
- os.system('pdflatex Matplotlib.tex')):
+ # Call the makefile produced by sphinx...
+ if os.system('make'):
 raise SystemExit("Rendering LaTeX failed.")
 
 os.chdir('../..')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <jd...@us...> - 2010年06月29日 13:30:16
Revision: 8476
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8476&view=rev
Author: jdh2358
Date: 2010年06月29日 13:30:09 +0000 (2010年6月29日)
Log Message:
-----------
bump version number for rc
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/__init__.py
Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/__init__.py	2010年06月28日 14:05:17 UTC (rev 8475)
+++ trunk/matplotlib/lib/matplotlib/__init__.py	2010年06月29日 13:30:09 UTC (rev 8476)
@@ -99,7 +99,7 @@
 """
 from __future__ import generators
 
-__version__ = '1.0.svn'
+__version__ = '1.0rc1'
 __revision__ = '$Revision$'
 __date__ = '$Date$'
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8475
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8475&view=rev
Author: mdboom
Date: 2010年06月28日 14:05:17 +0000 (2010年6月28日)
Log Message:
-----------
Formatting only
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/_mathtext_data.py
Modified: trunk/matplotlib/lib/matplotlib/_mathtext_data.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/_mathtext_data.py	2010年06月28日 13:54:52 UTC (rev 8474)
+++ trunk/matplotlib/lib/matplotlib/_mathtext_data.py	2010年06月28日 14:05:17 UTC (rev 8475)
@@ -15,123 +15,123 @@
 """
 
 latex_to_bakoma = {
- r'\oint' : ('cmex10', 45),
- r'\bigodot' : ('cmex10', 50),
- r'\bigoplus' : ('cmex10', 55),
- r'\bigotimes' : ('cmex10', 59),
- r'\sum' : ('cmex10', 51),
- r'\prod' : ('cmex10', 24),
- r'\int' : ('cmex10', 56),
- r'\bigcup' : ('cmex10', 28),
- r'\bigcap' : ('cmex10', 60),
- r'\biguplus' : ('cmex10', 32),
- r'\bigwedge' : ('cmex10', 4),
- r'\bigvee' : ('cmex10', 37),
- r'\coprod' : ('cmex10', 42),
- r'\__sqrt__' : ('cmex10', 48),
- r'\leftbrace' : ('cmex10', 92),
- r'{' : ('cmex10', 92),
- r'\{' : ('cmex10', 92),
- r'\rightbrace' : ('cmex10', 130),
- r'}' : ('cmex10', 130),
- r'\}' : ('cmex10', 130),
- r'\leftangle' : ('cmex10', 97),
- r'\rightangle' : ('cmex10', 64),
- r'\langle' : ('cmex10', 97),
- r'\rangle' : ('cmex10', 64),
- r'\widehat' : ('cmex10', 15),
- r'\widetilde' : ('cmex10', 52),
- r'\widebar' : ('cmr10', 131),
+ r'\oint' : ('cmex10', 45),
+ r'\bigodot' : ('cmex10', 50),
+ r'\bigoplus' : ('cmex10', 55),
+ r'\bigotimes' : ('cmex10', 59),
+ r'\sum' : ('cmex10', 51),
+ r'\prod' : ('cmex10', 24),
+ r'\int' : ('cmex10', 56),
+ r'\bigcup' : ('cmex10', 28),
+ r'\bigcap' : ('cmex10', 60),
+ r'\biguplus' : ('cmex10', 32),
+ r'\bigwedge' : ('cmex10', 4),
+ r'\bigvee' : ('cmex10', 37),
+ r'\coprod' : ('cmex10', 42),
+ r'\__sqrt__' : ('cmex10', 48),
+ r'\leftbrace' : ('cmex10', 92),
+ r'{' : ('cmex10', 92),
+ r'\{' : ('cmex10', 92),
+ r'\rightbrace' : ('cmex10', 130),
+ r'}' : ('cmex10', 130),
+ r'\}' : ('cmex10', 130),
+ r'\leftangle' : ('cmex10', 97),
+ r'\rightangle' : ('cmex10', 64),
+ r'\langle' : ('cmex10', 97),
+ r'\rangle' : ('cmex10', 64),
+ r'\widehat' : ('cmex10', 15),
+ r'\widetilde' : ('cmex10', 52),
+ r'\widebar' : ('cmr10', 131),
 
- r'\omega' : ('cmmi10', 29),
- r'\varepsilon' : ('cmmi10', 20),
- r'\vartheta' : ('cmmi10', 22),
- r'\varrho' : ('cmmi10', 61),
- r'\varsigma' : ('cmmi10', 41),
- r'\varphi' : ('cmmi10', 6),
- r'\leftharpoonup' : ('cmmi10', 108),
- r'\leftharpoondown' : ('cmmi10', 68),
- r'\rightharpoonup' : ('cmmi10', 117),
- r'\rightharpoondown' : ('cmmi10', 77),
- r'\triangleright' : ('cmmi10', 130),
- r'\triangleleft' : ('cmmi10', 89),
- r'.' : ('cmmi10', 51),
- r',' : ('cmmi10', 44),
- r'<' : ('cmmi10', 99),
- r'/' : ('cmmi10', 98),
- r'>' : ('cmmi10', 107),
- r'\flat' : ('cmmi10', 131),
- r'\natural' : ('cmmi10', 90),
- r'\sharp' : ('cmmi10', 50),
- r'\smile' : ('cmmi10', 97),
- r'\frown' : ('cmmi10', 58),
- r'\ell' : ('cmmi10', 102),
- r'\imath' : ('cmmi10', 8),
- r'\jmath' : ('cmmi10', 65),
- r'\wp' : ('cmmi10', 14),
- r'\alpha' : ('cmmi10', 13),
- r'\beta' : ('cmmi10', 35),
- r'\gamma' : ('cmmi10', 24),
- r'\delta' : ('cmmi10', 38),
- r'\epsilon' : ('cmmi10', 54),
- r'\zeta' : ('cmmi10', 10),
- r'\eta' : ('cmmi10', 5),
- r'\theta' : ('cmmi10', 18),
- r'\iota' : ('cmmi10', 28),
- r'\lambda' : ('cmmi10', 9),
- r'\mu' : ('cmmi10', 32),
- r'\nu' : ('cmmi10', 34),
- r'\xi' : ('cmmi10', 7),
- r'\pi' : ('cmmi10', 36),
- r'\kappa' : ('cmmi10', 30),
- r'\rho' : ('cmmi10', 39),
- r'\sigma' : ('cmmi10', 21),
- r'\tau' : ('cmmi10', 43),
- r'\upsilon' : ('cmmi10', 25),
- r'\phi' : ('cmmi10', 42),
- r'\chi' : ('cmmi10', 17),
- r'\psi' : ('cmmi10', 31),
- r'|' : ('cmsy10', 47),
- r'\|' : ('cmsy10', 47),
- r'(' : ('cmr10', 119),
- r'\leftparen' : ('cmr10', 119),
- r'\rightparen' : ('cmr10', 68),
- r')' : ('cmr10', 68),
- r'+' : ('cmr10', 76),
- r'0' : ('cmr10', 40),
- r'1' : ('cmr10', 100),
- r'2' : ('cmr10', 49),
- r'3' : ('cmr10', 110),
- r'4' : ('cmr10', 59),
- r'5' : ('cmr10', 120),
- r'6' : ('cmr10', 69),
- r'7' : ('cmr10', 127),
- r'8' : ('cmr10', 77),
- r'9' : ('cmr10', 22),
- r':' : ('cmr10', 85),
- r';' : ('cmr10', 31),
- r'=' : ('cmr10', 41),
- r'\leftbracket' : ('cmr10', 62),
- r'[' : ('cmr10', 62),
- r'\rightbracket' : ('cmr10', 72),
- r']' : ('cmr10', 72),
- r'\%' : ('cmr10', 48),
- r'%' : ('cmr10', 48),
- r'\$' : ('cmr10', 99),
- r'@' : ('cmr10', 111),
- r'\#' : ('cmr10', 39),
- r'\_' : ('cmtt10', 79),
- r'\Gamma' : ('cmr10', 19),
- r'\Delta' : ('cmr10', 6),
- r'\Theta' : ('cmr10', 7),
- r'\Lambda' : ('cmr10', 14),
- r'\Xi' : ('cmr10', 3),
- r'\Pi' : ('cmr10', 17),
- r'\Sigma' : ('cmr10', 10),
- r'\Upsilon' : ('cmr10', 11),
- r'\Phi' : ('cmr10', 9),
- r'\Psi' : ('cmr10', 15),
- r'\Omega' : ('cmr10', 12),
+ r'\omega' : ('cmmi10', 29),
+ r'\varepsilon' : ('cmmi10', 20),
+ r'\vartheta' : ('cmmi10', 22),
+ r'\varrho' : ('cmmi10', 61),
+ r'\varsigma' : ('cmmi10', 41),
+ r'\varphi' : ('cmmi10', 6),
+ r'\leftharpoonup' : ('cmmi10', 108),
+ r'\leftharpoondown' : ('cmmi10', 68),
+ r'\rightharpoonup' : ('cmmi10', 117),
+ r'\rightharpoondown' : ('cmmi10', 77),
+ r'\triangleright' : ('cmmi10', 130),
+ r'\triangleleft' : ('cmmi10', 89),
+ r'.' : ('cmmi10', 51),
+ r',' : ('cmmi10', 44),
+ r'<' : ('cmmi10', 99),
+ r'/' : ('cmmi10', 98),
+ r'>' : ('cmmi10', 107),
+ r'\flat' : ('cmmi10', 131),
+ r'\natural' : ('cmmi10', 90),
+ r'\sharp' : ('cmmi10', 50),
+ r'\smile' : ('cmmi10', 97),
+ r'\frown' : ('cmmi10', 58),
+ r'\ell' : ('cmmi10', 102),
+ r'\imath' : ('cmmi10', 8),
+ r'\jmath' : ('cmmi10', 65),
+ r'\wp' : ('cmmi10', 14),
+ r'\alpha' : ('cmmi10', 13),
+ r'\beta' : ('cmmi10', 35),
+ r'\gamma' : ('cmmi10', 24),
+ r'\delta' : ('cmmi10', 38),
+ r'\epsilon' : ('cmmi10', 54),
+ r'\zeta' : ('cmmi10', 10),
+ r'\eta' : ('cmmi10', 5),
+ r'\theta' : ('cmmi10', 18),
+ r'\iota' : ('cmmi10', 28),
+ r'\lambda' : ('cmmi10', 9),
+ r'\mu' : ('cmmi10', 32),
+ r'\nu' : ('cmmi10', 34),
+ r'\xi' : ('cmmi10', 7),
+ r'\pi' : ('cmmi10', 36),
+ r'\kappa' : ('cmmi10', 30),
+ r'\rho' : ('cmmi10', 39),
+ r'\sigma' : ('cmmi10', 21),
+ r'\tau' : ('cmmi10', 43),
+ r'\upsilon' : ('cmmi10', 25),
+ r'\phi' : ('cmmi10', 42),
+ r'\chi' : ('cmmi10', 17),
+ r'\psi' : ('cmmi10', 31),
+ r'|' : ('cmsy10', 47),
+ r'\|' : ('cmsy10', 47),
+ r'(' : ('cmr10', 119),
+ r'\leftparen' : ('cmr10', 119),
+ r'\rightparen' : ('cmr10', 68),
+ r')' : ('cmr10', 68),
+ r'+' : ('cmr10', 76),
+ r'0' : ('cmr10', 40),
+ r'1' : ('cmr10', 100),
+ r'2' : ('cmr10', 49),
+ r'3' : ('cmr10', 110),
+ r'4' : ('cmr10', 59),
+ r'5' : ('cmr10', 120),
+ r'6' : ('cmr10', 69),
+ r'7' : ('cmr10', 127),
+ r'8' : ('cmr10', 77),
+ r'9' : ('cmr10', 22),
+ r' :' : ('cmr10', 85),
+ r';' : ('cmr10', 31),
+ r'=' : ('cmr10', 41),
+ r'\leftbracket' : ('cmr10', 62),
+ r'[' : ('cmr10', 62),
+ r'\rightbracket' : ('cmr10', 72),
+ r']' : ('cmr10', 72),
+ r'\%' : ('cmr10', 48),
+ r'%' : ('cmr10', 48),
+ r'\$' : ('cmr10', 99),
+ r'@' : ('cmr10', 111),
+ r'\#' : ('cmr10', 39),
+ r'\_' : ('cmtt10', 79),
+ r'\Gamma' : ('cmr10', 19),
+ r'\Delta' : ('cmr10', 6),
+ r'\Theta' : ('cmr10', 7),
+ r'\Lambda' : ('cmr10', 14),
+ r'\Xi' : ('cmr10', 3),
+ r'\Pi' : ('cmr10', 17),
+ r'\Sigma' : ('cmr10', 10),
+ r'\Upsilon' : ('cmr10', 11),
+ r'\Phi' : ('cmr10', 9),
+ r'\Psi' : ('cmr10', 15),
+ r'\Omega' : ('cmr10', 12),
 
 # these are mathml names, I think. I'm just using them for the
 # tex methods noted
@@ -145,107 +145,107 @@
 r'\combiningrightarrowabove' : ('cmmi10', 110), # for \vec
 r'\combiningdotabove' : ('cmr10', 26), # for \dot
 
- r'\leftarrow' : ('cmsy10', 10),
- r'\uparrow' : ('cmsy10', 25),
- r'\downarrow' : ('cmsy10', 28),
- r'\leftrightarrow' : ('cmsy10', 24),
- r'\nearrow' : ('cmsy10', 99),
- r'\searrow' : ('cmsy10', 57),
- r'\simeq' : ('cmsy10', 108),
- r'\Leftarrow' : ('cmsy10', 104),
- r'\Rightarrow' : ('cmsy10', 112),
- r'\Uparrow' : ('cmsy10', 60),
- r'\Downarrow' : ('cmsy10', 68),
- r'\Leftrightarrow' : ('cmsy10', 51),
- r'\nwarrow' : ('cmsy10', 65),
- r'\swarrow' : ('cmsy10', 116),
- r'\propto' : ('cmsy10', 15),
- r'\prime' : ('cmsy10', 73),
- r"'" : ('cmsy10', 73),
- r'\infty' : ('cmsy10', 32),
- r'\in' : ('cmsy10', 59),
- r'\ni' : ('cmsy10', 122),
- r'\bigtriangleup' : ('cmsy10', 80),
- r'\bigtriangledown' : ('cmsy10', 132),
- r'\slash' : ('cmsy10', 87),
- r'\forall' : ('cmsy10', 21),
- r'\exists' : ('cmsy10', 5),
- r'\neg' : ('cmsy10', 20),
- r'\emptyset' : ('cmsy10', 33),
- r'\Re' : ('cmsy10', 95),
- r'\Im' : ('cmsy10', 52),
- r'\top' : ('cmsy10', 100),
- r'\bot' : ('cmsy10', 11),
- r'\aleph' : ('cmsy10', 26),
- r'\cup' : ('cmsy10', 6),
- r'\cap' : ('cmsy10', 19),
- r'\uplus' : ('cmsy10', 58),
- r'\wedge' : ('cmsy10', 43),
- r'\vee' : ('cmsy10', 96),
- r'\vdash' : ('cmsy10', 109),
- r'\dashv' : ('cmsy10', 66),
- r'\lfloor' : ('cmsy10', 117),
- r'\rfloor' : ('cmsy10', 74),
- r'\lceil' : ('cmsy10', 123),
- r'\rceil' : ('cmsy10', 81),
- r'\lbrace' : ('cmsy10', 92),
- r'\rbrace' : ('cmsy10', 105),
- r'\mid' : ('cmsy10', 47),
- r'\vert' : ('cmsy10', 47),
- r'\Vert' : ('cmsy10', 44),
- r'\updownarrow' : ('cmsy10', 94),
- r'\Updownarrow' : ('cmsy10', 53),
- r'\backslash' : ('cmsy10', 126),
- r'\wr' : ('cmsy10', 101),
- r'\nabla' : ('cmsy10', 110),
- r'\sqcup' : ('cmsy10', 67),
- r'\sqcap' : ('cmsy10', 118),
- r'\sqsubseteq' : ('cmsy10', 75),
- r'\sqsupseteq' : ('cmsy10', 124),
- r'\S' : ('cmsy10', 129),
- r'\dag' : ('cmsy10', 71),
- r'\ddag' : ('cmsy10', 127),
- r'\P' : ('cmsy10', 130),
- r'\clubsuit' : ('cmsy10', 18),
- r'\diamondsuit' : ('cmsy10', 34),
- r'\heartsuit' : ('cmsy10', 22),
- r'-' : ('cmsy10', 17),
- r'\cdot' : ('cmsy10', 78),
- r'\times' : ('cmsy10', 13),
- r'*' : ('cmsy10', 9),
- r'\ast' : ('cmsy10', 9),
- r'\div' : ('cmsy10', 31),
- r'\diamond' : ('cmsy10', 48),
- r'\pm' : ('cmsy10', 8),
- r'\mp' : ('cmsy10', 98),
- r'\oplus' : ('cmsy10', 16),
- r'\ominus' : ('cmsy10', 56),
- r'\otimes' : ('cmsy10', 30),
- r'\oslash' : ('cmsy10', 107),
- r'\odot' : ('cmsy10', 64),
- r'\bigcirc' : ('cmsy10', 115),
- r'\circ' : ('cmsy10', 72),
- r'\bullet' : ('cmsy10', 84),
- r'\asymp' : ('cmsy10', 121),
- r'\equiv' : ('cmsy10', 35),
- r'\subseteq' : ('cmsy10', 103),
- r'\supseteq' : ('cmsy10', 42),
- r'\leq' : ('cmsy10', 14),
- r'\geq' : ('cmsy10', 29),
- r'\preceq' : ('cmsy10', 79),
- r'\succeq' : ('cmsy10', 131),
- r'\sim' : ('cmsy10', 27),
- r'\approx' : ('cmsy10', 23),
- r'\subset' : ('cmsy10', 50),
- r'\supset' : ('cmsy10', 86),
- r'\ll' : ('cmsy10', 85),
- r'\gg' : ('cmsy10', 40),
- r'\prec' : ('cmsy10', 93),
- r'\succ' : ('cmsy10', 49),
- r'\rightarrow' : ('cmsy10', 12),
- r'\to' : ('cmsy10', 12),
- r'\spadesuit' : ('cmsy10', 7),
- }
+ r'\leftarrow' : ('cmsy10', 10),
+ r'\uparrow' : ('cmsy10', 25),
+ r'\downarrow' : ('cmsy10', 28),
+ r'\leftrightarrow' : ('cmsy10', 24),
+ r'\nearrow' : ('cmsy10', 99),
+ r'\searrow' : ('cmsy10', 57),
+ r'\simeq' : ('cmsy10', 108),
+ r'\Leftarrow' : ('cmsy10', 104),
+ r'\Rightarrow' : ('cmsy10', 112),
+ r'\Uparrow' : ('cmsy10', 60),
+ r'\Downarrow' : ('cmsy10', 68),
+ r'\Leftrightarrow' : ('cmsy10', 51),
+ r'\nwarrow' : ('cmsy10', 65),
+ r'\swarrow' : ('cmsy10', 116),
+ r'\propto' : ('cmsy10', 15),
+ r'\prime' : ('cmsy10', 73),
+ r"'" : ('cmsy10', 73),
+ r'\infty' : ('cmsy10', 32),
+ r'\in' : ('cmsy10', 59),
+ r'\ni' : ('cmsy10', 122),
+ r'\bigtriangleup' : ('cmsy10', 80),
+ r'\bigtriangledown' : ('cmsy10', 132),
+ r'\slash' : ('cmsy10', 87),
+ r'\forall' : ('cmsy10', 21),
+ r'\exists' : ('cmsy10', 5),
+ r'\neg' : ('cmsy10', 20),
+ r'\emptyset' : ('cmsy10', 33),
+ r'\Re' : ('cmsy10', 95),
+ r'\Im' : ('cmsy10', 52),
+ r'\top' : ('cmsy10', 100),
+ r'\bot' : ('cmsy10', 11),
+ r'\aleph' : ('cmsy10', 26),
+ r'\cup' : ('cmsy10', 6),
+ r'\cap' : ('cmsy10', 19),
+ r'\uplus' : ('cmsy10', 58),
+ r'\wedge' : ('cmsy10', 43),
+ r'\vee' : ('cmsy10', 96),
+ r'\vdash' : ('cmsy10', 109),
+ r'\dashv' : ('cmsy10', 66),
+ r'\lfloor' : ('cmsy10', 117),
+ r'\rfloor' : ('cmsy10', 74),
+ r'\lceil' : ('cmsy10', 123),
+ r'\rceil' : ('cmsy10', 81),
+ r'\lbrace' : ('cmsy10', 92),
+ r'\rbrace' : ('cmsy10', 105),
+ r'\mid' : ('cmsy10', 47),
+ r'\vert' : ('cmsy10', 47),
+ r'\Vert' : ('cmsy10', 44),
+ r'\updownarrow' : ('cmsy10', 94),
+ r'\Updownarrow' : ('cmsy10', 53),
+ r'\backslash' : ('cmsy10', 126),
+ r'\wr' : ('cmsy10', 101),
+ r'\nabla' : ('cmsy10', 110),
+ r'\sqcup' : ('cmsy10', 67),
+ r'\sqcap' : ('cmsy10', 118),
+ r'\sqsubseteq' : ('cmsy10', 75),
+ r'\sqsupseteq' : ('cmsy10', 124),
+ r'\S' : ('cmsy10', 129),
+ r'\dag' : ('cmsy10', 71),
+ r'\ddag' : ('cmsy10', 127),
+ r'\P' : ('cmsy10', 130),
+ r'\clubsuit' : ('cmsy10', 18),
+ r'\diamondsuit' : ('cmsy10', 34),
+ r'\heartsuit' : ('cmsy10', 22),
+ r'-' : ('cmsy10', 17),
+ r'\cdot' : ('cmsy10', 78),
+ r'\times' : ('cmsy10', 13),
+ r'*' : ('cmsy10', 9),
+ r'\ast' : ('cmsy10', 9),
+ r'\div' : ('cmsy10', 31),
+ r'\diamond' : ('cmsy10', 48),
+ r'\pm' : ('cmsy10', 8),
+ r'\mp' : ('cmsy10', 98),
+ r'\oplus' : ('cmsy10', 16),
+ r'\ominus' : ('cmsy10', 56),
+ r'\otimes' : ('cmsy10', 30),
+ r'\oslash' : ('cmsy10', 107),
+ r'\odot' : ('cmsy10', 64),
+ r'\bigcirc' : ('cmsy10', 115),
+ r'\circ' : ('cmsy10', 72),
+ r'\bullet' : ('cmsy10', 84),
+ r'\asymp' : ('cmsy10', 121),
+ r'\equiv' : ('cmsy10', 35),
+ r'\subseteq' : ('cmsy10', 103),
+ r'\supseteq' : ('cmsy10', 42),
+ r'\leq' : ('cmsy10', 14),
+ r'\geq' : ('cmsy10', 29),
+ r'\preceq' : ('cmsy10', 79),
+ r'\succeq' : ('cmsy10', 131),
+ r'\sim' : ('cmsy10', 27),
+ r'\approx' : ('cmsy10', 23),
+ r'\subset' : ('cmsy10', 50),
+ r'\supset' : ('cmsy10', 86),
+ r'\ll' : ('cmsy10', 85),
+ r'\gg' : ('cmsy10', 40),
+ r'\prec' : ('cmsy10', 93),
+ r'\succ' : ('cmsy10', 49),
+ r'\rightarrow' : ('cmsy10', 12),
+ r'\to' : ('cmsy10', 12),
+ r'\spadesuit' : ('cmsy10', 7),
+}
 
 latex_to_cmex = {
 r'\__sqrt__' : 112,
@@ -271,139 +271,139 @@
 }
 
 latex_to_standard = {
- r'\cong' : ('psyr', 64),
- r'\Delta' : ('psyr', 68),
- r'\Phi' : ('psyr', 70),
- r'\Gamma' : ('psyr', 89),
- r'\alpha' : ('psyr', 97),
- r'\beta' : ('psyr', 98),
- r'\chi' : ('psyr', 99),
- r'\delta' : ('psyr', 100),
- r'\varepsilon' : ('psyr', 101),
- r'\phi' : ('psyr', 102),
- r'\gamma' : ('psyr', 103),
- r'\eta' : ('psyr', 104),
- r'\iota' : ('psyr', 105),
- r'\varpsi' : ('psyr', 106),
- r'\kappa' : ('psyr', 108),
- r'\nu' : ('psyr', 110),
- r'\pi' : ('psyr', 112),
- r'\theta' : ('psyr', 113),
- r'\rho' : ('psyr', 114),
- r'\sigma' : ('psyr', 115),
- r'\tau' : ('psyr', 116),
- r'\upsilon' : ('psyr', 117),
- r'\varpi' : ('psyr', 118),
- r'\omega' : ('psyr', 119),
- r'\xi' : ('psyr', 120),
- r'\psi' : ('psyr', 121),
- r'\zeta' : ('psyr', 122),
- r'\sim' : ('psyr', 126),
- r'\leq' : ('psyr', 163),
- r'\infty' : ('psyr', 165),
- r'\clubsuit' : ('psyr', 167),
- r'\diamondsuit' : ('psyr', 168),
- r'\heartsuit' : ('psyr', 169),
- r'\spadesuit' : ('psyr', 170),
- r'\leftrightarrow' : ('psyr', 171),
- r'\leftarrow' : ('psyr', 172),
- r'\uparrow' : ('psyr', 173),
- r'\rightarrow' : ('psyr', 174),
- r'\downarrow' : ('psyr', 175),
- r'\pm' : ('psyr', 176),
- r'\geq' : ('psyr', 179),
- r'\times' : ('psyr', 180),
- r'\propto' : ('psyr', 181),
- r'\partial' : ('psyr', 182),
- r'\bullet' : ('psyr', 183),
- r'\div' : ('psyr', 184),
- r'\neq' : ('psyr', 185),
- r'\equiv' : ('psyr', 186),
- r'\approx' : ('psyr', 187),
- r'\ldots' : ('psyr', 188),
- r'\aleph' : ('psyr', 192),
- r'\Im' : ('psyr', 193),
- r'\Re' : ('psyr', 194),
- r'\wp' : ('psyr', 195),
- r'\otimes' : ('psyr', 196),
- r'\oplus' : ('psyr', 197),
- r'\oslash' : ('psyr', 198),
- r'\cap' : ('psyr', 199),
- r'\cup' : ('psyr', 200),
- r'\supset' : ('psyr', 201),
- r'\supseteq' : ('psyr', 202),
- r'\subset' : ('psyr', 204),
- r'\subseteq' : ('psyr', 205),
- r'\in' : ('psyr', 206),
- r'\notin' : ('psyr', 207),
- r'\angle' : ('psyr', 208),
- r'\nabla' : ('psyr', 209),
- r'\textregistered' : ('psyr', 210),
- r'\copyright' : ('psyr', 211),
- r'\texttrademark' : ('psyr', 212),
- r'\Pi' : ('psyr', 213),
- r'\prod' : ('psyr', 213),
- r'\surd' : ('psyr', 214),
- r'\__sqrt__' : ('psyr', 214),
- r'\cdot' : ('psyr', 215),
- r'\urcorner' : ('psyr', 216),
- r'\vee' : ('psyr', 217),
- r'\wedge' : ('psyr', 218),
- r'\Leftrightarrow' : ('psyr', 219),
- r'\Leftarrow' : ('psyr', 220),
- r'\Uparrow' : ('psyr', 221),
- r'\Rightarrow' : ('psyr', 222),
- r'\Downarrow' : ('psyr', 223),
- r'\Diamond' : ('psyr', 224),
- r'\langle' : ('psyr', 225),
- r'\Sigma' : ('psyr', 229),
- r'\sum' : ('psyr', 229),
- r'\forall' : ('psyr', 34),
- r'\exists' : ('psyr', 36),
- r'\lceil' : ('psyr', 233),
- r'\lbrace' : ('psyr', 123),
- r'\Psi' : ('psyr', 89),
- r'\bot' : ('psyr', 0136),
- r'\Omega' : ('psyr', 0127),
- r'\leftbracket' : ('psyr', 0133),
- r'\rightbracket' : ('psyr', 0135),
- r'\leftbrace' : ('psyr', 123),
- r'\leftparen' : ('psyr', 050),
- r'\prime' : ('psyr', 0242),
- r'\sharp' : ('psyr', 043),
- r'\slash' : ('psyr', 057),
- r'\Lamda' : ('psyr', 0114),
- r'\neg' : ('psyr', 0330),
- r'\Upsilon' : ('psyr', 0241),
- r'\rightbrace' : ('psyr', 0175),
- r'\rfloor' : ('psyr', 0373),
- r'\lambda' : ('psyr', 0154),
- r'\to' : ('psyr', 0256),
- r'\Xi' : ('psyr', 0130),
- r'\emptyset' : ('psyr', 0306),
- r'\lfloor' : ('psyr', 0353),
- r'\rightparen' : ('psyr', 051),
- r'\rceil' : ('psyr', 0371),
- r'\ni' : ('psyr', 047),
- r'\epsilon' : ('psyr', 0145),
- r'\Theta' : ('psyr', 0121),
- r'\langle' : ('psyr', 0341),
- r'\leftangle' : ('psyr', 0341),
- r'\rangle' : ('psyr', 0361),
- r'\rightangle' : ('psyr', 0361),
- r'\rbrace' : ('psyr', 0175),
- r'\circ' : ('psyr', 0260),
- r'\diamond' : ('psyr', 0340),
- r'\mu' : ('psyr', 0155),
- r'\mid' : ('psyr', 0352),
- r'\imath' : ('pncri8a', 105),
- r'\%' : ('pncr8a', 37),
- r'\$' : ('pncr8a', 36),
- r'\{' : ('pncr8a', 123),
- r'\}' : ('pncr8a', 125),
- r'\backslash' : ('pncr8a', 92),
- r'\ast' : ('pncr8a', 42),
- r'\#' : ('pncr8a', 35),
+ r'\cong' : ('psyr', 64),
+ r'\Delta' : ('psyr', 68),
+ r'\Phi' : ('psyr', 70),
+ r'\Gamma' : ('psyr', 89),
+ r'\alpha' : ('psyr', 97),
+ r'\beta' : ('psyr', 98),
+ r'\chi' : ('psyr', 99),
+ r'\delta' : ('psyr', 100),
+ r'\varepsilon' : ('psyr', 101),
+ r'\phi' : ('psyr', 102),
+ r'\gamma' : ('psyr', 103),
+ r'\eta' : ('psyr', 104),
+ r'\iota' : ('psyr', 105),
+ r'\varpsi' : ('psyr', 106),
+ r'\kappa' : ('psyr', 108),
+ r'\nu' : ('psyr', 110),
+ r'\pi' : ('psyr', 112),
+ r'\theta' : ('psyr', 113),
+ r'\rho' : ('psyr', 114),
+ r'\sigma' : ('psyr', 115),
+ r'\tau' : ('psyr', 116),
+ r'\upsilon' : ('psyr', 117),
+ r'\varpi' : ('psyr', 118),
+ r'\omega' : ('psyr', 119),
+ r'\xi' : ('psyr', 120),
+ r'\psi' : ('psyr', 121),
+ r'\zeta' : ('psyr', 122),
+ r'\sim' : ('psyr', 126),
+ r'\leq' : ('psyr', 163),
+ r'\infty' : ('psyr', 165),
+ r'\clubsuit' : ('psyr', 167),
+ r'\diamondsuit' : ('psyr', 168),
+ r'\heartsuit' : ('psyr', 169),
+ r'\spadesuit' : ('psyr', 170),
+ r'\leftrightarrow' : ('psyr', 171),
+ r'\leftarrow' : ('psyr', 172),
+ r'\uparrow' : ('psyr', 173),
+ r'\rightarrow' : ('psyr', 174),
+ r'\downarrow' : ('psyr', 175),
+ r'\pm' : ('psyr', 176),
+ r'\geq' : ('psyr', 179),
+ r'\times' : ('psyr', 180),
+ r'\propto' : ('psyr', 181),
+ r'\partial' : ('psyr', 182),
+ r'\bullet' : ('psyr', 183),
+ r'\div' : ('psyr', 184),
+ r'\neq' : ('psyr', 185),
+ r'\equiv' : ('psyr', 186),
+ r'\approx' : ('psyr', 187),
+ r'\ldots' : ('psyr', 188),
+ r'\aleph' : ('psyr', 192),
+ r'\Im' : ('psyr', 193),
+ r'\Re' : ('psyr', 194),
+ r'\wp' : ('psyr', 195),
+ r'\otimes' : ('psyr', 196),
+ r'\oplus' : ('psyr', 197),
+ r'\oslash' : ('psyr', 198),
+ r'\cap' : ('psyr', 199),
+ r'\cup' : ('psyr', 200),
+ r'\supset' : ('psyr', 201),
+ r'\supseteq' : ('psyr', 202),
+ r'\subset' : ('psyr', 204),
+ r'\subseteq' : ('psyr', 205),
+ r'\in' : ('psyr', 206),
+ r'\notin' : ('psyr', 207),
+ r'\angle' : ('psyr', 208),
+ r'\nabla' : ('psyr', 209),
+ r'\textregistered' : ('psyr', 210),
+ r'\copyright' : ('psyr', 211),
+ r'\texttrademark' : ('psyr', 212),
+ r'\Pi' : ('psyr', 213),
+ r'\prod' : ('psyr', 213),
+ r'\surd' : ('psyr', 214),
+ r'\__sqrt__' : ('psyr', 214),
+ r'\cdot' : ('psyr', 215),
+ r'\urcorner' : ('psyr', 216),
+ r'\vee' : ('psyr', 217),
+ r'\wedge' : ('psyr', 218),
+ r'\Leftrightarrow' : ('psyr', 219),
+ r'\Leftarrow' : ('psyr', 220),
+ r'\Uparrow' : ('psyr', 221),
+ r'\Rightarrow' : ('psyr', 222),
+ r'\Downarrow' : ('psyr', 223),
+ r'\Diamond' : ('psyr', 224),
+ r'\langle' : ('psyr', 225),
+ r'\Sigma' : ('psyr', 229),
+ r'\sum' : ('psyr', 229),
+ r'\forall' : ('psyr', 34),
+ r'\exists' : ('psyr', 36),
+ r'\lceil' : ('psyr', 233),
+ r'\lbrace' : ('psyr', 123),
+ r'\Psi' : ('psyr', 89),
+ r'\bot' : ('psyr', 0136),
+ r'\Omega' : ('psyr', 0127),
+ r'\leftbracket' : ('psyr', 0133),
+ r'\rightbracket' : ('psyr', 0135),
+ r'\leftbrace' : ('psyr', 123),
+ r'\leftparen' : ('psyr', 050),
+ r'\prime' : ('psyr', 0242),
+ r'\sharp' : ('psyr', 043),
+ r'\slash' : ('psyr', 057),
+ r'\Lamda' : ('psyr', 0114),
+ r'\neg' : ('psyr', 0330),
+ r'\Upsilon' : ('psyr', 0241),
+ r'\rightbrace' : ('psyr', 0175),
+ r'\rfloor' : ('psyr', 0373),
+ r'\lambda' : ('psyr', 0154),
+ r'\to' : ('psyr', 0256),
+ r'\Xi' : ('psyr', 0130),
+ r'\emptyset' : ('psyr', 0306),
+ r'\lfloor' : ('psyr', 0353),
+ r'\rightparen' : ('psyr', 051),
+ r'\rceil' : ('psyr', 0371),
+ r'\ni' : ('psyr', 047),
+ r'\epsilon' : ('psyr', 0145),
+ r'\Theta' : ('psyr', 0121),
+ r'\langle' : ('psyr', 0341),
+ r'\leftangle' : ('psyr', 0341),
+ r'\rangle' : ('psyr', 0361),
+ r'\rightangle' : ('psyr', 0361),
+ r'\rbrace' : ('psyr', 0175),
+ r'\circ' : ('psyr', 0260),
+ r'\diamond' : ('psyr', 0340),
+ r'\mu' : ('psyr', 0155),
+ r'\mid' : ('psyr', 0352),
+ r'\imath' : ('pncri8a', 105),
+ r'\%' : ('pncr8a', 37),
+ r'\$' : ('pncr8a', 36),
+ r'\{' : ('pncr8a', 123),
+ r'\}' : ('pncr8a', 125),
+ r'\backslash' : ('pncr8a', 92),
+ r'\ast' : ('pncr8a', 42),
+ r'\#' : ('pncr8a', 35),
 
 r'\circumflexaccent' : ('pncri8a', 124), # for \hat
 r'\combiningbreve' : ('pncri8a', 81), # for \breve
@@ -417,1909 +417,1911 @@
 
 # Automatically generated.
 
-type12uni = {'uni24C8': 9416,
-'aring': 229,
-'uni22A0': 8864,
-'uni2292': 8850,
-'quotedblright': 8221,
-'uni03D2': 978,
-'uni2215': 8725,
-'uni03D0': 976,
-'V': 86,
-'dollar': 36,
-'uni301E': 12318,
-'uni03D5': 981,
-'four': 52,
-'uni25A0': 9632,
-'uni013C': 316,
-'uni013B': 315,
-'uni013E': 318,
-'Yacute': 221,
-'uni25DE': 9694,
-'uni013F': 319,
-'uni255A': 9562,
-'uni2606': 9734,
-'uni0180': 384,
-'uni22B7': 8887,
-'uni044F': 1103,
-'uni22B5': 8885,
-'uni22B4': 8884,
-'uni22AE': 8878,
-'uni22B2': 8882,
-'uni22B1': 8881,
-'uni22B0': 8880,
-'uni25CD': 9677,
-'uni03CE': 974,
-'uni03CD': 973,
-'uni03CC': 972,
-'uni03CB': 971,
-'uni03CA': 970,
-'uni22B8': 8888,
-'uni22C9': 8905,
-'uni0449': 1097,
-'uni20DD': 8413,
-'uni20DC': 8412,
-'uni20DB': 8411,
-'uni2231': 8753,
-'uni25CF': 9679,
-'uni306E': 12398,
-'uni03D1': 977,
-'uni01A1': 417,
-'uni20D7': 8407,
-'uni03D6': 982,
-'uni2233': 8755,
-'uni20D2': 8402,
-'uni20D1': 8401,
-'uni20D0': 8400,
-'P': 80,
-'uni22BE': 8894,
-'uni22BD': 8893,
-'uni22BC': 8892,
-'uni22BB': 8891,
-'underscore': 95,
-'uni03C8': 968,
-'uni03C7': 967,
-'uni0328': 808,
-'uni03C5': 965,
-'uni03C4': 964,
-'uni03C3': 963,
-'uni03C2': 962,
-'uni03C1': 961,
-'uni03C0': 960,
-'uni2010': 8208,
-'uni0130': 304,
-'uni0133': 307,
-'uni0132': 306,
-'uni0135': 309,
-'uni0134': 308,
-'uni0137': 311,
-'uni0136': 310,
-'uni0139': 313,
-'uni0138': 312,
-'uni2244': 8772,
-'uni229A': 8858,
-'uni2571': 9585,
-'uni0278': 632,
-'uni2239': 8761,
-'p': 112,
-'uni3019': 12313,
-'uni25CB': 9675,
-'uni03DB': 987,
-'uni03DC': 988,
-'uni03DA': 986,
-'uni03DF': 991,
-'uni03DD': 989,
-'uni013D': 317,
-'uni220A': 8714,
-'uni220C': 8716,
-'uni220B': 8715,
-'uni220E': 8718,
-'uni220D': 8717,
-'uni220F': 8719,
-'uni22CC': 8908,
-'Otilde': 213,
-'uni25E5': 9701,
-'uni2736': 10038,
-'perthousand': 8240,
-'zero': 48,
-'uni279B': 10139,
-'dotlessi': 305,
-'uni2279': 8825,
-'Scaron': 352,
-'zcaron': 382,
-'uni21D8': 8664,
-'egrave': 232,
-'uni0271': 625,
-'uni01AA': 426,
-'uni2332': 9010,
-'section': 167,
-'uni25E4': 9700,
-'Icircumflex': 206,
-'ntilde': 241,
-'uni041E': 1054,
-'ampersand': 38,
-'uni041C': 1052,
-'uni041A': 1050,
-'uni22AB': 8875,
-'uni21DB': 8667,
-'dotaccent': 729,
-'uni0416': 1046,
-'uni0417': 1047,
-'uni0414': 1044,
-'uni0415': 1045,
-'uni0412': 1042,
-'uni0413': 1043,
-'degree': 176,
-'uni0411': 1041,
-'K': 75,
-'uni25EB': 9707,
-'uni25EF': 9711,
-'uni0418': 1048,
-'uni0419': 1049,
-'uni2263': 8803,
-'uni226E': 8814,
-'uni2251': 8785,
-'uni02C8': 712,
-'uni2262': 8802,
-'acircumflex': 226,
-'uni22B3': 8883,
-'uni2261': 8801,
-'uni2394': 9108,
-'Aring': 197,
-'uni2260': 8800,
-'uni2254': 8788,
-'uni0436': 1078,
-'uni2267': 8807,
-'k': 107,
-'uni22C8': 8904,
-'uni226A': 8810,
-'uni231F': 8991,
-'smalltilde': 732,
-'uni2201': 8705,
-'uni2200': 8704,
-'uni2203': 8707,
-'uni02BD': 701,
-'uni2205': 8709,
-'uni2204': 8708,
-'Agrave': 192,
-'uni2206': 8710,
-'uni2209': 8713,
-'uni2208': 8712,
-'uni226D': 8813,
-'uni2264': 8804,
-'uni263D': 9789,
-'uni2258': 8792,
-'uni02D3': 723,
-'uni02D2': 722,
-'uni02D1': 721,
-'uni02D0': 720,
-'uni25E1': 9697,
-'divide': 247,
-'uni02D5': 725,
-'uni02D4': 724,
-'ocircumflex': 244,
-'uni2524': 9508,
-'uni043A': 1082,
-'uni24CC': 9420,
-'asciitilde': 126,
-'uni22B9': 8889,
-'uni24D2': 9426,
-'uni211E': 8478,
-'uni211D': 8477,
-'uni24DD': 9437,
-'uni211A': 8474,
-'uni211C': 8476,
-'uni211B': 8475,
-'uni25C6': 9670,
-'uni017F': 383,
-'uni017A': 378,
-'uni017C': 380,
-'uni017B': 379,
-'uni0346': 838,
-'uni22F1': 8945,
-'uni22F0': 8944,
-'two': 50,
-'uni2298': 8856,
-'uni24D1': 9425,
-'E': 69,
-'uni025D': 605,
-'scaron': 353,
-'uni2322': 8994,
-'uni25E3': 9699,
-'uni22BF': 8895,
-'F': 70,
-'uni0440': 1088,
-'uni255E': 9566,
-'uni22BA': 8890,
-'uni0175': 373,
-'uni0174': 372,
-'uni0177': 375,
-'uni0176': 374,
-'bracketleft': 91,
-'uni0170': 368,
-'uni0173': 371,
-'uni0172': 370,
-'asciicircum': 94,
-'uni0179': 377,
-'uni2590': 9616,
-'uni25E2': 9698,
-'uni2119': 8473,
-'uni2118': 8472,
-'uni25CC': 9676,
-'f': 102,
-'ordmasculine': 186,
-'uni229B': 8859,
-'uni22A1': 8865,
-'uni2111': 8465,
-'uni2110': 8464,
-'uni2113': 8467,
-'uni2112': 8466,
-'mu': 181,
-'uni2281': 8833,
-'paragraph': 182,
-'nine': 57,
-'uni25EC': 9708,
-'v': 118,
-'uni040C': 1036,
-'uni0113': 275,
-'uni22D0': 8912,
-'uni21CC': 8652,
-'uni21CB': 8651,
-'uni21CA': 8650,
-'uni22A5': 8869,
-'uni21CF': 8655,
-'uni21CE': 8654,
-'uni21CD': 8653,
-'guilsinglleft': 8249,
-'backslash': 92,
-'uni2284': 8836,
-'uni224E': 8782,
-'uni224D': 8781,
-'uni224F': 8783,
-'uni224A': 8778,
-'uni2287': 8839,
-'uni224C': 8780,
-'uni224B': 8779,
-'uni21BD': 8637,
-'uni2286': 8838,
-'uni030F': 783,
-'uni030D': 781,
-'uni030E': 782,
-'uni030B': 779,
-'uni030C': 780,
-'uni030A': 778,
-'uni026E': 622,
-'uni026D': 621,
-'six': 54,
-'uni026A': 618,
-'uni026C': 620,
-'uni25C1': 9665,
-'uni20D6': 8406,
-'uni045B': 1115,
-'uni045C': 1116,
-'uni256B': 9579,
-'uni045A': 1114,
-'uni045F': 1119,
-'uni045E': 1118,
-'A': 65,
-'uni2569': 9577,
-'uni0458': 1112,
-'uni0459': 1113,
-'uni0452': 1106,
-'uni0453': 1107,
-'uni2562': 9570,
-'uni0451': 1105,
-'uni0456': 1110,
-'uni0457': 1111,
-'uni0454': 1108,
-'uni0455': 1109,
-'icircumflex': 238,
-'uni0307': 775,
-'uni0304': 772,
-'uni0305': 773,
-'uni0269': 617,
-'uni0268': 616,
-'uni0300': 768,
-'uni0301': 769,
-'uni0265': 613,
-'uni0264': 612,
-'uni0267': 615,
-'uni0266': 614,
-'uni0261': 609,
-'uni0260': 608,
-'uni0263': 611,
-'uni0262': 610,
-'a': 97,
-'uni2207': 8711,
-'uni2247': 8775,
-'uni2246': 8774,
-'uni2241': 8769,
-'uni2240': 8768,
-'uni2243': 8771,
-'uni2242': 8770,
-'uni2312': 8978,
-'ogonek': 731,
-'uni2249': 8777,
-'uni2248': 8776,
-'uni3030': 12336,
-'q': 113,
-'uni21C2': 8642,
-'uni21C1': 8641,
-'uni21C0': 8640,
-'uni21C7': 8647,
-'uni21C6': 8646,
-'uni21C5': 8645,
-'uni21C4': 8644,
-'uni225F': 8799,
-'uni212C': 8492,
-'uni21C8': 8648,
-'uni2467': 9319,
-'oacute': 243,
-'uni028F': 655,
-'uni028E': 654,
-'uni026F': 623,
-'uni028C': 652,
-'uni028B': 651,
-'uni028A': 650,
-'uni2510': 9488,
-'ograve': 242,
-'edieresis': 235,
-'uni22CE': 8910,
-'uni22CF': 8911,
-'uni219F': 8607,
-'comma': 44,
-'uni22CA': 8906,
-'uni0429': 1065,
-'uni03C6': 966,
-'uni0427': 1063,
-'uni0426': 1062,
-'uni0425': 1061,
-'uni0424': 1060,
-'uni0423': 1059,
-'uni0422': 1058,
-'uni0421': 1057,
-'uni0420': 1056,
-'uni2465': 9317,
-'uni24D0': 9424,
-'uni2464': 9316,
-'uni0430': 1072,
-'otilde': 245,
-'uni2661': 9825,
-'uni24D6': 9430,
-'uni2466': 9318,
-'uni24D5': 9429,
-'uni219A': 8602,
-'uni2518': 9496,
-'uni22B6': 8886,
-'uni2461': 9313,
-'uni24D4': 9428,
-'uni2460': 9312,
-'uni24EA': 9450,
-'guillemotright': 187,
-'ecircumflex': 234,
-'greater': 62,
-'uni2011': 8209,
-'uacute': 250,
-'uni2462': 9314,
-'L': 76,
-'bullet': 8226,
-'uni02A4': 676,
-'uni02A7': 679,
-'cedilla': 184,
-'uni02A2': 674,
-'uni2015': 8213,
-'uni22C4': 8900,
-'uni22C5': 8901,
-'uni22AD': 8877,
-'uni22C7': 8903,
-'uni22C0': 8896,
-'uni2016': 8214,
-'uni22C2': 8898,
-'uni22C3': 8899,
-'uni24CF': 9423,
-'uni042F': 1071,
-'uni042E': 1070,
-'uni042D': 1069,
-'ydieresis': 255,
-'l': 108,
-'logicalnot': 172,
-'uni24CA': 9418,
-'uni0287': 647,
-'uni0286': 646,
-'uni0285': 645,
-'uni0284': 644,
-'uni0283': 643,
-'uni0282': 642,
-'uni0281': 641,
-'uni027C': 636,
-'uni2664': 9828,
-'exclamdown': 161,
-'uni25C4': 9668,
-'uni0289': 649,
-'uni0288': 648,
-'uni039A': 922,
-'endash': 8211,
-'uni2640': 9792,
-'uni20E4': 8420,
-'uni0473': 1139,
-'uni20E1': 8417,
-'uni2642': 9794,
-'uni03B8': 952,
-'uni03B9': 953,
-'agrave': 224,
-'uni03B4': 948,
-'uni03B5': 949,
-'uni03B6': 950,
-'uni03B7': 951,
-'uni03B0': 944,
-'uni03B1': 945,
-'uni03B2': 946,
-'uni03B3': 947,
-'uni2555': 9557,
-'Adieresis': 196,
-'germandbls': 223,
-'Odieresis': 214,
-'space': 32,
-'uni0126': 294,
-'uni0127': 295,
-'uni0124': 292,
-'uni0125': 293,
-'uni0122': 290,
-'uni0123': 291,
-'uni0120': 288,
-'uni0121': 289,
-'quoteright': 8217,
-'uni2560': 9568,
-'uni2556': 9558,
-'ucircumflex': 251,
-'uni2561': 9569,
-'uni2551': 9553,
-'uni25B2': 9650,
-'uni2550': 9552,
-'uni2563': 9571,
-'uni2553': 9555,
-'G': 71,
-'uni2564': 9572,
-'uni2552': 9554,
-'quoteleft': 8216,
-'uni2565': 9573,
-'uni2572': 9586,
-'uni2568': 9576,
-'uni2566': 9574,
-'W': 87,
-'uni214A': 8522,
-'uni012F': 303,
-'uni012D': 301,
-'uni012E': 302,
-'uni012B': 299,
-'uni012C': 300,
-'uni255C': 9564,
-'uni012A': 298,
-'uni2289': 8841,
-'Q': 81,
-'uni2320': 8992,
-'uni2321': 8993,
-'g': 103,
-'uni03BD': 957,
-'uni03BE': 958,
-'uni03BF': 959,
-'uni2282': 8834,
-'uni2285': 8837,
-'uni03BA': 954,
-'uni03BB': 955,
-'uni03BC': 956,
-'uni2128': 8488,
-'uni25B7': 9655,
-'w': 119,
-'uni0302': 770,
-'uni03DE': 990,
-'uni25DA': 9690,
-'uni0303': 771,
-'uni0463': 1123,
-'uni0462': 1122,
-'uni3018': 12312,
-'uni2514': 9492,
-'question': 63,
-'uni25B3': 9651,
-'uni24E1': 9441,
-'one': 49,
-'uni200A': 8202,
-'uni2278': 8824,
-'ring': 730,
-'uni0195': 405,
-'figuredash': 8210,
-'uni22EC': 8940,
-'uni0339': 825,
-'uni0338': 824,
-'uni0337': 823,
-'uni0336': 822,
-'uni0335': 821,
-'uni0333': 819,
-'uni0332': 818,
-'uni0331': 817,
-'uni0330': 816,
-'uni01C1': 449,
-'uni01C0': 448,
-'uni01C3': 451,
-'uni01C2': 450,
-'uni2353': 9043,
-'uni0308': 776,
-'uni2218': 8728,
-'uni2219': 8729,
-'uni2216': 8726,
-'uni2217': 8727,
-'uni2214': 8724,
-'uni0309': 777,
-'uni2609': 9737,
-'uni2213': 8723,
-'uni2210': 8720,
-'uni2211': 8721,
-'uni2245': 8773,
-'B': 66,
-'uni25D6': 9686,
-'iacute': 237,
-'uni02E6': 742,
-'uni02E7': 743,
-'uni02E8': 744,
-'uni02E9': 745,
-'uni221D': 8733,
-'uni221E': 8734,
-'Ydieresis': 376,
-'uni221C': 8732,
-'uni22D7': 8919,
-'uni221A': 8730,
-'R': 82,
-'uni24DC': 9436,
-'uni033F': 831,
-'uni033E': 830,
-'uni033C': 828,
-'uni033B': 827,
-'uni033A': 826,
-'b': 98,
-'uni228A': 8842,
-'uni22DB': 8923,
-'uni2554': 9556,
-'uni046B': 1131,
-'uni046A': 1130,
-'r': 114,
-'uni24DB': 9435,
-'Ccedilla': 199,
-'minus': 8722,
-'uni24DA': 9434,
-'uni03F0': 1008,
-'uni03F1': 1009,
-'uni20AC': 8364,
-'uni2276': 8822,
-'uni24C0': 9408,
-'uni0162': 354,
-'uni0163': 355,
-'uni011E': 286,
-'uni011D': 285,
-'uni011C': 284,
-'uni011B': 283,
-'uni0164': 356,
-'uni0165': 357,
-'Lslash': 321,
-'uni0168': 360,
-'uni0169': 361,
-'uni25C9': 9673,
-'uni02E5': 741,
-'uni21C3': 8643,
-'uni24C4': 9412,
-'uni24E2': 9442,
-'uni2277': 8823,
-'uni013A': 314,
-'uni2102': 8450,
-'Uacute': 218,
-'uni2317': 8983,
-'uni2107': 8455,
-'uni221F': 8735,
-'yacute': 253,
-'uni3012': 12306,
-'Ucircumflex': 219,
-'uni015D': 349,
-'quotedbl': 34,
-'uni25D9': 9689,
-'uni2280': 8832,
-'uni22AF': 8879,
-'onehalf': 189,
-'uni221B': 8731,
-'Thorn': 222,
-'uni2226': 8742,
-'M': 77,
-'uni25BA': 9658,
-'uni2463': 9315,
-'uni2336': 9014,
-'eight': 56,
-'uni2236': 8758,
-'multiply': 215,
-'uni210C': 8460,
-'uni210A': 8458,
-'uni21C9': 8649,
-'grave': 96,
-'uni210E': 8462,
-'uni0117': 279,
-'uni016C': 364,
-'uni0115': 277,
-'uni016A': 362,
-'uni016F': 367,
-'uni0112': 274,
-'uni016D': 365,
-'uni016E': 366,
-'Ocircumflex': 212,
-'uni2305': 8965,
-'m': 109,
-'uni24DF': 9439,
-'uni0119': 281,
-'uni0118': 280,
-'uni20A3': 8355,
-'uni20A4': 8356,
-'uni20A7': 8359,
-'uni2288': 8840,
-'uni24C3': 9411,
-'uni251C': 9500,
-'uni228D': 8845,
-'uni222F': 8751,
-'uni222E': 8750,
-'uni222D': 8749,
-'uni222C': 8748,
-'uni222B': 8747,
-'uni222A': 8746,
-'uni255B': 9563,
-'Ugrave': 217,
-'uni24DE': 9438,
-'guilsinglright': 8250,
-'uni250A': 9482,
-'Ntilde': 209,
-'uni0279': 633,
-'questiondown': 191,
-'uni256C': 9580,
-'Atilde': 195,
-'uni0272': 626,
-'uni0273': 627,
-'uni0270': 624,
-'ccedilla': 231,
-'uni0276': 630,
-'uni0277': 631,
-'uni0274': 628,
-'uni0275': 629,
-'uni2252': 8786,
-'uni041F': 1055,
-'uni2250': 8784,
-'Z': 90,
-'uni2256': 8790,
-'uni2257': 8791,
-'copyright': 169,
-'uni2255': 8789,
-'uni043D': 1085,
-'uni043E': 1086,
-'uni043F': 1087,
-'yen': 165,
-'uni041D': 1053,
-'uni043B': 1083,
-'uni043C': 1084,
-'uni21B0': 8624,
-'uni21B1': 8625,
-'uni21B2': 8626,
-'uni21B3': 8627,
-'uni21B4': 8628,
-'uni21B5': 8629,
-'uni21B6': 8630,
-'uni21B7': 8631,
-'uni21B8': 8632,
-'Eacute': 201,
-'uni2311': 8977,
-'uni2310': 8976,
-'uni228F': 8847,
-'uni25DB': 9691,
-'uni21BA': 8634,
-'uni21BB': 8635,
-'uni21BC': 8636,
-'uni2017': 8215,
-'uni21BE': 8638,
-'uni21BF': 8639,
-'uni231C': 8988,
-'H': 72,
-'uni0293': 659,
-'uni2202': 8706,
-'uni22A4': 8868,
-'uni231E': 8990,
-'uni2232': 8754,
-'uni225B': 8795,
-'uni225C': 8796,
-'uni24D9': 9433,
-'uni225A': 8794,
-'uni0438': 1080,
-'uni0439': 1081,
-'uni225D': 8797,
-'uni225E': 8798,
-'uni0434': 1076,
-'X': 88,
-'uni007F': 127,
-'uni0437': 1079,
-'Idieresis': 207,
-'uni0431': 1073,
-'uni0432': 1074,
-'uni0433': 1075,
-'uni22AC': 8876,
-'uni22CD': 8909,
-'uni25A3': 9635,
-'bar': 124,
-'uni24BB': 9403,
-'uni037E': 894,
-'uni027B': 635,
-'h': 104,
-'uni027A': 634,
-'uni027F': 639,
-'uni027D': 637,
-'uni027E': 638,
-'uni2227': 8743,
-'uni2004': 8196,
-'uni2225': 8741,
-'uni2224': 8740,
-'uni2223': 8739,
-'uni2222': 8738,
-'uni2221': 8737,
-'uni2220': 8736,
-'x': 120,
-'uni2323': 8995,
-'uni2559': 9561,
-'uni2558': 9560,
-'uni2229': 8745,
-'uni2228': 8744,
-'udieresis': 252,
-'uni029D': 669,
-'ordfeminine': 170,
-'uni22CB': 8907,
-'uni233D': 9021,
-'uni0428': 1064,
-'uni24C6': 9414,
-'uni22DD': 8925,
-'uni24C7': 9415,
-'uni015C': 348,
-'uni015B': 347,
-'uni015A': 346,
-'uni22AA': 8874,
-'uni015F': 351,
-'uni015E': 350,
-'braceleft': 123,
-'uni24C5': 9413,
-'uni0410': 1040,
-'uni03AA': 938,
-'uni24C2': 9410,
-'uni03AC': 940,
-'uni03AB': 939,
-'macron': 175,
-'uni03AD': 941,
-'uni03AF': 943,
-'uni0294': 660,
-'uni0295': 661,
-'uni0296': 662,
-'uni0297': 663,
-'uni0290': 656,
-'uni0291': 657,
-'uni0292': 658,
-'atilde': 227,
-'Acircumflex': 194,
-'uni2370': 9072,
-'uni24C1': 9409,
-'uni0298': 664,
-'uni0299': 665,
-'Oslash': 216,
-'uni029E': 670,
-'C': 67,
-'quotedblleft': 8220,
-'uni029B': 667,
-'uni029C': 668,
-'uni03A9': 937,
-'uni03A8': 936,
-'S': 83,
-'uni24C9': 9417,
-'uni03A1': 929,
-'uni03A0': 928,
-'exclam': 33,
-'uni03A5': 933,
-'uni03A4': 932,
-'uni03A7': 935,
-'Zcaron': 381,
-'uni2133': 8499,
-'uni2132': 8498,
-'uni0159': 345,
-'uni0158': 344,
-'uni2137': 8503,
-'uni2005': 8197,
-'uni2135': 8501,
-'uni2134': 8500,
-'uni02BA': 698,
-'uni2033': 8243,
-'uni0151': 337,
-'uni0150': 336,
-'uni0157': 343,
-'equal': 61,
-'uni0155': 341,
-'uni0154': 340,
-'s': 115,
-'uni233F': 9023,
-'eth': 240,
-'uni24BE': 9406,
-'uni21E9': 8681,
-'uni2060': 8288,
-'Egrave': 200,
-'uni255D': 9565,
-'uni24CD': 9421,
-'uni21E1': 8673,
-'uni21B9': 8633,
-'hyphen': 45,
-'uni01BE': 446,
-'uni01BB': 443,
-'period': 46,
-'igrave': 236,
-'uni01BA': 442,
-'uni2296': 8854,
-'uni2297': 8855,
-'uni2294': 8852,
-'uni2295': 8853,
-'colon': 58,
-'uni2293': 8851,
-'uni2290': 8848,
-'uni2291': 8849,
-'uni032D': 813,
-'uni032E': 814,
-'uni032F': 815,
-'uni032A': 810,
-'uni032B': 811,
-'uni032C': 812,
-'uni231D': 8989,
-'Ecircumflex': 202,
-'uni24D7': 9431,
-'uni25DD': 9693,
-'trademark': 8482,
-'Aacute': 193,
-'cent': 162,
-'uni0445': 1093,
-'uni266E': 9838,
-'uni266D': 9837,
-'uni266B': 9835,
-'uni03C9': 969,
-'uni2003': 8195,
-'uni2047': 8263,
-'lslash': 322,
-'uni03A6': 934,
-'uni2043': 8259,
-'uni250C': 9484,
-'uni2040': 8256,
-'uni255F': 9567,
-'uni24CB': 9419,
-'uni0472': 1138,
-'uni0446': 1094,
-'uni0474': 1140,
-'uni0475': 1141,
-'uni2508': 9480,
-'uni2660': 9824,
-'uni2506': 9478,
-'uni2502': 9474,
-'c': 99,
-'uni2500': 9472,
-'N': 78,
-'uni22A6': 8870,
-'uni21E7': 8679,
-'uni2130': 8496,
-'uni2002': 8194,
-'breve': 728,
-'uni0442': 1090,
-'Oacute': 211,
-'uni229F': 8863,
-'uni25C7': 9671,
-'uni229D': 8861,
-'uni229E': 8862,
-'guillemotleft': 171,
-'uni0329': 809,
-'uni24E5': 9445,
-'uni011F': 287,
-'uni0324': 804,
-'uni0325': 805,
-'uni0326': 806,
-'uni0327': 807,
-'uni0321': 801,
-'uni0322': 802,
-'n': 110,
-'uni2032': 8242,
-'uni2269': 8809,
-'uni2268': 8808,
-'uni0306': 774,
-'uni226B': 8811,
-'uni21EA': 8682,
-'uni0166': 358,
-'uni203B': 8251,
-'uni01B5': 437,
-'idieresis': 239,
-'uni02BC': 700,
-'uni01B0': 432,
-'braceright': 125,
-'seven': 55,
-'uni02BB': 699,
-'uni011A': 282,
-'uni29FB': 10747,
-'brokenbar': 166,
-'uni2036': 8246,
-'uni25C0': 9664,
-'uni0156': 342,
-'uni22D5': 8917,
-'uni0258': 600,
-'ugrave': 249,
-'uni22D6': 8918,
-'uni22D1': 8913,
-'uni2034': 8244,
-'uni22D3': 8915,
-'uni22D2': 8914,
-'uni203C': 8252,
-'uni223E': 8766,
-'uni02BF': 703,
-'uni22D9': 8921,
-'uni22D8': 8920,
-'uni25BD': 9661,
-'uni25BE': 9662,
-'uni25BF': 9663,
-'uni041B': 1051,
-'periodcentered': 183,
-'uni25BC': 9660,
-'uni019E': 414,
-'uni019B': 411,
-'uni019A': 410,
-'uni2007': 8199,
-'uni0391': 913,
-'uni0390': 912,
-'uni0393': 915,
-'uni0392': 914,
-'uni0395': 917,
-'uni0394': 916,
-'uni0397': 919,
-'uni0396': 918,
-'uni0399': 921,
-'uni0398': 920,
-'uni25C8': 9672,
-'uni2468': 9320,
-'sterling': 163,
-'uni22EB': 8939,
-'uni039C': 924,
-'uni039B': 923,
-'uni039E': 926,
-'uni039D': 925,
-'uni039F': 927,
-'I': 73,
-'uni03E1': 993,
-'uni03E0': 992,
-'uni2319': 8985,
-'uni228B': 8843,
-'uni25B5': 9653,
-'uni25B6': 9654,
-'uni22EA': 8938,
-'uni24B9': 9401,
-'uni044E': 1102,
-'uni0199': 409,
-'uni2266': 8806,
-'Y': 89,
-'uni22A2': 8866,
-'Eth': 208,
-'uni266F': 9839,
-'emdash': 8212,
-'uni263B': 9787,
-'uni24BD': 9405,
-'uni22DE': 8926,
-'uni0360': 864,
-'uni2557': 9559,
-'uni22DF': 8927,
-'uni22DA': 8922,
-'uni22DC': 8924,
-'uni0361': 865,
-'i': 105,
-'uni24BF': 9407,
-'uni0362': 866,
-'uni263E': 9790,
-'uni028D': 653,
-'uni2259': 8793,
-'uni0323': 803,
-'uni2265': 8805,
-'daggerdbl': 8225,
-'y': 121,
-'uni010A': 266,
-'plusminus': 177,
-'less': 60,
-'uni21AE': 8622,
-'uni0315': 789,
-'uni230B': 8971,
-'uni21AF': 8623,
-'uni21AA': 8618,
-'uni21AC': 8620,
-'uni21AB': 8619,
-'uni01FB': 507,
-'uni01FC': 508,
-'uni223A': 8762,
-'uni01FA': 506,
-'uni01FF': 511,
-'uni01FD': 509,
-'uni01FE': 510,
-'uni2567': 9575,
-'uni25E0': 9696,
-'uni0104': 260,
-'uni0105': 261,
-'uni0106': 262,
-'uni0107': 263,
-'uni0100': 256,
-'uni0101': 257,
-'uni0102': 258,
-'uni0103': 259,
-'uni2038': 8248,
-'uni2009': 8201,
-'uni2008': 8200,
-'uni0108': 264,
-'uni0109': 265,
-'uni02A1': 673,
-'uni223B': 8763,
-'uni226C': 8812,
-'uni25AC': 9644,
-'uni24D3': 9427,
-'uni21E0': 8672,
-'uni21E3': 8675,
-'Udieresis': 220,
-'uni21E2': 8674,
-'D': 68,
-'uni21E5': 8677,
-'uni2621': 9761,
-'uni21D1': 8657,
-'uni203E': 8254,
-'uni22C6': 8902,
-'uni21E4': 8676,
-'uni010D': 269,
-'uni010E': 270,
-'uni010F': 271,
-'five': 53,
-'T': 84,
-'uni010B': 267,
-'uni010C': 268,
-'uni2605': 9733,
-'uni2663': 9827,
-'uni21E6': 8678,
-'uni24B6': 9398,
-'uni22C1': 8897,
-'oslash': 248,
-'acute': 180,
-'uni01F0': 496,
-'d': 100,
-'OE': 338,
-'uni22E3': 8931,
-'Igrave': 204,
-'uni2308': 8968,
-'uni2309': 8969,
-'uni21A9': 8617,
-'t': 116,
-'uni2313': 8979,
-'uni03A3': 931,
-'uni21A4': 8612,
-'uni21A7': 8615,
-'uni21A6': 8614,
-'uni21A1': 8609,
-'uni21A0': 8608,
-'uni21A3': 8611,
-'uni21A2': 8610,
-'parenright': 41,
-'uni256A': 9578,
-'uni25DC': 9692,
-'uni24CE': 9422,
-'uni042C': 1068,
-'uni24E0': 9440,
-'uni042B': 1067,
-'uni0409': 1033,
-'uni0408': 1032,
-'uni24E7': 9447,
-'uni25B4': 9652,
-'uni042A': 1066,
-'uni228E': 8846,
-'uni0401': 1025,
-'adieresis': 228,
-'uni0403': 1027,
-'quotesingle': 39,
-'uni0405': 1029,
-'uni0404': 1028,
-'uni0407': 1031,
-'uni0406': 1030,
-'uni229C': 8860,
-'uni2306': 8966,
-'uni2253': 8787,
-'twodotenleader': 8229,
-'uni2131': 8497,
-'uni21DA': 8666,
-'uni2234': 8756,
-'uni2235': 8757,
-'uni01A5': 421,
-'uni2237': 8759,
-'uni2230': 8752,
-'uni02CC': 716,
-'slash': 47,
-'uni01A0': 416,
-'ellipsis': 8230,
-'uni2299': 8857,
-'uni2238': 8760,
-'numbersign': 35,
-'uni21A8': 8616,
-'uni223D': 8765,
-'uni01AF': 431,
-'uni223F': 8767,
-'uni01AD': 429,
-'uni01AB': 427,
-'odieresis': 246,
-'uni223C': 8764,
-'uni227D': 8829,
-'uni0280': 640,
-'O': 79,
-'uni227E': 8830,
-'uni21A5': 8613,
-'uni22D4': 8916,
-'uni25D4': 9684,
-'uni227F': 8831,
-'uni0435': 1077,
-'uni2302': 8962,
-'uni2669': 9833,
-'uni24E3': 9443,
-'uni2720': 10016,
-'uni22A8': 8872,
-'uni22A9': 8873,
-'uni040A': 1034,
-'uni22A7': 8871,
-'oe': 339,
-'uni040B': 1035,
-'uni040E': 1038,
-'uni22A3': 8867,
-'o': 111,
-'uni040F': 1039,
-'Edieresis': 203,
-'uni25D5': 9685,
-'plus': 43,
-'uni044D': 1101,
-'uni263C': 9788,
-'uni22E6': 8934,
-'uni2283': 8835,
-'uni258C': 9612,
-'uni219E': 8606,
-'uni24E4': 9444,
-'uni2136': 8502,
-'dagger': 8224,
-'uni24B7': 9399,
-'uni219B': 8603,
-'uni22E5': 8933,
-'three': 51,
-'uni210B': 8459,
-'uni2534': 9524,
-'uni24B8': 9400,
-'uni230A': 8970,
-'hungarumlaut': 733,
-'parenleft': 40,
-'uni0148': 328,
-'uni0149': 329,
-'uni2124': 8484,
-'uni2125': 8485,
-'uni2126': 8486,
-'uni2127': 8487,
-'uni0140': 320,
-'uni2129': 8489,
-'uni25C5': 9669,
-'uni0143': 323,
-'uni0144': 324,
-'uni0145': 325,
-'uni0146': 326,
-'uni0147': 327,
-'uni210D': 8461,
-'fraction': 8260,
-'uni2031': 8241,
-'uni2196': 8598,
-'uni2035': 8245,
-'uni24E6': 9446,
-'uni016B': 363,
-'uni24BA': 9402,
-'uni266A': 9834,
-'uni0116': 278,
-'uni2115': 8469,
-'registered': 174,
-'J': 74,
-'uni25DF': 9695,
-'uni25CE': 9678,
-'uni273D': 10045,
-'dieresis': 168,
-'uni212B': 8491,
-'uni0114': 276,
-'uni212D': 8493,
-'uni212E': 8494,
-'uni212F': 8495,
-'uni014A': 330,
-'uni014B': 331,
-'uni014C': 332,
-'uni014D': 333,
-'uni014E': 334,
-'uni014F': 335,
-'uni025E': 606,
-'uni24E8': 9448,
-'uni0111': 273,
-'uni24E9': 9449,
-'Ograve': 210,
-'j': 106,
-'uni2195': 8597,
-'uni2194': 8596,
-'uni2197': 8599,
-'uni2037': 8247,
-'uni2191': 8593,
-'uni2190': 8592,
-'uni2193': 8595,
-'uni2192': 8594,
-'uni29FA': 10746,
-'uni2713': 10003,
-'z': 122,
-'uni2199': 8601,
-'uni2198': 8600,
-'uni2667': 9831,
-'ae': 230,
-'uni0448': 1096,
-'semicolon': 59,
-'uni2666': 9830,
-'uni038F': 911,
-'uni0444': 1092,
-'uni0447': 1095,
-'uni038E': 910,
-'uni0441': 1089,
-'uni038C': 908,
-'uni0443': 1091,
-'uni038A': 906,
-'uni0250': 592,
-'uni0251': 593,
-'uni0252': 594,
-'uni0253': 595,
-'uni0254': 596,
-'at': 64,
-'uni0256': 598,
-'uni0257': 599,
-'uni0167': 359,
-'uni0259': 601,
-'uni228C': 8844,
-'uni2662': 9826,
-'uni0319': 793,
-'uni0318': 792,
-'uni24BC': 9404,
-'uni0402': 1026,
-'uni22EF': 8943,
-'Iacute': 205,
-'uni22ED': 8941,
-'uni22EE': 8942,
-'uni0311': 785,
-'uni0310': 784,
-'uni21E8': 8680,
-'uni0312': 786,
-'percent': 37,
-'uni0317': 791,
-'uni0316': 790,
-'uni21D6': 8662,
-'uni21D7': 8663,
-'uni21D4': 8660,
-'uni21D5': 8661,
-'uni21D2': 8658,
-'uni21D3': 8659,
-'uni21D0': 8656,
-'uni2138': 8504,
-'uni2270': 8816,
-'uni2271': 8817,
-'uni2272': 8818,
-'uni2273': 8819,
-'uni2274': 8820,
-'uni2275': 8821,
-'bracketright': 93,
-'uni21D9': 8665,
-'uni21DF': 8671,
-'uni21DD': 8669,
-'uni21DE': 8670,
-'AE': 198,
-'uni03AE': 942,
-'uni227A': 8826,
-'uni227B': 8827,
-'uni227C': 8828,
-'asterisk': 42,
-'aacute': 225,
-'uni226F': 8815,
-'uni22E2': 8930,
-'uni0386': 902,
-'uni22E0': 8928,
-'uni22E1': 8929,
-'U': 85,
-'uni22E7': 8935,
-'uni22E4': 8932,
-'uni0387': 903,
-'uni031A': 794,
-'eacute': 233,
-'uni22E8': 8936,
-'uni22E9': 8937,
-'uni24D8': 9432,
-'uni025A': 602,
-'uni025B': 603,
-'uni025C': 604,
-'e': 101,
-'uni0128': 296,
-'uni025F': 607,
-'uni2665': 9829,
-'thorn': 254,
-'uni0129': 297,
-'uni253C': 9532,
-'uni25D7': 9687,
-'u': 117,
-'uni0388': 904,
-'uni0389': 905,
-'uni0255': 597,
-'uni0171': 369,
-'uni0384': 900,
-'uni0385': 901,
-'uni044A': 1098,
-'uni252C': 9516,
-'uni044C': 1100,
-'uni044B': 1099}
+type12uni = {
+ 'uni24C8' : 9416,
+ 'aring' : 229,
+ 'uni22A0' : 8864,
+ 'uni2292' : 8850,
+ 'quotedblright' : 8221,
+ 'uni03D2' : 978,
+ 'uni2215' : 8725,
+ 'uni03D0' : 976,
+ 'V' : 86,
+ 'dollar' : 36,
+ 'uni301E' : 12318,
+ 'uni03D5' : 981,
+ 'four' : 52,
+ 'uni25A0' : 9632,
+ 'uni013C' : 316,
+ 'uni013B' : 315,
+ 'uni013E' : 318,
+ 'Yacute' : 221,
+ 'uni25DE' : 9694,
+ 'uni013F' : 319,
+ 'uni255A' : 9562,
+ 'uni2606' : 9734,
+ 'uni0180' : 384,
+ 'uni22B7' : 8887,
+ 'uni044F' : 1103,
+ 'uni22B5' : 8885,
+ 'uni22B4' : 8884,
+ 'uni22AE' : 8878,
+ 'uni22B2' : 8882,
+ 'uni22B1' : 8881,
+ 'uni22B0' : 8880,
+ 'uni25CD' : 9677,
+ 'uni03CE' : 974,
+ 'uni03CD' : 973,
+ 'uni03CC' : 972,
+ 'uni03CB' : 971,
+ 'uni03CA' : 970,
+ 'uni22B8' : 8888,
+ 'uni22C9' : 8905,
+ 'uni0449' : 1097,
+ 'uni20DD' : 8413,
+ 'uni20DC' : 8412,
+ 'uni20DB' : 8411,
+ 'uni2231' : 8753,
+ 'uni25CF' : 9679,
+ 'uni306E' : 12398,
+ 'uni03D1' : 977,
+ 'uni01A1' : 417,
+ 'uni20D7' : 8407,
+ 'uni03D6' : 982,
+ 'uni2233' : 8755,
+ 'uni20D2' : 8402,
+ 'uni20D1' : 8401,
+ 'uni20D0' : 8400,
+ 'P' : 80,
+ 'uni22BE' : 8894,
+ 'uni22BD' : 8893,
+ 'uni22BC' : 8892,
+ 'uni22BB' : 8891,
+ 'underscore' : 95,
+ 'uni03C8' : 968,
+ 'uni03C7' : 967,
+ 'uni0328' : 808,
+ 'uni03C5' : 965,
+ 'uni03C4' : 964,
+ 'uni03C3' : 963,
+ 'uni03C2' : 962,
+ 'uni03C1' ...
 
[truncated message content]
From: <md...@us...> - 2010年06月28日 13:54:59
Revision: 8474
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8474&view=rev
Author: mdboom
Date: 2010年06月28日 13:54:52 +0000 (2010年6月28日)
Log Message:
-----------
Use automatic memory management to simplify the code.
Modified Paths:
--------------
 trunk/matplotlib/src/_backend_agg.cpp
 trunk/matplotlib/src/_image.cpp
 trunk/matplotlib/src/agg_py_path_iterator.h
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp	2010年06月28日 13:51:16 UTC (rev 8473)
+++ trunk/matplotlib/src/_backend_agg.cpp	2010年06月28日 13:54:52 UTC (rev 8474)
@@ -881,23 +881,24 @@
 const unsigned char* buffer = NULL;
 int width, height;
 Py::Object image_obj = args[0];
- PyArrayObject* image_array = NULL;
 
 if (PyArray_Check(image_obj.ptr()))
 {
- image_array = (PyArrayObject*)PyArray_FromObject(image_obj.ptr(), PyArray_UBYTE, 2, 2);
+ PyObject* image_array = PyArray_FromObject(
+ image_obj.ptr(), PyArray_UBYTE, 2, 2);
 if (!image_array)
 {
 throw Py::ValueError(
 "First argument to draw_text_image must be a FT2Font.Image object or a Nx2 uint8 numpy array.");
 }
+ image_obj = Py::Object(image_array, true);
 buffer = (unsigned char *)PyArray_DATA(image_array);
 width = PyArray_DIM(image_array, 1);
 height = PyArray_DIM(image_array, 0);
 }
 else
 {
- FT2Image *image = static_cast<FT2Image*>(args[0].ptr());
+ FT2Image *image = static_cast<FT2Image*>(image_obj.ptr());
 if (!image->get_buffer())
 {
 throw Py::ValueError(
@@ -916,7 +917,6 @@
 }
 catch (Py::TypeError)
 {
- Py_XDECREF(image_array);
 throw Py::TypeError("Invalid input arguments to draw_text_image");
 }
 
@@ -959,8 +959,6 @@
 theRasterizer.add_path(rect2);
 agg::render_scanlines(theRasterizer, slineP8, ri);
 
- Py_XDECREF(image_array);
-
 return Py::Object();
 }
 
@@ -1352,204 +1350,193 @@
 typedef agg::conv_curve<snapped_t> snapped_curve_t;
 typedef agg::conv_curve<clipped_t> curve_t;
 
- PyArrayObject* offsets = NULL;
- PyArrayObject* facecolors = NULL;
- PyArrayObject* edgecolors = NULL;
+ PyArrayObject* offsets = (PyArrayObject*)PyArray_FromObject
+ (offsets_obj.ptr(), PyArray_DOUBLE, 0, 2);
+ if (!offsets ||
+ (PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) ||
+ (PyArray_NDIM(offsets) == 1 && PyArray_DIM(offsets, 0) != 0))
+ {
+ Py_XDECREF(offsets);
+ throw Py::ValueError("Offsets array must be Nx2");
+ }
+ Py::Object offsets_arr_obj((PyObject*)offsets, true);
 
- try
+ PyArrayObject* facecolors = (PyArrayObject*)PyArray_FromObject
+ (facecolors_obj.ptr(), PyArray_DOUBLE, 1, 2);
+ if (!facecolors ||
+ (PyArray_NDIM(facecolors) == 1 && PyArray_DIM(facecolors, 0) != 0) ||
+ (PyArray_NDIM(facecolors) == 2 && PyArray_DIM(facecolors, 1) != 4))
 {
- offsets = (PyArrayObject*)PyArray_FromObject
- (offsets_obj.ptr(), PyArray_DOUBLE, 0, 2);
- if (!offsets ||
- (PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) ||
- (PyArray_NDIM(offsets) == 1 && PyArray_DIM(offsets, 0) != 0))
- {
- throw Py::ValueError("Offsets array must be Nx2");
- }
+ Py_XDECREF(facecolors);
+ throw Py::ValueError("Facecolors must be a Nx4 numpy array or empty");
+ }
+ Py::Object facecolors_arr_obj((PyObject*)facecolors, true);
 
- facecolors = (PyArrayObject*)PyArray_FromObject
- (facecolors_obj.ptr(), PyArray_DOUBLE, 1, 2);
- if (!facecolors ||
- (PyArray_NDIM(facecolors) == 1 && PyArray_DIM(facecolors, 0) != 0) ||
- (PyArray_NDIM(facecolors) == 2 && PyArray_DIM(facecolors, 1) != 4))
- {
- throw Py::ValueError("Facecolors must be a Nx4 numpy array or empty");
- }
+ PyArrayObject* edgecolors = (PyArrayObject*)PyArray_FromObject
+ (edgecolors_obj.ptr(), PyArray_DOUBLE, 1, 2);
+ if (!edgecolors ||
+ (PyArray_NDIM(edgecolors) == 1 && PyArray_DIM(edgecolors, 0) != 0) ||
+ (PyArray_NDIM(edgecolors) == 2 && PyArray_DIM(edgecolors, 1) != 4))
+ {
+ Py_XDECREF(edgecolors);
+ throw Py::ValueError("Edgecolors must be a Nx4 numpy array");
+ }
+ Py::Object edgecolors_arr_obj((PyObject*)edgecolors, true);
 
- edgecolors = (PyArrayObject*)PyArray_FromObject
- (edgecolors_obj.ptr(), PyArray_DOUBLE, 1, 2);
- if (!edgecolors ||
- (PyArray_NDIM(edgecolors) == 1 && PyArray_DIM(edgecolors, 0) != 0) ||
- (PyArray_NDIM(edgecolors) == 2 && PyArray_DIM(edgecolors, 1) != 4))
- {
- throw Py::ValueError("Edgecolors must be a Nx4 numpy array");
- }
+ size_t Npaths = path_generator.num_paths();
+ size_t Noffsets = offsets->dimensions[0];
+ size_t N = std::max(Npaths, Noffsets);
+ size_t Ntransforms = std::min(transforms_obj.length(), N);
+ size_t Nfacecolors = facecolors->dimensions[0];
+ size_t Nedgecolors = edgecolors->dimensions[0];
+ size_t Nlinewidths = linewidths.length();
+ size_t Nlinestyles = std::min(linestyles_obj.length(), N);
+ size_t Naa = antialiaseds.length();
 
- size_t Npaths = path_generator.num_paths();
- size_t Noffsets = offsets->dimensions[0];
- size_t N = std::max(Npaths, Noffsets);
- size_t Ntransforms = std::min(transforms_obj.length(), N);
- size_t Nfacecolors = facecolors->dimensions[0];
- size_t Nedgecolors = edgecolors->dimensions[0];
- size_t Nlinewidths = linewidths.length();
- size_t Nlinestyles = std::min(linestyles_obj.length(), N);
- size_t Naa = antialiaseds.length();
+ if ((Nfacecolors == 0 && Nedgecolors == 0) || Npaths == 0)
+ {
+ return Py::Object();
+ }
 
- if ((Nfacecolors == 0 && Nedgecolors == 0) || Npaths == 0)
- {
- return Py::Object();
- }
+ size_t i = 0;
 
- size_t i = 0;
+ // Convert all of the transforms up front
+ typedef std::vector<agg::trans_affine> transforms_t;
+ transforms_t transforms;
+ transforms.reserve(Ntransforms);
+ for (i = 0; i < Ntransforms; ++i)
+ {
+ agg::trans_affine trans = py_to_agg_transformation_matrix
+ (transforms_obj[i].ptr(), false);
+ trans *= master_transform;
 
- // Convert all of the transforms up front
- typedef std::vector<agg::trans_affine> transforms_t;
- transforms_t transforms;
- transforms.reserve(Ntransforms);
- for (i = 0; i < Ntransforms; ++i)
- {
- agg::trans_affine trans = py_to_agg_transformation_matrix
- (transforms_obj[i].ptr(), false);
- trans *= master_transform;
+ transforms.push_back(trans);
+ }
 
- transforms.push_back(trans);
+ // Convert all the dashes up front
+ typedef std::vector<std::pair<double, GCAgg::dash_t> > dashes_t;
+ dashes_t dashes;
+ dashes.resize(Nlinestyles);
+ i = 0;
+ for (dashes_t::iterator d = dashes.begin();
+ d != dashes.end(); ++d, ++i)
+ {
+ convert_dashes(Py::Tuple(linestyles_obj[i]), dpi, d->second,
+ d->first);
+ }
+
+ // Handle any clipping globally
+ theRasterizer.reset_clipping();
+ rendererBase.reset_clipping(true);
+ set_clipbox(cliprect, theRasterizer);
+ bool has_clippath = render_clippath(clippath, clippath_trans);
+
+ // Set some defaults, assuming no face or edge
+ gc.linewidth = 0.0;
+ facepair_t face;
+ face.first = Nfacecolors != 0;
+ agg::trans_affine trans;
+
+ for (i = 0; i < N; ++i)
+ {
+ typename PathGenerator::path_iterator path = path_generator(i);
+
+ if (Ntransforms)
+ {
+ trans = transforms[i % Ntransforms];
 }
+ else
+ {
+ trans = master_transform;
+ }
 
- // Convert all the dashes up front
- typedef std::vector<std::pair<double, GCAgg::dash_t> > dashes_t;
- dashes_t dashes;
- dashes.resize(Nlinestyles);
- i = 0;
- for (dashes_t::iterator d = dashes.begin();
- d != dashes.end(); ++d, ++i)
+ if (Noffsets)
 {
- convert_dashes(Py::Tuple(linestyles_obj[i]), dpi, d->second,
- d->first);
+ double xo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 0);
+ double yo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 1);
+ offset_trans.transform(&xo, &yo);
+ trans *= agg::trans_affine_translation(xo, yo);
 }
 
- // Handle any clipping globally
- theRasterizer.reset_clipping();
- rendererBase.reset_clipping(true);
- set_clipbox(cliprect, theRasterizer);
- bool has_clippath = render_clippath(clippath, clippath_trans);
+ // These transformations must be done post-offsets
+ trans *= agg::trans_affine_scaling(1.0, -1.0);
+ trans *= agg::trans_affine_translation(0.0, (double)height);
 
- // Set some defaults, assuming no face or edge
- gc.linewidth = 0.0;
- facepair_t face;
- face.first = Nfacecolors != 0;
- agg::trans_affine trans;
+ if (Nfacecolors)
+ {
+ size_t fi = i % Nfacecolors;
+ face.second = agg::rgba(
+ *(double*)PyArray_GETPTR2(facecolors, fi, 0),
+ *(double*)PyArray_GETPTR2(facecolors, fi, 1),
+ *(double*)PyArray_GETPTR2(facecolors, fi, 2),
+ *(double*)PyArray_GETPTR2(facecolors, fi, 3));
+ }
 
- for (i = 0; i < N; ++i)
+ if (Nedgecolors)
 {
- typename PathGenerator::path_iterator path = path_generator(i);
+ size_t ei = i % Nedgecolors;
+ gc.color = agg::rgba(
+ *(double*)PyArray_GETPTR2(edgecolors, ei, 0),
+ *(double*)PyArray_GETPTR2(edgecolors, ei, 1),
+ *(double*)PyArray_GETPTR2(edgecolors, ei, 2),
+ *(double*)PyArray_GETPTR2(edgecolors, ei, 3));
 
- if (Ntransforms)
+ if (Nlinewidths)
 {
- trans = transforms[i % Ntransforms];
+ gc.linewidth = double(Py::Float(linewidths[i % Nlinewidths])) * dpi / 72.0;
 }
 else
 {
- trans = master_transform;
+ gc.linewidth = 1.0;
 }
-
- if (Noffsets)
+ if (Nlinestyles)
 {
- double xo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 0);
- double yo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 1);
- offset_trans.transform(&xo, &yo);
- trans *= agg::trans_affine_translation(xo, yo);
+ gc.dashes = dashes[i % Nlinestyles].second;
+ gc.dashOffset = dashes[i % Nlinestyles].first;
 }
+ }
 
- // These transformations must be done post-offsets
- trans *= agg::trans_affine_scaling(1.0, -1.0);
- trans *= agg::trans_affine_translation(0.0, (double)height);
+ bool do_clip = !face.first && gc.hatchpath.isNone() && !has_curves;
 
- if (Nfacecolors)
+ if (check_snap)
+ {
+ gc.isaa = bool(Py::Int(antialiaseds[i % Naa]));
+
+ transformed_path_t tpath(path, trans);
+ nan_removed_t nan_removed(tpath, true, has_curves);
+ clipped_t clipped(nan_removed, do_clip, width, height);
+ snapped_t snapped(clipped, gc.snap_mode,
+ path.total_vertices(), gc.linewidth);
+ if (has_curves)
 {
- size_t fi = i % Nfacecolors;
- face.second = agg::rgba(
- *(double*)PyArray_GETPTR2(facecolors, fi, 0),
- *(double*)PyArray_GETPTR2(facecolors, fi, 1),
- *(double*)PyArray_GETPTR2(facecolors, fi, 2),
- *(double*)PyArray_GETPTR2(facecolors, fi, 3));
+ snapped_curve_t curve(snapped);
+ _draw_path(curve, has_clippath, face, gc);
 }
-
- if (Nedgecolors)
+ else
 {
- size_t ei = i % Nedgecolors;
- gc.color = agg::rgba(
- *(double*)PyArray_GETPTR2(edgecolors, ei, 0),
- *(double*)PyArray_GETPTR2(edgecolors, ei, 1),
- *(double*)PyArray_GETPTR2(edgecolors, ei, 2),
- *(double*)PyArray_GETPTR2(edgecolors, ei, 3));
-
- if (Nlinewidths)
- {
- gc.linewidth = double(Py::Float(linewidths[i % Nlinewidths])) * dpi / 72.0;
- }
- else
- {
- gc.linewidth = 1.0;
- }
- if (Nlinestyles)
- {
- gc.dashes = dashes[i % Nlinestyles].second;
- gc.dashOffset = dashes[i % Nlinestyles].first;
- }
+ _draw_path(snapped, has_clippath, face, gc);
 }
+ }
+ else
+ {
+ gc.isaa = bool(Py::Int(antialiaseds[i % Naa]));
 
- bool do_clip = !face.first && gc.hatchpath.isNone() && !has_curves;
-
- if (check_snap)
+ transformed_path_t tpath(path, trans);
+ nan_removed_t nan_removed(tpath, true, has_curves);
+ clipped_t clipped(nan_removed, do_clip, width, height);
+ if (has_curves)
 {
- gc.isaa = bool(Py::Int(antialiaseds[i % Naa]));
-
- transformed_path_t tpath(path, trans);
- nan_removed_t nan_removed(tpath, true, has_curves);
- clipped_t clipped(nan_removed, do_clip, width, height);
- snapped_t snapped(clipped, gc.snap_mode,
- path.total_vertices(), gc.linewidth);
- if (has_curves)
- {
- snapped_curve_t curve(snapped);
- _draw_path(curve, has_clippath, face, gc);
- }
- else
- {
- _draw_path(snapped, has_clippath, face, gc);
- }
+ curve_t curve(clipped);
+ _draw_path(curve, has_clippath, face, gc);
 }
 else
 {
- gc.isaa = bool(Py::Int(antialiaseds[i % Naa]));
-
- transformed_path_t tpath(path, trans);
- nan_removed_t nan_removed(tpath, true, has_curves);
- clipped_t clipped(nan_removed, do_clip, width, height);
- if (has_curves)
- {
- curve_t curve(clipped);
- _draw_path(curve, has_clippath, face, gc);
- }
- else
- {
- _draw_path(clipped, has_clippath, face, gc);
- }
+ _draw_path(clipped, has_clippath, face, gc);
 }
 }
-
- Py_XDECREF(offsets);
- Py_XDECREF(facecolors);
- Py_XDECREF(edgecolors);
- return Py::Object();
 }
- catch (...)
- {
- Py_XDECREF(offsets);
- Py_XDECREF(facecolors);
- Py_XDECREF(edgecolors);
- throw;
- }
+
+ return Py::Object();
 }
 
 
@@ -1741,7 +1728,7 @@
 agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[1].ptr());
 size_t mesh_width = Py::Int(args[2]);
 size_t mesh_height = Py::Int(args[3]);
- PyObject* coordinates = args[4].ptr();
+ Py::Object coordinates = args[4];
 Py::Object offsets_obj = args[5];
 agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[6].ptr());
 Py::Object facecolors_obj = args[7];
@@ -1749,7 +1736,7 @@
 bool showedges = (bool)Py::Int(args[9]);
 bool free_edgecolors = false;
 
- QuadMeshGenerator path_generator(mesh_width, mesh_height, coordinates);
+ QuadMeshGenerator path_generator(mesh_width, mesh_height, coordinates.ptr());
 
 Py::SeqBase<Py::Object> transforms_obj;
 Py::Object edgecolors_obj;
@@ -1763,9 +1750,8 @@
 {
 npy_intp dims[] = { 1, 4, 0 };
 double data[] = { 0, 0, 0, 1 };
- edgecolors_obj = PyArray_SimpleNewFromData(2, dims, PyArray_DOUBLE,
- (char*)data);
- free_edgecolors = true;
+ edgecolors_obj = Py::Object(PyArray_SimpleNewFromData(2, dims, PyArray_DOUBLE,
+ (char*)data), true);
 }
 else
 {
@@ -1783,9 +1769,7 @@
 
 try
 {
- try
- {
- _draw_path_collection_generic<QuadMeshGenerator, 0, 0>
+ _draw_path_collection_generic<QuadMeshGenerator, 0, 0>
 (gc,
 master_transform,
 gc.cliprect,
@@ -1800,26 +1784,12 @@
 linewidths,
 linestyles_obj,
 antialiaseds);
- }
- catch (const char* e)
- {
- throw Py::RuntimeError(e);
- }
 }
- catch (...)
+ catch (const char* e)
 {
- if (free_edgecolors)
- {
- Py_XDECREF(edgecolors_obj.ptr());
- }
- throw;
+ throw Py::RuntimeError(e);
 }
 
- if (free_edgecolors)
- {
- Py_XDECREF(edgecolors_obj.ptr());
- }
-
 return Py::Object();
 }
 
@@ -1890,46 +1860,34 @@
 Py::Object colors_obj = args[2];
 agg::trans_affine trans = py_to_agg_transformation_matrix(args[3].ptr());
 
- PyArrayObject* points = NULL;
- PyArrayObject* colors = NULL;
-
 theRasterizer.reset_clipping();
 rendererBase.reset_clipping(true);
 set_clipbox(gc.cliprect, theRasterizer);
 bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
 
- try
+ PyArrayObject* points = (PyArrayObject*)PyArray_ContiguousFromAny
+ (points_obj.ptr(), PyArray_DOUBLE, 2, 2);
+ if (!points ||
+ PyArray_DIM(points, 0) != 3 || PyArray_DIM(points, 1) != 2)
 {
- points = (PyArrayObject*)PyArray_ContiguousFromAny
- (points_obj.ptr(), PyArray_DOUBLE, 2, 2);
- if (!points ||
- PyArray_DIM(points, 0) != 3 || PyArray_DIM(points, 1) != 2)
- {
- throw Py::ValueError("points must be a 3x2 numpy array");
- }
-
- colors = (PyArrayObject*)PyArray_ContiguousFromAny
- (colors_obj.ptr(), PyArray_DOUBLE, 2, 2);
- if (!colors ||
- PyArray_DIM(colors, 0) != 3 || PyArray_DIM(colors, 1) != 4)
- {
- throw Py::ValueError("colors must be a 3x4 numpy array");
- }
-
- _draw_gouraud_triangle(
- (double*)PyArray_DATA(points), (double*)PyArray_DATA(colors),
- trans, has_clippath);
+ Py_XDECREF(points);
+ throw Py::ValueError("points must be a 3x2 numpy array");
 }
- catch (...)
+ points_obj = Py::Object((PyObject*)points, true);
+
+ PyArrayObject* colors = (PyArrayObject*)PyArray_ContiguousFromAny
+ (colors_obj.ptr(), PyArray_DOUBLE, 2, 2);
+ if (!colors ||
+ PyArray_DIM(colors, 0) != 3 || PyArray_DIM(colors, 1) != 4)
 {
- Py_XDECREF(points);
 Py_XDECREF(colors);
-
- throw;
+ throw Py::ValueError("colors must be a 3x4 numpy array");
 }
+ colors_obj = Py::Object((PyObject*)colors, true);
 
- Py_XDECREF(points);
- Py_XDECREF(colors);
+ _draw_gouraud_triangle(
+ (double*)PyArray_DATA(points), (double*)PyArray_DATA(colors),
+ trans, has_clippath);
 
 return Py::Object();
 }
@@ -1950,54 +1908,42 @@
 Py::Object colors_obj = args[2];
 agg::trans_affine trans = py_to_agg_transformation_matrix(args[3].ptr());
 
- PyArrayObject* points = NULL;
- PyArrayObject* colors = NULL;
-
 theRasterizer.reset_clipping();
 rendererBase.reset_clipping(true);
 set_clipbox(gc.cliprect, theRasterizer);
 bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
 
- try
+ PyArrayObject* points = (PyArrayObject*)PyArray_ContiguousFromAny
+ (points_obj.ptr(), PyArray_DOUBLE, 3, 3);
+ if (!points ||
+ PyArray_DIM(points, 1) != 3 || PyArray_DIM(points, 2) != 2)
 {
- points = (PyArrayObject*)PyArray_ContiguousFromAny
- (points_obj.ptr(), PyArray_DOUBLE, 3, 3);
- if (!points ||
- PyArray_DIM(points, 1) != 3 || PyArray_DIM(points, 2) != 2)
- {
- throw Py::ValueError("points must be a Nx3x2 numpy array");
- }
-
- colors = (PyArrayObject*)PyArray_ContiguousFromAny
- (colors_obj.ptr(), PyArray_DOUBLE, 3, 3);
- if (!colors ||
- PyArray_DIM(colors, 1) != 3 || PyArray_DIM(colors, 2) != 4)
- {
- throw Py::ValueError("colors must be a Nx3x4 numpy array");
- }
-
- if (PyArray_DIM(points, 0) != PyArray_DIM(colors, 0))
- {
- throw Py::ValueError("points and colors arrays must be the same length");
- }
-
- for (int i = 0; i < PyArray_DIM(points, 0); ++i)
- {
- _draw_gouraud_triangle(
- (double*)PyArray_GETPTR1(points, i),
- (double*)PyArray_GETPTR1(colors, i), trans, has_clippath);
- }
+ Py_XDECREF(points);
+ throw Py::ValueError("points must be a Nx3x2 numpy array");
 }
- catch (...)
+ points_obj = Py::Object((PyObject*)points, true);
+
+ PyArrayObject* colors = (PyArrayObject*)PyArray_ContiguousFromAny
+ (colors_obj.ptr(), PyArray_DOUBLE, 3, 3);
+ if (!colors ||
+ PyArray_DIM(colors, 1) != 3 || PyArray_DIM(colors, 2) != 4)
 {
- Py_XDECREF(points);
 Py_XDECREF(colors);
+ throw Py::ValueError("colors must be a Nx3x4 numpy array");
+ }
+ colors_obj = Py::Object((PyObject*)colors, true);
 
- throw;
+ if (PyArray_DIM(points, 0) != PyArray_DIM(colors, 0))
+ {
+ throw Py::ValueError("points and colors arrays must be the same length");
 }
 
- Py_XDECREF(points);
- Py_XDECREF(colors);
+ for (int i = 0; i < PyArray_DIM(points, 0); ++i)
+ {
+ _draw_gouraud_triangle(
+ (double*)PyArray_GETPTR1(points, i),
+ (double*)PyArray_GETPTR1(colors, i), trans, has_clippath);
+ }
 
 return Py::Object();
 }
Modified: trunk/matplotlib/src/_image.cpp
===================================================================
--- trunk/matplotlib/src/_image.cpp	2010年06月28日 13:51:16 UTC (rev 8473)
+++ trunk/matplotlib/src/_image.cpp	2010年06月28日 13:54:52 UTC (rev 8474)
@@ -864,15 +864,13 @@
 
 Py::Object x = args[0];
 int isoutput = Py::Int(args[1]);
- //PyArrayObject *A = (PyArrayObject *) PyArray_ContiguousFromObject(x.ptr(), PyArray_DOUBLE, 2, 3);
 PyArrayObject *A = (PyArrayObject *) PyArray_FromObject(x.ptr(), PyArray_DOUBLE, 2, 3);
-
 if (A == NULL)
 {
 throw Py::ValueError("Array must be rank 2 or 3 of doubles");
 }
+ Py::Object A_obj((PyObject *)A, true);
 
-
 Image* imo = new Image;
 
 imo->rowsIn = A->dimensions[0];
@@ -924,7 +922,6 @@
 
 if (A->dimensions[2] != 3 && A->dimensions[2] != 4)
 {
- Py_XDECREF(A);
 throw Py::ValueError(Printf("3rd dimension must be length 3 (RGB) or 4 (RGBA); found %d", A->dimensions[2]).str());
 }
 
@@ -959,11 +956,9 @@
 }
 else // error
 {
- Py_XDECREF(A);
 throw Py::ValueError("Illegal array rank; must be rank; must 2 or 3");
 }
 buffer -= NUMBYTES;
- Py_XDECREF(A);
 
 return Py::asObject(imo);
 }
@@ -986,12 +981,11 @@
 Py::Object x = args[0];
 int isoutput = Py::Int(args[1]);
 PyArrayObject *A = (PyArrayObject *) PyArray_ContiguousFromObject(x.ptr(), PyArray_DOUBLE, 2, 3);
- //PyArrayObject *A = (PyArrayObject *) PyArray_FromObject(x.ptr(), PyArray_DOUBLE, 2, 3);
-
 if (A == NULL)
 {
 throw Py::ValueError("Array must be rank 2 or 3 of doubles");
 }
+ Py::Object A_obj((PyObject*)A, true);
 
 Image* imo = new Image;
 
@@ -1043,7 +1037,6 @@
 {
 if (A->dimensions[2] != 3 && A->dimensions[2] != 4)
 {
- Py_XDECREF(A);
 throw Py::ValueError(Printf("3rd dimension must be length 3 (RGB) or 4 (RGBA); found %d", A->dimensions[2]).str());
 
 }
@@ -1072,11 +1065,9 @@
 }
 else // error
 {
- Py_XDECREF(A);
 throw Py::ValueError("Illegal array rank; must be rank; must 2 or 3");
 }
 buffer -= NUMBYTES;
- Py_XDECREF(A);
 
 return Py::asObject(imo);
 }
@@ -1104,6 +1095,8 @@
 {
 throw Py::ValueError("Array must have 3 dimensions");
 }
+ Py::Object A_obj((PyObject*)A, true);
+
 if (A->dimensions[2] < 3 || A->dimensions[2] > 4)
 {
 throw Py::ValueError("Array dimension 3 must have size 3 or 4");
@@ -1146,7 +1139,6 @@
 buffer -= N;
 arrbuf -= imo->rowsIn * imo->colsIn;
 }
- Py_XDECREF(A);
 
 if (isoutput)
 {
@@ -1456,18 +1448,9 @@
 unsigned int * rowstarts , unsigned int*colstarts ,
 float *acols , float *arows)
 {
- if (x)
- {
- Py_XDECREF(x);
- }
- if (y)
- {
- Py_XDECREF(y);
- }
- if (d)
- {
- Py_XDECREF(d);
- }
+ Py_XDECREF(x);
+ Py_XDECREF(y);
+ Py_XDECREF(d);
 if (rowstarts)
 {
 PyMem_Free(rowstarts);
@@ -1494,7 +1477,9 @@
 
 
 if (args.length() != 7)
+ {
 throw Py::TypeError("Incorrect number of arguments (7 expected)");
+ }
 
 Py::Object xp = args[0];
 Py::Object yp = args[1];
@@ -1510,7 +1495,10 @@
 }
 
 if (bounds.length() != 4)
+ {
 throw Py::TypeError("Incorrect number of bounds (4 expected)");
+ }
+
 float x_min = Py::Float(bounds[0]);
 float x_max = Py::Float(bounds[1]);
 float y_min = Py::Float(bounds[2]);
@@ -1529,8 +1517,8 @@
 PyArrayObject *x = NULL;
 PyArrayObject *y = NULL;
 PyArrayObject *d = NULL;
- unsigned int * rowstarts = NULL;
- unsigned int*colstarts = NULL;
+ unsigned int *rowstarts = NULL;
+ unsigned int *colstarts = NULL;
 float *acols = NULL;
 float *arows = NULL;
 
@@ -1704,7 +1692,24 @@
 
 }
 
+void _pcolor2_cleanup(PyArrayObject* x, PyArrayObject* y, PyArrayObject *d,
+ PyArrayObject* bg, int *irows, int*jcols)
+{
+ Py_XDECREF(x);
+ Py_XDECREF(y);
+ Py_XDECREF(d);
+ Py_XDECREF(bg);
+ if (irows)
+ {
+ PyMem_Free(irows);
+ }
+ if (jcols)
+ {
+ PyMem_Free(jcols);
+ }
+}
 
+
 char __image_module_pcolor2__doc__[] =
 "pcolor2(x, y, data, rows, cols, bounds, bg)\n"
 "\n"
@@ -1748,33 +1753,39 @@
 
 // Check we have something to output to
 if (rows == 0 || cols == 0)
+ {
 throw Py::ValueError("rows or cols is zero; there are no pixels");
+ }
 
+ PyArrayObject* x = NULL;
+ PyArrayObject* y = NULL;
+ PyArrayObject* d = NULL;
+ PyArrayObject* bg = NULL;
+ int* irows = NULL;
+ int* jcols = NULL;
+
 // Get numpy arrays
- PyArrayObject *x = (PyArrayObject *) PyArray_ContiguousFromObject(xp.ptr(),
- PyArray_DOUBLE, 1, 1);
+ x = (PyArrayObject *) PyArray_ContiguousFromObject(xp.ptr(), PyArray_DOUBLE, 1, 1);
 if (x == NULL)
+ {
+ _pcolor2_cleanup(x, y, d, bg, irows, jcols);
 throw Py::ValueError("x is of incorrect type (wanted 1D double)");
- PyArrayObject *y = (PyArrayObject *) PyArray_ContiguousFromObject(yp.ptr(),
- PyArray_DOUBLE, 1, 1);
+ }
+ y = (PyArrayObject *) PyArray_ContiguousFromObject(yp.ptr(), PyArray_DOUBLE, 1, 1);
 if (y == NULL)
 {
- Py_XDECREF(x);
+ _pcolor2_cleanup(x, y, d, bg, irows, jcols);
 throw Py::ValueError("y is of incorrect type (wanted 1D double)");
 }
- PyArrayObject *d = (PyArrayObject *) PyArray_ContiguousFromObject(dp.ptr(),
- PyArray_UBYTE, 3, 3);
+ d = (PyArrayObject *) PyArray_ContiguousFromObject(dp.ptr(), PyArray_UBYTE, 3, 3);
 if (d == NULL)
 {
- Py_XDECREF(x);
- Py_XDECREF(y);
+ _pcolor2_cleanup(x, y, d, bg, irows, jcols);
 throw Py::ValueError("data is of incorrect type (wanted 3D uint8)");
 }
 if (d->dimensions[2] != 4)
 {
- Py_XDECREF(x);
- Py_XDECREF(y);
- Py_XDECREF(d);
+ _pcolor2_cleanup(x, y, d, bg, irows, jcols);
 throw Py::ValueError("data must be in RGBA format");
 }
 
@@ -1783,49 +1794,33 @@
 int ny = y->dimensions[0];
 if (nx != d->dimensions[1] + 1 || ny != d->dimensions[0] + 1)
 {
- Py_XDECREF(x);
- Py_XDECREF(y);
- Py_XDECREF(d);
+ _pcolor2_cleanup(x, y, d, bg, irows, jcols);
 throw Py::ValueError("data and axis bin boundary dimensions are incompatible");
 }
 
- PyArrayObject *bg = (PyArrayObject *) PyArray_ContiguousFromObject(bgp.ptr(),
- PyArray_UBYTE, 1, 1);
+ bg = (PyArrayObject *) PyArray_ContiguousFromObject(bgp.ptr(), PyArray_UBYTE, 1, 1);
 if (bg == NULL)
 {
- Py_XDECREF(x);
- Py_XDECREF(y);
- Py_XDECREF(d);
+ _pcolor2_cleanup(x, y, d, bg, irows, jcols);
 throw Py::ValueError("bg is of incorrect type (wanted 1D uint8)");
 }
 if (bg->dimensions[0] != 4)
 {
- Py_XDECREF(x);
- Py_XDECREF(y);
- Py_XDECREF(d);
- Py_XDECREF(bg);
+ _pcolor2_cleanup(x, y, d, bg, irows, jcols);
 throw Py::ValueError("bg must be in RGBA format");
 }
 
-
 // Allocate memory for pointer arrays
- int * irows = reinterpret_cast<int*>(PyMem_Malloc(sizeof(int) * rows));
+ irows = reinterpret_cast<int*>(PyMem_Malloc(sizeof(int) * rows));
 if (irows == NULL)
 {
- Py_XDECREF(x);
- Py_XDECREF(y);
- Py_XDECREF(d);
- Py_XDECREF(bg);
+ _pcolor2_cleanup(x, y, d, bg, irows, jcols);
 throw Py::MemoryError("Cannot allocate memory for lookup table");
 }
- int * jcols = reinterpret_cast<int*>(PyMem_Malloc(sizeof(int) * cols));
+ jcols = reinterpret_cast<int*>(PyMem_Malloc(sizeof(int) * cols));
 if (jcols == NULL)
 {
- Py_XDECREF(x);
- Py_XDECREF(y);
- Py_XDECREF(d);
- Py_XDECREF(bg);
- PyMem_Free(irows);
+ _pcolor2_cleanup(x, y, d, bg, irows, jcols);
 throw Py::MemoryError("Cannot allocate memory for lookup table");
 }
 
@@ -1839,12 +1834,7 @@
 agg::int8u *buffer = new agg::int8u[NUMBYTES];
 if (buffer == NULL)
 {
- Py_XDECREF(x);
- Py_XDECREF(y);
- Py_XDECREF(d);
- Py_XDECREF(bg);
- PyMem_Free(irows);
- PyMem_Free(jcols);
+ _pcolor2_cleanup(x, y, d, bg, irows, jcols);
 throw Py::MemoryError("Could not allocate memory for image");
 }
 
@@ -1886,12 +1876,7 @@
 imo->bufferOut = buffer;
 imo->rbufOut->attach(imo->bufferOut, imo->colsOut, imo->rowsOut, imo->colsOut * imo->BPP);
 
- Py_XDECREF(x);
- Py_XDECREF(y);
- Py_XDECREF(d);
- Py_XDECREF(bg);
- PyMem_Free(irows);
- PyMem_Free(jcols);
+ _pcolor2_cleanup(x, y, d, bg, irows, jcols);
 
 return Py::asObject(imo);
 }
Modified: trunk/matplotlib/src/agg_py_path_iterator.h
===================================================================
--- trunk/matplotlib/src/agg_py_path_iterator.h	2010年06月28日 13:51:16 UTC (rev 8473)
+++ trunk/matplotlib/src/agg_py_path_iterator.h	2010年06月28日 13:54:52 UTC (rev 8474)
@@ -24,8 +24,8 @@
 underlying data arrays, so that Python reference counting can
 work.
 */
- PyArrayObject* m_vertices;
- PyArrayObject* m_codes;
+ Py::Object m_vertices;
+ Py::Object m_codes;
 
 size_t m_iterator;
 size_t m_total_vertices;
@@ -39,7 +39,7 @@
 public:
 /* path_obj is an instance of the class Path as defined in path.py */
 inline PathIterator(const Py::Object& path_obj) :
- m_vertices(NULL), m_codes(NULL), m_iterator(0), m_should_simplify(false),
+ m_vertices(), m_codes(), m_iterator(0), m_should_simplify(false),
 m_simplify_threshold(1.0 / 9.0)
 {
 Py::Object vertices_obj = path_obj.getAttr("vertices");
@@ -47,45 +47,42 @@
 Py::Object should_simplify_obj = path_obj.getAttr("should_simplify");
 Py::Object simplify_threshold_obj = path_obj.getAttr("simplify_threshold");
 
- m_vertices = (PyArrayObject*)PyArray_FromObject
- (vertices_obj.ptr(), PyArray_DOUBLE, 2, 2);
- if (!m_vertices ||
- PyArray_DIM(m_vertices, 1) != 2)
+ PyObject* vertices_arr = PyArray_FromObject(vertices_obj.ptr(), PyArray_DOUBLE, 2, 2);
+ if (!vertices_arr)
 {
- Py_XDECREF(m_vertices);
- m_vertices = NULL;
 throw Py::ValueError("Invalid vertices array.");
 }
 
+ m_vertices = Py::Object(vertices_arr, true);
+ if (PyArray_DIM(m_vertices.ptr(), 1) != 2)
+ {
+ throw Py::ValueError("Invalid vertices array.");
+ }
+
 if (codes_obj.ptr() != Py_None)
 {
- m_codes = (PyArrayObject*)PyArray_FromObject
- (codes_obj.ptr(), PyArray_UINT8, 1, 1);
- if (!m_codes)
+ PyObject* codes_arr = PyArray_FromObject(codes_obj.ptr(), PyArray_UINT8, 1, 1);
+
+ if (!codes_arr)
 {
- Py_XDECREF(m_vertices);
- m_vertices = NULL;
 throw Py::ValueError("Invalid codes array.");
 }
- if (PyArray_DIM(m_codes, 0) != PyArray_DIM(m_vertices, 0))
+
+ m_codes = Py::Object(codes_arr, true);
+ if (PyArray_DIM(m_codes.ptr(), 0) != PyArray_DIM(m_vertices.ptr(), 0))
 {
- Py_XDECREF(m_vertices);
- m_vertices = NULL;
- Py_XDECREF(m_codes);
- m_codes = NULL;
 throw Py::ValueError("Codes array is wrong length");
 }
 }
 
 m_should_simplify = should_simplify_obj.isTrue();
- m_total_vertices = PyArray_DIM(m_vertices, 0);
+ m_total_vertices = PyArray_DIM(m_vertices.ptr(), 0);
 m_simplify_threshold = Py::Float(simplify_threshold_obj);
 }
 
 ~PathIterator()
 {
- Py_XDECREF(m_vertices);
- Py_XDECREF(m_codes);
+
 }
 
 inline unsigned vertex(double* x, double* y)
@@ -94,13 +91,13 @@
 
 const size_t idx = m_iterator++;
 
- char* pair = (char*)PyArray_GETPTR2(m_vertices, idx, 0);
+ char* pair = (char*)PyArray_GETPTR2(m_vertices.ptr(), idx, 0);
 *x = *(double*)pair;
- *y = *(double*)(pair + PyArray_STRIDE(m_vertices, 1));
+ *y = *(double*)(pair + PyArray_STRIDE(m_vertices.ptr(), 1));
 
- if (m_codes)
+ if (!m_codes.isNone())
 {
- return (unsigned)(*(char *)PyArray_GETPTR1(m_codes, idx));
+ return (unsigned)(*(char *)PyArray_GETPTR1(m_codes.ptr(), idx));
 }
 else
 {
@@ -130,7 +127,7 @@
 
 inline bool has_curves()
 {
- return m_codes != NULL;
+ return !m_codes.isNone();
 }
 };
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8473
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8473&view=rev
Author: mdboom
Date: 2010年06月28日 13:51:16 +0000 (2010年6月28日)
Log Message:
-----------
Fix broken result image.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg
Modified: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg
===================================================================
--- trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg	2010年06月27日 02:07:17 UTC (rev 8472)
+++ trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg	2010年06月28日 13:51:16 UTC (rev 8473)
@@ -23,8 +23,9 @@
 <clipPath id="p7a7a30041bcd0eda414889f4295b8ec2">
 <rect x="0.000000" y="0.000000" width="144.000000" height="72.000000"/>
 </clipPath>
-</defs><path style="fill: none; stroke: #0000ff; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" clip-path="url(#p7a7a30041bcd0eda414889f4295b8ec2)" d="M-180.000000 72.000000L36.000000 72.000000L72.000000 14.400000
-L108.000000 72.000000L144.000000 0.000000"/>
+</defs><path style="fill: none; stroke: #0000ff; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" clip-path="url(#p7a7a30041bcd0eda414889f4295b8ec2)" d="M-180.000000 72.000000M-1.000000 30.000000L0.000000 28.800000
+L36.000000 72.000000L72.000000 14.400000L108.000000 72.000000
+L144.000000 0.000000"/>
 </g>
 <g id="matplotlib.axis1">
 <g id="xtick1">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <lee...@us...> - 2010年06月27日 02:07:23
Revision: 8472
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8472&view=rev
Author: leejjoon
Date: 2010年06月27日 02:07:17 +0000 (2010年6月27日)
Log Message:
-----------
_get_unsampled_image now returns a sliced image if possible
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/image.py
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py	2010年06月26日 19:29:48 UTC (rev 8471)
+++ trunk/matplotlib/lib/matplotlib/image.py	2010年06月27日 02:07:17 UTC (rev 8472)
@@ -24,7 +24,7 @@
 # the image namespace:
 from matplotlib._image import *
 
-from matplotlib.transforms import BboxBase
+from matplotlib.transforms import BboxBase, Bbox
 import matplotlib.transforms as mtransforms
 
 class _AxesImageBase(martist.Artist, cm.ScalarMappable):
@@ -135,7 +135,7 @@
 raise RuntimeError('The make_image method must be overridden.')
 
 
- def _get_unsampled_image(self, A, image_extents, viewlim, noslice=False):
+ def _get_unsampled_image(self, A, image_extents, viewlim):
 """
 convert numpy array A with given extents ([x1, x2, y1, y2] in
 data coordinate) into the Image, given the vielim (should be a
@@ -150,7 +150,7 @@
 sx = dxintv/viewlim.width
 sy = dyintv/viewlim.height
 numrows, numcols = A.shape[:2]
- if noslice is False and sx > 2:
+ if sx > 2:
 x0 = (viewlim.x0-xmin)/dxintv * numcols
 ix0 = max(0, int(x0 - self._filterrad))
 x1 = (viewlim.x1-xmin)/dxintv * numcols
@@ -164,7 +164,7 @@
 else:
 xslice = slice(0, numcols)
 
- if noslice is False and sy > 2:
+ if sy > 2:
 y0 = (viewlim.y0-ymin)/dyintv * numrows
 iy0 = max(0, int(y0 - self._filterrad))
 y1 = (viewlim.y1-ymin)/dyintv * numrows
@@ -248,9 +248,57 @@
 """
 
 
+ trans = self.get_transform() #axes.transData
+
+ # convert the coordinates to the intermediate coordinate (ic).
+ # The transformation from the ic to the canvas is a pure
+ # affine transfor.
+
+ # A straight-forward way is to use the non-affine part of the
+ # original transform for conversion to the ic.
+
+ # firs, convert the image extent to the ic
+ x_llc, x_trc, y_llc, y_trc = self.get_extent()
+
+ xy = trans.transform_non_affine(np.array([(x_llc, y_llc),
+ (x_trc, y_trc)]))
+
+ _xx1, _yy1 = xy[0]
+ _xx2, _yy2 = xy[1]
+
+ extent_in_ic = _xx1, _xx2, _yy1, _yy2
+
+ # define trans_ic_to_canvas : unless _image_skew_coordinate is
+ # set, it is simply a affine part of the original transform.
+ if self._image_skew_coordinate:
+ # skew the image when required.
+ x_lrc, y_lrc = self._image_skew_coordinate
+ xy2 = trans.transform_non_affine(np.array([(x_lrc, y_lrc)]))
+ _xx3, _yy3 = xy2[0]
+
+ tr_rotate_skew = self._get_rotate_and_skew_transform(_xx1, _yy1,
+ _xx2, _yy2,
+ _xx3, _yy3)
+ trans_ic_to_canvas = tr_rotate_skew+trans.get_affine()
+ else:
+ trans_ic_to_canvas = trans.get_affine()
+
+ # Now, viewLim in the ic. It can be roated and can be
+ # skewed. Make it big enough.
+ x1, y1, x2, y2 = self.axes.bbox.extents
+ trans_canvas_to_ic = trans_ic_to_canvas.inverted()
+ xy_ = trans_canvas_to_ic.transform(np.array([(x1, y1),
+ (x2, y1),
+ (x2, y2),
+ (x1, y2)]))
+ x1_, x2_ = min(xy_[:,0]), max(xy_[:,0])
+ y1_, y2_ = min(xy_[:,1]), max(xy_[:,1])
+ viewLim_in_ic = Bbox.from_extents(x1_, y1_, x2_, y2_)
+
+
+ # get the image, sliced if necessary. This is done in the ic.
 im, xmin, ymin, dxintv, dyintv, sx, sy = \
- self._get_unsampled_image(self._A, self.get_extent(),
- self.axes.viewLim, noslice=True)
+ self._get_unsampled_image(self._A, extent_in_ic, viewLim_in_ic)
 
 if im is None: return # I'm not if this check is required. -JJL
 
@@ -262,35 +310,16 @@
 im.reset_matrix()
 numrows, numcols = im.get_size()
 
- im.resize(numcols, numrows) # just to create im.bufOut that is required by backends. There may be better solution -JJL
+ im.resize(numcols, numrows) # just to create im.bufOut that
+ # is required by backends. There
+ # may be better solution -JJL
 
 im._url = self.get_url()
 
- trans = self.get_transform() #axes.transData
- xy = trans.transform_non_affine(np.array([(xmin, ymin),
- (xmin+dxintv, ymin+dyintv)]))
- xx1, yy1 = xy[0]
- xx2, yy2 = xy[1]
+ renderer.draw_image(gc, xmin, ymin, im, dxintv, dyintv,
+ trans_ic_to_canvas)
 
- if self._image_skew_coordinate:
- # skew the image when required.
- x_llc, x_trc, y_llc, y_trc = self.get_extent()
- x_lrc, y_lrc = self._image_skew_coordinate
- xy = trans.transform_non_affine(np.array([(x_llc, y_llc),
- (x_trc, y_trc),
- (x_lrc, y_lrc)]))
- _xx1, _yy1 = xy[0]
- _xx2, _yy2 = xy[1]
- _xx3, _yy3 = xy[2]
 
- tr_rotate_skew = self._get_rotate_and_skew_transform(_xx1, _yy1, _xx2, _yy2, _xx3, _yy3)
- tr = tr_rotate_skew+trans.get_affine()
- else:
- tr = trans.get_affine()
-
- renderer.draw_image(gc, xx1, yy1, im, xx2-xx1, yy2-yy1, tr)
-
-
 def _check_unsampled_image(self, renderer):
 """
 return True if the image is better to be drawn unsampled.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2010年06月26日 19:29:54
Revision: 8471
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8471&view=rev
Author: efiring
Date: 2010年06月26日 19:29:48 +0000 (2010年6月26日)
Log Message:
-----------
docs: add 4 new pyplot functions
Modified Paths:
--------------
 trunk/matplotlib/doc/_templates/index.html
 trunk/matplotlib/doc/api/api_changes.rst
 trunk/matplotlib/lib/matplotlib/pylab.py
Modified: trunk/matplotlib/doc/_templates/index.html
===================================================================
--- trunk/matplotlib/doc/_templates/index.html	2010年06月26日 19:04:53 UTC (rev 8470)
+++ trunk/matplotlib/doc/_templates/index.html	2010年06月26日 19:29:48 UTC (rev 8471)
@@ -620,6 +620,18 @@
 </tr>
 <tr>
 <th align="left">
+ <a href="api/pyplot_api.html#matplotlib.pyplot.locator_params">locator_params</a>
+
+ </th>
+
+ <td align="left">
+ adjust parameters used in locating axis ticks
+ </td>
+
+ </tr>
+
+ <tr>
+ <th align="left">
 <a href="api/pyplot_api.html#matplotlib.pyplot.loglog">loglog</a>
 
 </th>
@@ -642,6 +654,18 @@
 </tr>
 <tr>
 <th align="left">
+ <a href="api/pyplot_api.html#matplotlib.pyplot.margins">margins</a>
+
+ </th>
+
+ <td align="left">
+ set margins used in autoscaling
+ </td>
+
+ </tr>
+
+ <tr>
+ <th align="left">
 <a href="api/pyplot_api.html#matplotlib.pyplot.pcolor">pcolor</a>
 
 </th>
@@ -950,6 +974,29 @@
 </tr>
 <tr>
 <th align="left">
+ <a href="api/pyplot_api.html#matplotlib.pyplot.tick_params">tick_params</a>
+
+ </th>
+
+ <td align="left">
+ control the appearance of ticks and tick labels
+ </td>
+
+ </tr>
+ <tr>
+ <th align="left">
+ <a href="api/pyplot_api.html#matplotlib.pyplot.ticklabel_format">ticklabel_format</a>
+
+ </th>
+
+ <td align="left">
+ control the format of tick labels
+ </td>
+
+ </tr>
+
+ <tr>
+ <th align="left">
 <a href="api/pyplot_api.html#matplotlib.pyplot.title">title</a>
 
 </th>
Modified: trunk/matplotlib/doc/api/api_changes.rst
===================================================================
--- trunk/matplotlib/doc/api/api_changes.rst	2010年06月26日 19:04:53 UTC (rev 8470)
+++ trunk/matplotlib/doc/api/api_changes.rst	2010年06月26日 19:29:48 UTC (rev 8471)
@@ -10,9 +10,10 @@
 Changes beyond 0.99.x
 =====================
 
-* There are three new Axes methods with corresponding pyplot
+* There are four new Axes methods with corresponding pyplot
 functions to facilitate autoscaling, tick location, and tick
- label formatting:
+ label formatting, and the general appearance of ticks and
+ tick labels:
 
 + :meth:`matplotlib.axes.Axes.margins` sets margins used to
 autoscale the :attr:`matplotlib.axes.Axes.viewLim` based on
@@ -25,6 +26,9 @@
 method for controlling the :class:`matplotlib.ticker.ScalarFormatter`
 that is used by default with linear axes.
 
+ + :meth:`matplotlib.axes.Axes.tick_params` controls direction, size,
+ visibility, and color of ticks and their labels.
+
 * The :meth:`matplotlib.axes.Axes.bar` method accepts a *error_kw*
 kwarg; it is a dictionary of kwargs to be passed to the
 errorbar function.
Modified: trunk/matplotlib/lib/matplotlib/pylab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pylab.py	2010年06月26日 19:04:53 UTC (rev 8470)
+++ trunk/matplotlib/lib/matplotlib/pylab.py	2010年06月26日 19:29:48 UTC (rev 8471)
@@ -56,8 +56,10 @@
 imshow - plot image data
 ishold - return the hold state of the current axes
 legend - make an axes legend
+ locator_params - adjust parameters used in locating axis ticks
 loglog - a log log plot
 matshow - display a matrix in a new figure preserving aspect
+ margins - set margins used in autoscaling
 pcolor - make a pseudocolor plot
 pcolormesh - make a pseudocolor plot using a quadrilateral mesh
 pie - make a pie chart
@@ -86,6 +88,8 @@
 table - add a table to the plot
 text - add some text at location x,y to the current axes
 thetagrids - customize the radial theta grids and labels for polar
+ tick_params - control the appearance of ticks and tick labels
+ ticklabel_format - control the format of tick labels
 title - add a title to the current axes
 xcorr - plot the autocorrelation function of x and y
 xlim - set/get the xlimits
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2010年06月26日 19:05:00
Revision: 8470
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8470&view=rev
Author: efiring
Date: 2010年06月26日 19:04:53 +0000 (2010年6月26日)
Log Message:
-----------
docstrings: use standard spelling and capitalization of MATLAB
Modified Paths:
--------------
 trunk/matplotlib/doc/users/intro.rst
 trunk/matplotlib/lib/matplotlib/__init__.py
 trunk/matplotlib/lib/matplotlib/artist.py
 trunk/matplotlib/lib/matplotlib/axes.py
 trunk/matplotlib/lib/matplotlib/backend_bases.py
 trunk/matplotlib/lib/matplotlib/blocking_input.py
 trunk/matplotlib/lib/matplotlib/contour.py
 trunk/matplotlib/lib/matplotlib/mlab.py
 trunk/matplotlib/lib/matplotlib/pylab.py
 trunk/matplotlib/lib/matplotlib/pyplot.py
Modified: trunk/matplotlib/doc/users/intro.rst
===================================================================
--- trunk/matplotlib/doc/users/intro.rst	2010年06月26日 08:14:01 UTC (rev 8469)
+++ trunk/matplotlib/doc/users/intro.rst	2010年06月26日 19:04:53 UTC (rev 8470)
@@ -3,12 +3,15 @@
 
 matplotlib is a library for making 2D plots of arrays in `Python
 <http://www.python.org>`_. Although it has its origins in emulating
-the MATLAB graphics commands, it is
+the MATLAB |reg| [*]_ graphics commands, it is
 independent of MATLAB, and can be used in a Pythonic, object oriented
 way. Although matplotlib is written primarily in pure Python, it
 makes heavy use of `NumPy <http://www.numpy.org>`_ and other extension
 code to provide good performance even for large arrays.
 
+.. |reg| unicode:: 0xAE
+ :ltrim:
+
 matplotlib is designed with the philosophy that you should be able to
 create simple plots with just a few commands, or just one! If you
 want to see a histogram of your data, you shouldn't need to
@@ -87,3 +90,6 @@
 embed matplotlib in a Gtk+ EEG application that runs on Windows, Linux
 and Macintosh OS X.
 
+.. [*] MATLAB is a registered trademark of The MathWorks, Inc.
+
+
Modified: trunk/matplotlib/lib/matplotlib/__init__.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/__init__.py	2010年06月26日 08:14:01 UTC (rev 8469)
+++ trunk/matplotlib/lib/matplotlib/__init__.py	2010年06月26日 19:04:53 UTC (rev 8470)
@@ -1,9 +1,13 @@
 """
 This is an object-orient plotting library.
 
-A procedural interface is provided by the companion pylab module,
+A procedural interface is provided by the companion pyplot module,
 which may be imported directly, e.g::
 
+ from pyplot import *
+
+To include numpy functions, use::
+
 from pylab import *
 
 or using ipython::
@@ -11,9 +15,11 @@
 ipython -pylab
 
 For the most part, direct use of the object-oriented library is
-encouraged when programming rather than working interactively. The
-exceptions are the pylab commands :func:`~matplotlib.pyplot.figure`,
+encouraged when programming; pyplot is primarily for working
+interactively. The
+exceptions are the pyplot commands :func:`~matplotlib.pyplot.figure`,
 :func:`~matplotlib.pyplot.subplot`,
+:func:`~matplotlib.pyplot.subplots`,
 :func:`~matplotlib.backends.backend_qt4agg.show`, and
 :func:`~pyplot.savefig`, which can greatly simplify scripting.
 
@@ -86,6 +92,10 @@
 
 matplotlib is written by John D. Hunter (jdh2358 at gmail.com) and a
 host of others.
+
+Occasionally the internal documentation (python docstrings) will refer
+to MATLAB&reg;, a registered trademark of The MathWorks, Inc.
+
 """
 from __future__ import generators
 
@@ -897,7 +907,7 @@
 
 # Now allow command line to override
 
-# Allow command line access to the backend with -d (matlab compatible
+# Allow command line access to the backend with -d (MATLAB compatible
 # flag)
 
 for s in sys.argv[1:]:
Modified: trunk/matplotlib/lib/matplotlib/artist.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/artist.py	2010年06月26日 08:14:01 UTC (rev 8469)
+++ trunk/matplotlib/lib/matplotlib/artist.py	2010年06月26日 19:04:53 UTC (rev 8470)
@@ -1159,10 +1159,10 @@
 >>> lines = plot(x, y1, x, y2)
 >>> setp(lines, linewidth=2, color='r')
 
- :func:`setp` works with the matlab style string/value pairs or
+ :func:`setp` works with the MATLAB style string/value pairs or
 with python kwargs. For example, the following are equivalent::
 
- >>> setp(lines, 'linewidth', 2, 'color', r') # matlab style
+ >>> setp(lines, 'linewidth', 2, 'color', r') # MATLAB style
 
 >>> setp(lines, linewidth=2, color='r') # python style
 """
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py	2010年06月26日 08:14:01 UTC (rev 8469)
+++ trunk/matplotlib/lib/matplotlib/axes.py	2010年06月26日 19:04:53 UTC (rev 8470)
@@ -50,7 +50,7 @@
 
 def _process_plot_format(fmt):
 """
- Process a matlab(TM) style color/line style format string. Return a
+ Process a MATLAB style color/line style format string. Return a
 (*linestyle*, *color*) tuple as a result of the processing. Default
 values are ('-', 'b'). Example format strings include:
 
@@ -1963,7 +1963,7 @@
 
 grid(self, b=None, which='major', **kwargs)
 
- Set the axes grids on or off; *b* is a boolean. (For Matlab
+ Set the axes grids on or off; *b* is a boolean. (For MATLAB
 compatibility, *b* may also be a string, 'on' or 'off'.)
 
 If *b* is *None* and ``len(kwargs)==0``, toggle the grid state. If
@@ -5187,7 +5187,7 @@
 
 - *vert* = 1 (default) makes the boxes vertical.
 - *vert* = 0 makes horizontal boxes. This seems goofy, but
- that's how Matlab did it.
+ that's how MATLAB did it.
 
 *whis* (default 1.5) defines the length of the whiskers as
 a function of the inner quartile range. They extend to the
@@ -6744,7 +6744,7 @@
 *shading*: [ 'flat' | 'faceted' ]
 If 'faceted', a black grid is drawn around each rectangle; if
 'flat', edges are not drawn. Default is 'flat', contrary to
- Matlab.
+ MATLAB.
 
 This kwarg is deprecated; please use 'edgecolors' instead:
 * shading='flat' -- edgecolors='none'
@@ -6765,7 +6765,7 @@
 
 .. _axes-pcolor-grid-orientation:
 
- The grid orientation follows the Matlab(TM) convention: an
+ The grid orientation follows the MATLAB convention: an
 array *C* with shape (*nrows*, *ncolumns*) is plotted with
 the column number as *X* and the row number as *Y*, increasing
 up; hence it is plotted the way the array would be printed,
@@ -6800,7 +6800,7 @@
 
 pcolor(C.T)
 
- Matlab :func:`pcolor` always discards the last row and column
+ MATLAB :func:`pcolor` always discards the last row and column
 of *C*, but matplotlib displays the last row and column if *X* and
 *Y* are not specified, or if *X* and *Y* have one more row and
 column than *C*.
@@ -6942,7 +6942,7 @@
 *shading*: [ 'flat' | 'faceted' | 'gouraud' ]
 If 'faceted', a black grid is drawn around each rectangle; if
 'flat', edges are not drawn. Default is 'flat', contrary to
- Matlab(TM).
+ MATLAB.
 
 This kwarg is deprecated; please use 'edgecolors' instead:
 * shading='flat' -- edgecolors='None'
@@ -8219,14 +8219,14 @@
 raise ValueError('Argument to subplot must be a 3 digits long')
 rows, cols, num = map(int, s)
 self._subplotspec = GridSpec(rows, cols)[num-1]
- # num - 1 for converting from matlab to python indexing
+ # num - 1 for converting from MATLAB to python indexing
 elif len(args)==3:
 rows, cols, num = args
 if isinstance(num, tuple) and len(num) == 2:
 self._subplotspec = GridSpec(rows, cols)[num[0]-1:num[1]]
 else:
 self._subplotspec = GridSpec(rows, cols)[num-1]
- # num - 1 for converting from matlab to python indexing
+ # num - 1 for converting from MATLAB to python indexing
 else:
 raise ValueError( 'Illegal argument to subplot')
 
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py	2010年06月26日 08:14:01 UTC (rev 8469)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py	2010年06月26日 19:04:53 UTC (rev 8470)
@@ -702,7 +702,7 @@
 def get_rgb(self):
 """
 returns a tuple of three floats from 0-1. color can be a
- matlab format string, a html hex color string, or a rgb tuple
+ MATLAB format string, a html hex color string, or a rgb tuple
 """
 return self._rgb
 
@@ -781,7 +781,7 @@
 
 def set_foreground(self, fg, isRGB=False):
 """
- Set the foreground color. fg can be a matlab format string, a
+ Set the foreground color. fg can be a MATLAB format string, a
 html hex color string, an rgb unit tuple, or a float between 0
 and 1. In the latter case, grayscale is used.
 
@@ -2072,7 +2072,7 @@
 
 class FigureManagerBase:
 """
- Helper class for matlab mode, wraps everything up into a neat bundle
+ Helper class for pyplot mode, wraps everything up into a neat bundle
 
 Public attibutes:
 
Modified: trunk/matplotlib/lib/matplotlib/blocking_input.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/blocking_input.py	2010年06月26日 08:14:01 UTC (rev 8469)
+++ trunk/matplotlib/lib/matplotlib/blocking_input.py	2010年06月26日 19:04:53 UTC (rev 8470)
@@ -194,7 +194,7 @@
 BlockingInput.pop(self,-1)
 
 # This will exit even if not in infinite mode. This is
- # consistent with matlab and sometimes quite useful, but will
+ # consistent with MATLAB and sometimes quite useful, but will
 # require the user to test how many points were actually
 # returned before using data.
 self.fig.canvas.stop_event_loop()
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py	2010年06月26日 08:14:01 UTC (rev 8469)
+++ trunk/matplotlib/lib/matplotlib/contour.py	2010年06月26日 19:04:53 UTC (rev 8470)
@@ -1234,8 +1234,8 @@
 filled contours, respectively. Except as noted, function
 signatures and return values are the same for both versions.
 
- :func:`~matplotlib.pyplot.contourf` differs from the Matlab
- (TM) version in that it does not draw the polygon edges.
+ :func:`~matplotlib.pyplot.contourf` differs from the MATLAB
+ version in that it does not draw the polygon edges.
 To draw edges, add line contours with
 calls to :func:`~matplotlib.pyplot.contour`.
 
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py	2010年06月26日 08:14:01 UTC (rev 8469)
+++ trunk/matplotlib/lib/matplotlib/mlab.py	2010年06月26日 19:04:53 UTC (rev 8470)
@@ -1,9 +1,9 @@
 """
 
-Numerical python functions written for compatability with matlab(TM)
+Numerical python functions written for compatability with MATLAB
 commands with the same names.
 
-Matlab(TM) compatible functions
+MATLAB compatible functions
 -------------------------------
 
 :func:`cohere`
@@ -41,10 +41,10 @@
 Miscellaneous functions
 -------------------------
 
-Functions that don't exist in matlab(TM), but are useful anyway:
+Functions that don't exist in MATLAB, but are useful anyway:
 
 :meth:`cohere_pairs`
- Coherence over all pairs. This is not a matlab function, but we
+ Coherence over all pairs. This is not a MATLAB function, but we
 compute coherence a lot in my lab, and we compute it for a lot of
 pairs. This function is optimized to do this efficiently by
 caching the direct FFTs.
@@ -245,7 +245,7 @@
 raise ValueError("sides must be one of: 'default', 'onesided', or "
 "'twosided'")
 
- # Matlab divides by the sampling frequency so that density function
+ # MATLAB divides by the sampling frequency so that density function
 # has units of dB/Hz and can be integrated by the plotted frequency
 # values. Perform the same scaling here.
 if scale_by_freq:
@@ -277,18 +277,18 @@
 Pxy[:,i] = np.conjugate(fx[:numFreqs]) * fy[:numFreqs]
 
 # Scale the spectrum by the norm of the window to compensate for
- # windowing loss; see Bendat & Piersol Sec 11.5.2. 
+ # windowing loss; see Bendat & Piersol Sec 11.5.2.
 Pxy *= 1 / (np.abs(windowVals)**2).sum()
 
 # Also include scaling factors for one-sided densities and dividing by the
 # sampling frequency, if desired. Scale everything, except the DC component
- # and the NFFT/2 component: 
+ # and the NFFT/2 component:
 Pxy[1:-1] *= scaling_factor
 
- #But do scale those components by Fs, if required 
+ #But do scale those components by Fs, if required
 if scale_by_freq:
- Pxy[[0,-1]] /= Fs 
- 
+ Pxy[[0,-1]] /= Fs
+
 t = 1./Fs * (ind + NFFT / 2.)
 freqs = float(Fs) / pad_to * np.arange(numFreqs)
 
@@ -315,7 +315,7 @@
 *detrend*: callable
 The function applied to each segment before fft-ing,
 designed to remove the mean or linear trend. Unlike in
- matlab, where the *detrend* parameter is a vector, in
+ MATLAB, where the *detrend* parameter is a vector, in
 matplotlib is it a function. The :mod:`~matplotlib.pylab`
 module defines :func:`~matplotlib.pylab.detrend_none`,
 :func:`~matplotlib.pylab.detrend_mean`, and
@@ -356,7 +356,7 @@
 Specifies whether the resulting density values should be scaled
 by the scaling frequency, which gives density in units of Hz^-1.
 This allows for integration over the returned frequency values.
- The default is True for MatLab compatibility.
+ The default is True for MATLAB compatibility.
 """))
 
 @docstring.dedent_interpd
@@ -785,7 +785,7 @@
 - *fracVar* : the fraction of the variance accounted for by each
 component returned
 
- A similar function of the same name was in the Matlab (TM)
+ A similar function of the same name was in the MATLAB 
 R13 Neural Network Toolbox but is not found in later versions;
 its successor seems to be called "processpcs".
 """
@@ -1732,7 +1732,7 @@
 
 def isvector(X):
 """
- Like the Matlab (TM) function with the same name, returns *True*
+ Like the MATLAB function with the same name, returns *True*
 if the supplied numpy array or matrix *X* looks like a vector,
 meaning it has a one non-singleton axis (i.e., it can have
 multiple axes, but all must have length 1, except for one of
@@ -2719,7 +2719,7 @@
 # remove masked points.
 if hasattr(z,'mask'):
 # make sure mask is not a scalar boolean array.
- if a.mask.ndim: 
+ if a.mask.ndim:
 x = x.compress(z.mask == False)
 y = y.compress(z.mask == False)
 z = z.compressed()
Modified: trunk/matplotlib/lib/matplotlib/pylab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pylab.py	2010年06月26日 08:14:01 UTC (rev 8469)
+++ trunk/matplotlib/lib/matplotlib/pylab.py	2010年06月26日 19:04:53 UTC (rev 8470)
@@ -3,8 +3,10 @@
 plotting library.
 
 The following plotting commands are provided; the majority have
-Matlab(TM) analogs and similar argument.
+MATLAB |reg| [*]_ analogs and similar arguments.
 
+.. |reg| unicode:: 0xAE
+
 _Plotting commands
 acorr - plot the autocorrelation function
 annotate - annotate something in the figure
@@ -197,6 +199,9 @@
 
 __end
 
+.. [*] MATLAB is a registered trademark of The MathWorks, Inc.
+
+
 """
 import sys, warnings
 
Modified: trunk/matplotlib/lib/matplotlib/pyplot.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/pyplot.py	2010年06月26日 08:14:01 UTC (rev 8469)
+++ trunk/matplotlib/lib/matplotlib/pyplot.py	2010年06月26日 19:04:53 UTC (rev 8470)
@@ -1,3 +1,19 @@
+"""
+Provides a MATLAB-like plotting framework.
+
+:mod:`~matplotlib.pylab` combines pyplot with numpy into a single namespace.
+This is convenient for interactive work, but for programming it
+is recommended that the namespaces be kept separate, e.g.::
+
+ import numpy as np
+ import matplotlib.pyplot as plt
+
+ x = np.arange(0, 5, 0.1);
+ y = np.sin(x)
+ plt.plot(x, y)
+
+"""
+
 import sys
 
 import matplotlib
@@ -197,7 +213,7 @@
 
 If *num* is an integer, and ``figure(num)`` already exists, make it
 active and return a reference to it. If ``figure(num)`` does not exist
- it will be created. Numbering starts at 1, matlab style::
+ it will be created. Numbering starts at 1, MATLAB style::
 
 figure(1)
 
@@ -739,7 +755,7 @@
 subplot_kw['sharey'] = ax0
 axarr[0] = ax0
 
- # Note off-by-one counting because add_subplot uses the matlab 1-based
+ # Note off-by-one counting because add_subplot uses the MATLAB 1-based
 # convention.
 for i in range(1, nplots):
 axarr[i] = fig.add_subplot(nrows, ncols, i+1, **subplot_kw)
@@ -947,7 +963,7 @@
 changes *x* and *y* axis limits such that all data is shown. If
 all data is already shown, it will move it to the center of the
 figure without modifying (*xmax* - *xmin*) or (*ymax* -
- *ymin*). Note this is slightly different than in matlab.
+ *ymin*). Note this is slightly different than in MATLAB.
 
 >>> axis('image')
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2010年06月26日 08:14:07
Revision: 8469
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8469&view=rev
Author: efiring
Date: 2010年06月26日 08:14:01 +0000 (2010年6月26日)
Log Message:
-----------
examples: fix references to MATLAB
Modified Paths:
--------------
 trunk/matplotlib/examples/animation/movie_demo.py
 trunk/matplotlib/examples/pylab_examples/axes_props.py
 trunk/matplotlib/examples/pylab_examples/color_demo.py
 trunk/matplotlib/examples/pylab_examples/polar_demo.py
 trunk/matplotlib/examples/pylab_examples/psd_demo.py
 trunk/matplotlib/examples/pylab_examples/psd_demo3.py
 trunk/matplotlib/examples/pylab_examples/psd_demo_complex.py
 trunk/matplotlib/examples/pylab_examples/set_and_get.py
 trunk/matplotlib/examples/pylab_examples/text_handles.py
Modified: trunk/matplotlib/examples/animation/movie_demo.py
===================================================================
--- trunk/matplotlib/examples/animation/movie_demo.py	2010年06月26日 07:45:26 UTC (rev 8468)
+++ trunk/matplotlib/examples/animation/movie_demo.py	2010年06月26日 08:14:01 UTC (rev 8469)
@@ -87,7 +87,7 @@
 
 for i in range(len(y)) :
 #
- # The next four lines are just like Matlab.
+ # The next four lines are just like MATLAB.
 #
 plt.plot(x,y[i],'b.')
 plt.axis((x[0],x[-1],-0.25,1))
Modified: trunk/matplotlib/examples/pylab_examples/axes_props.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/axes_props.py	2010年06月26日 07:45:26 UTC (rev 8468)
+++ trunk/matplotlib/examples/pylab_examples/axes_props.py	2010年06月26日 08:14:01 UTC (rev 8469)
@@ -10,7 +10,7 @@
 plot(t, s)
 grid(True)
 
-# matlab style
+# MATLAB style
 xticklines = getp(gca(), 'xticklines')
 yticklines = getp(gca(), 'yticklines')
 xgridlines = getp(gca(), 'xgridlines')
Modified: trunk/matplotlib/examples/pylab_examples/color_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/color_demo.py	2010年06月26日 07:45:26 UTC (rev 8468)
+++ trunk/matplotlib/examples/pylab_examples/color_demo.py	2010年06月26日 08:14:01 UTC (rev 8469)
@@ -2,7 +2,7 @@
 """
 matplotlib gives you 4 ways to specify colors,
 
- 1) as a single letter string, ala matlab
+ 1) as a single letter string, ala MATLAB
 
 2) as an html style hex string or html color name
 
Modified: trunk/matplotlib/examples/pylab_examples/polar_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/polar_demo.py	2010年06月26日 07:45:26 UTC (rev 8468)
+++ trunk/matplotlib/examples/pylab_examples/polar_demo.py	2010年06月26日 08:14:01 UTC (rev 8469)
@@ -28,7 +28,7 @@
 #
 # you could change the radial bounding box (zoom out) by setting the
 # ylim (radial coordinate is the second argument to the plot command,
-# as in matlab(TM), though this is not advised currently because it is not
+# as in MATLAB, though this is not advised currently because it is not
 # clear to me how the axes should behave in the change of view limits.
 # Please advise me if you have opinions. Likewise, the pan/zoom
 # controls probably do not do what you think they do and are better
@@ -48,7 +48,7 @@
 rc('ytick', labelsize=15)
 
 # force square figure and square axes looks better for polar, IMO
-width, height = matplotlib.rcParams['figure.figsize'] 
+width, height = matplotlib.rcParams['figure.figsize']
 size = min(width, height)
 # make a square figure
 fig = figure(figsize=(size, size))
Modified: trunk/matplotlib/examples/pylab_examples/psd_demo.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/psd_demo.py	2010年06月26日 07:45:26 UTC (rev 8468)
+++ trunk/matplotlib/examples/pylab_examples/psd_demo.py	2010年06月26日 08:14:01 UTC (rev 8469)
@@ -19,7 +19,7 @@
 
 show()
 """
-% compare with matlab(TM)
+% compare with MATLAB
 dt = 0.01;
 t = [0:dt:10];
 nse = randn(size(t));
Modified: trunk/matplotlib/examples/pylab_examples/psd_demo3.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/psd_demo3.py	2010年06月26日 07:45:26 UTC (rev 8468)
+++ trunk/matplotlib/examples/pylab_examples/psd_demo3.py	2010年06月26日 08:14:01 UTC (rev 8469)
@@ -1,6 +1,6 @@
-#This is a ported version of a Matlab example from the signal processing
+#This is a ported version of a MATLAB example from the signal processing
 #toolbox that showed some difference at one time between Matplotlib's and
-#MatLab's scaling of the PSD.
+#MATLAB's scaling of the PSD.
 
 import numpy as np
 import matplotlib.pyplot as plt
Modified: trunk/matplotlib/examples/pylab_examples/psd_demo_complex.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/psd_demo_complex.py	2010年06月26日 07:45:26 UTC (rev 8468)
+++ trunk/matplotlib/examples/pylab_examples/psd_demo_complex.py	2010年06月26日 08:14:01 UTC (rev 8469)
@@ -1,6 +1,6 @@
-#This is a ported version of a Matlab example from the signal processing
+#This is a ported version of a MATLAB example from the signal processing
 #toolbox that showed some difference at one time between Matplotlib's and
-#MatLab's scaling of the PSD. This differs from psd_demo3.py in that
+#MATLAB's scaling of the PSD. This differs from psd_demo3.py in that
 #this uses a complex signal, so we can see that complex PSD's work properly
 import numpy as np
 import matplotlib.pyplot as plt
Modified: trunk/matplotlib/examples/pylab_examples/set_and_get.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/set_and_get.py	2010年06月26日 07:45:26 UTC (rev 8468)
+++ trunk/matplotlib/examples/pylab_examples/set_and_get.py	2010年06月26日 08:14:01 UTC (rev 8469)
@@ -1,6 +1,6 @@
 """
 
-matlab(TM) and pylab allow you to use setp and get to set and get
+MATLAB and pylab allow you to use setp and get to set and get
 object properties, as well as to do introspection on the object
 
 set
Modified: trunk/matplotlib/examples/pylab_examples/text_handles.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/text_handles.py	2010年06月26日 07:45:26 UTC (rev 8468)
+++ trunk/matplotlib/examples/pylab_examples/text_handles.py	2010年06月26日 08:14:01 UTC (rev 8469)
@@ -2,7 +2,7 @@
 #Controlling the properties of axis text using handles
 
 # See examples/text_themes.py for a more elegant, pythonic way to control
-# fonts. After all, if we were slaves to matlab(TM) , we wouldn't be
+# fonts. After all, if we were slaves to MATLAB , we wouldn't be
 # using python!
 
 from pylab import *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <ef...@us...> - 2010年06月26日 07:45:33
Revision: 8468
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8468&view=rev
Author: efiring
Date: 2010年06月26日 07:45:26 +0000 (2010年6月26日)
Log Message:
-----------
docs: be consistent in referring to MATLAB.
For the legal rationale, see Joe Harrington's post to scipy-dev:
http://article.gmane.org/gmane.comp.python.scientific.user/25399/match=matlab+trademark
Modified Paths:
--------------
 trunk/matplotlib/doc/_templates/index.html
 trunk/matplotlib/doc/api/api_changes.rst
 trunk/matplotlib/doc/faq/usage_faq.rst
 trunk/matplotlib/doc/users/artists.rst
 trunk/matplotlib/doc/users/installing.rst
 trunk/matplotlib/doc/users/intro.rst
 trunk/matplotlib/doc/users/pyplot_tutorial.rst
 trunk/matplotlib/doc/users/screenshots.rst
 trunk/matplotlib/doc/users/whats_new.rst
Modified: trunk/matplotlib/doc/_templates/index.html
===================================================================
--- trunk/matplotlib/doc/_templates/index.html	2010年06月26日 07:37:44 UTC (rev 8467)
+++ trunk/matplotlib/doc/_templates/index.html	2010年06月26日 07:45:26 UTC (rev 8468)
@@ -9,10 +9,19 @@
 publication quality figures in a variety of hardcopy formats and
 interactive environments across platforms. matplotlib can be used
 in python scripts, the python and <a
- href="http://ipython.scipy.org">ipython</a> shell (ala matlab or
- mathematica), web application servers, and six graphical user
+ href="http://ipython.scipy.org">ipython</a> shell (ala
+ MATLAB<sup>&reg;<a name="matlab" href="#ftn.matlab">*</a></sup>
+ or
+ Mathematica<sup>&reg;<a name="mathematica"
+ href="#ftn.mathematica">&#8224;</a></sup>),
+ web application servers, and six graphical user
 interface toolkits.</p>
 
+
+
+
+
+
 <p>matplotlib tries to make easy things easy and hard things possible.
 You can generate plots, histograms, power spectra, bar charts,
 errorcharts, scatterplots, etc, with just a few lines of code.
@@ -35,7 +44,7 @@
 
 <p>For the power user, you have full control of line styles, font
 properties, axes properties, etc, via an object oriented interface
- or via a set of functions familiar to Matlab&reg; users.
+ or via a set of functions familiar to MATLAB users.
 The pylab mode provides all of the <a href="api/pyplot_api.html">pyplot</a> plotting
 functions listed below, as well as non-plotting functions from
 <a href="http://scipy.org/Numpy_Example_List_With_Doc">numpy</a> and
@@ -1193,4 +1202,16 @@
 
 </tr>
 </table>
+
+<div class="footnote"><p>
+<sup><a name="ftn.matlab" href="#matlab">*</a></sup>
+MATLAB is a registered trademark of The MathWorks, Inc.
+</p>
+<p>
+<sup><a name="ftn.mathematica" href="#mathematica">&#8224;</a></sup>
+Mathematica is a registered trademark of Wolfram Research, Inc.
+</p>
+
+
+
 {% endblock %}
Modified: trunk/matplotlib/doc/api/api_changes.rst
===================================================================
--- trunk/matplotlib/doc/api/api_changes.rst	2010年06月26日 07:37:44 UTC (rev 8467)
+++ trunk/matplotlib/doc/api/api_changes.rst	2010年06月26日 07:45:26 UTC (rev 8468)
@@ -179,7 +179,7 @@
 to scale one-sided densities by a factor of 2. Also, optionally
 scale the densities by the sampling frequency, which gives true values
 of densities that can be integrated by the returned frequency values.
- This also gives better MatLab compatibility. The corresponding
+ This also gives better MATLAB compatibility. The corresponding
 :class:`matplotlib.axes.Axes` methods and :mod:`matplotlib.pyplot`
 functions were updated as well.
 
@@ -1094,7 +1094,7 @@
 - pylab figure now defaults to num=None, which creates a new figure
 with a guaranteed unique number
 
- - contour method syntax changed - now it is matlab compatible
+ - contour method syntax changed - now it is MATLAB compatible
 
 unchanged: contour(Z)
 old: contour(Z, x=Y, y=Y)
@@ -1183,7 +1183,7 @@
 ::
 
 
- mpl_connect and mpl_disconnect in the matlab interface renamed to
+ mpl_connect and mpl_disconnect in the MATLAB interface renamed to
 connect and disconnect
 
 Did away with the text methods for angle since they were ambiguous.
@@ -1272,7 +1272,7 @@
 Changes for 0.54
 ================
 
-matlab interface
+MATLAB interface
 ----------------
 
 dpi
@@ -1289,7 +1289,7 @@
 pcolor and scatter
 ~~~~~~~~~~~~~~~~~~
 
-There are two changes to the matlab interface API, both involving the
+There are two changes to the MATLAB interface API, both involving the
 patch drawing commands. For efficiency, pcolor and scatter have been
 rewritten to use polygon collections, which are a new set of objects
 from matplotlib.collections designed to enable efficient handling of
@@ -1323,7 +1323,7 @@
 for a discussion on how to set the properties as a sequence.
 
 For scatter, the size argument is now in points^2 (the area of the
-symbol in points) as in matlab and is not in data coords as before.
+symbol in points) as in MATLAB and is not in data coords as before.
 Using sizes in data coords caused several problems. So you will need
 to adjust your size arguments accordingly or use scatter_classic.
 
@@ -1491,7 +1491,7 @@
 
 * backends must implement FigureCanvasBackend (the thing that
 controls the figure and handles the events if any) and
- FigureManagerBackend (wraps the canvas and the window for matlab
+ FigureManagerBackend (wraps the canvas and the window for MATLAB
 interface). FigureCanvasBase implements a backend switching
 mechanism
 
@@ -1514,9 +1514,9 @@
 
 Migrating code:
 
- Matlab interface:
+ MATLAB interface:
 
- The only API change for those using the matlab interface is in how
+ The only API change for those using the MATLAB interface is in how
 you call figure redraws for dynamically updating figures. In the
 old API, you did
 
@@ -1653,7 +1653,7 @@
 - new module transforms supplies Bound1D, Bound2D and Transform
 instances and more
 
- - Changes to the matlab helpers API
+ - Changes to the MATLAB helpers API
 
 * _matlab_helpers.GcfBase is renamed by Gcf. Backends no longer
 need to derive from this class. Instead, they provide a factory
Modified: trunk/matplotlib/doc/faq/usage_faq.rst
===================================================================
--- trunk/matplotlib/doc/faq/usage_faq.rst	2010年06月26日 07:37:44 UTC (rev 8467)
+++ trunk/matplotlib/doc/faq/usage_faq.rst	2010年06月26日 07:45:26 UTC (rev 8468)
@@ -17,19 +17,19 @@
 installed alongside :mod:`matplotlib`; and :mod:`matplotlib.pyplot` is a
 module in matplotlib.
 
-Pyplot provides a Matlab-style state-machine interface to
+Pyplot provides a MATLAB-style state-machine interface to
 the underlying object-oriented plotting library in matplotlib.
 
 Pylab combines the pyplot functionality (for plotting) with the numpy
 functionality (for mathematics and for working with arrays)
 in a single namespace, making that namespace
-(or environment) even more Matlab-like. This is what you get if
+(or environment) even more MATLAB-like. This is what you get if
 you use the
 *ipython* shell with the *-pylab* option, which imports everything
 from pylab and makes plotting fully interactive.
 
 We have been gradually converting the matplotlib examples
-from pure Matlab-style, using "from pylab import \*", to a preferred
+from pure MATLAB-style, using "from pylab import \*", to a preferred
 style in which pyplot is used for some convenience functions, either
 pyplot or the object-oriented style is used for the remainder of the
 plotting code, and numpy is used explicitly for numeric array operations.
@@ -42,7 +42,7 @@
 Then one calls, for example, np.arange, np.zeros, np.pi, plt.figure,
 plt.plot, plt.show, etc.
 
-Example, pure Matlab-style::
+Example, pure MATLAB-style::
 
 from pylab import *
 x = arange(0, 10, 0.2)
@@ -71,7 +71,7 @@
 plt.show()
 
 So, why do all the extra typing required as one moves away from the pure
-matlab-style? For very simple things like this example, the only
+MATLAB-style? For very simple things like this example, the only
 advantage is educational: the wordier styles are more explicit, more
 clear as to where things come from and what is going on. For more
 complicated applications, the explicitness and clarity become
Modified: trunk/matplotlib/doc/users/artists.rst
===================================================================
--- trunk/matplotlib/doc/users/artists.rst	2010年06月26日 07:37:44 UTC (rev 8467)
+++ trunk/matplotlib/doc/users/artists.rst	2010年06月26日 07:45:26 UTC (rev 8468)
@@ -1,610 +1,611 @@
-.. _artist-tutorial:
-
-***************
-Artist tutorial
-***************
-
-There are three layers to the matplotlib API. The
-:class:`matplotlib.backend_bases.FigureCanvas` is the area onto which
-the figure is drawn, the :class:`matplotlib.backend_bases.Renderer` is
-the object which knows how to draw on the
-:class:`~matplotlib.backend_bases.FigureCanvas`, and the
-:class:`matplotlib.artist.Artist` is the object that knows how to use
-a renderer to paint onto the canvas. The
-:class:`~matplotlib.backend_bases.FigureCanvas` and
-:class:`~matplotlib.backend_bases.Renderer` handle all the details of
-talking to user interface toolkits like `wxPython
-<http://www.wxpython.org>`_ or drawing languages like PostScript®, and
-the ``Artist`` handles all the high level constructs like representing
-and laying out the figure, text, and lines. The typical user will
-spend 95% of his time working with the ``Artists``.
-
-There are two types of ``Artists``: primitives and containers. The primitives represent the standard graphical objects we want to paint onto our canvas: :class:`~matplotlib.lines.Line2D`, :class:`~matplotlib.patches.Rectangle`, :class:`~matplotlib.text.Text`, :class:`~matplotlib.image.AxesImage`, etc., and the containers are places to put them (:class:`~matplotlib.axis.Axis`, :class:`~matplotlib.axes.Axes` and :class:`~matplotlib.figure.Figure`). The standard use is to create a :class:`~matplotlib.figure.Figure` instance, use the ``Figure`` to create one or more :class:`~matplotlib.axes.Axes` or :class:`~matplotlib.axes.Subplot` instances, and use the ``Axes`` instance helper methods to create the primitives. In the example below, we create a ``Figure`` instance using :func:`matplotlib.pyplot.figure`, which is a convenience method for instantiating ``Figure`` instances and connecting them with your user interface or drawing toolkit ``FigureCanvas``. As we will discuss below, this is not necessary -- you can work directly with PostScript, PDF Gtk+, or wxPython ``FigureCanvas`` instances, instantiate your ``Figures`` directly and connect them yourselves -- but since we are focusing here on the ``Artist`` API we'll let :mod:`~matplotlib.pyplot` handle some of those details for us::
-
- import matplotlib.pyplot as plt
- fig = plt.figure()
- ax = fig.add_subplot(2,1,1) # two rows, one column, first plot
-
-The :class:`~matplotlib.axes.Axes` is probably the most important
-class in the matplotlib API, and the one you will be working with most
-of the time. This is because the ``Axes`` is the plotting area into
-which most of the objects go, and the ``Axes`` has many special helper
-methods (:meth:`~matplotlib.axes.Axes.plot`,
-:meth:`~matplotlib.axes.Axes.text`,
-:meth:`~matplotlib.axes.Axes.hist`,
-:meth:`~matplotlib.axes.Axes.imshow`) to create the most common
-graphics primitives (:class:`~matplotlib.lines.Line2D`,
-:class:`~matplotlib.text.Text`,
-:class:`~matplotlib.patches.Rectangle`,
-:class:`~matplotlib.image.Image`, respectively). These helper methods
-will take your data (eg. ``numpy`` arrays and strings) and create
-primitive ``Artist`` instances as needed (eg. ``Line2D``), add them to
-the relevant containers, and draw them when requested. Most of you
-are probably familiar with the :class:`~matplotlib.axes.Subplot`,
-which is just a special case of an ``Axes`` that lives on a regular
-rows by columns grid of ``Subplot`` instances. If you want to create
-an ``Axes`` at an arbitrary location, simply use the
-:meth:`~matplotlib.figure.Figure.add_axes` method which takes a list
-of ``[left, bottom, width, height]`` values in 0-1 relative figure
-coordinates::
-
- fig2 = plt.figure()
- ax2 = fig2.add_axes([0.15, 0.1, 0.7, 0.3])
-
-Continuing with our example::
-
- import numpy as np
- t = np.arange(0.0, 1.0, 0.01)
- s = np.sin(2*np.pi*t)
- line, = ax.plot(t, s, color='blue', lw=2)
-
-In this example, ``ax`` is the ``Axes`` instance created by the
-``fig.add_subplot`` call above (remember ``Subplot`` is just a
-subclass of ``Axes``) and when you call ``ax.plot``, it creates a
-``Line2D`` instance and adds it to the :attr:`Axes.lines
-<matplotlib.axes.Axes.lines>` list. In the interactive `ipython
-<http://ipython.scipy.org/>`_ session below, you can see that the
-``Axes.lines`` list is length one and contains the same line that was
-returned by the ``line, = ax.plot...`` call:
-
-.. sourcecode:: ipython
-
- In [101]: ax.lines[0]
- Out[101]: <matplotlib.lines.Line2D instance at 0x19a95710>
-
- In [102]: line
- Out[102]: <matplotlib.lines.Line2D instance at 0x19a95710>
-
-If you make subsequent calls to ``ax.plot`` (and the hold state is "on"
-which is the default) then additional lines will be added to the list.
-You can remove lines later simply by calling the list methods; either
-of these will work::
-
- del ax.lines[0]
- ax.lines.remove(line) # one or the other, not both!
-
-The Axes also has helper methods to configure and decorate the x-axis
-and y-axis tick, tick labels and axis labels::
-
- xtext = ax.set_xlabel('my xdata') # returns a Text instance
- ytext = ax.set_ylabel('my xdata')
-
-When you call :meth:`ax.set_xlabel <matplotlib.axes.Axes.set_xlabel>`,
-it passes the information on the :class:`~matplotlib.text.Text`
-instance of the :class:`~matplotlib.axis.XAxis`. Each ``Axes``
-instance contains an :class:`~matplotlib.axis.XAxis` and a
-:class:`~matplotlib.axis.YAxis` instance, which handle the layout and
-drawing of the ticks, tick labels and axis labels.
-
-.. I'm commenting this out, since the new Sphinx cross-references
-.. sort of take care of this above - MGD
-
-.. Here are the most important matplotlib modules that contain the
-.. classes referenced above
-
-.. =============== ==================
-.. Artist Module
-.. =============== ==================
-.. Artist matplotlib.artist
-.. Rectangle matplotlib.patches
-.. Line2D matplotlib.lines
-.. Axes matplotlib.axes
-.. XAxis and YAxis matplotlib.axis
-.. Figure matplotlib.figure
-.. Text	 matplotlib.text
-.. =============== ==================
-
-Try creating the figure below.
-
-.. plot:: pyplots/fig_axes_labels_simple.py
-
-.. _customizing-artists:
-
-Customizing your objects
-========================
-
-Every element in the figure is represented by a matplotlib
-:class:`~matplotlib.artist.Artist`, and each has an extensive list of
-properties to configure its appearance. The figure itself contains a
-:class:`~matplotlib.patches.Rectangle` exactly the size of the figure,
-which you can use to set the background color and transparency of the
-figures. Likewise, each :class:`~matplotlib.axes.Axes` bounding box
-(the standard white box with black edges in the typical matplotlib
-plot, has a ``Rectangle`` instance that determines the color,
-transparency, and other properties of the Axes. These instances are
-stored as member variables :attr:`Figure.patch
-<matplotlib.figure.Figure.patch>` and :attr:`Axes.patch
-<matplotlib.axes.Axes.patch>` ("Patch" is a name inherited from
-MATLABTM, and is a 2D "patch" of color on the figure, eg. rectangles,
-circles and polygons). Every matplotlib ``Artist`` has the following
-properties
-
-========== ======================================================================
-Property Description
-========== ======================================================================
-alpha 	 The transparency - a scalar from 0-1
-animated A boolean that is used to facilitate animated drawing
-axes The axes that the Artist lives in, possibly None
-clip_box The bounding box that clips the Artist
-clip_on Whether clipping is enabled
-clip_path The path the artist is clipped to
-contains A picking function to test whether the artist contains the pick point
-figure The figure instance the artist lives in, possibly None
-label A text label (eg. for auto-labeling)
-picker A python object that controls object picking
-transform The transformation
-visible A boolean whether the artist should be drawn
-zorder A number which determines the drawing order
-========== ======================================================================
-
-Each of the properties is accessed with an old-fashioned setter or
-getter (yes we know this irritates Pythonistas and we plan to support
-direct access via properties or traits but it hasn't been done yet).
-For example, to multiply the current alpha by a half::
-
- a = o.get_alpha()
- o.set_alpha(0.5*a)
-
-If you want to set a number of properties at once, you can also use
-the ``set`` method with keyword arguments. For example::
-
- o.set(alpha=0.5, zorder=2)
-
-If you are working interactively at the python shell, a handy way to
-inspect the ``Artist`` properties is to use the
-:func:`matplotlib.artist.getp` function (simply
-:func:`~matplotlib.pylab.getp` in pylab), which lists the properties
-and their values. This works for classes derived from ``Artist`` as
-well, eg. ``Figure`` and ``Rectangle``. Here are the ``Figure`` rectangle
-properties mentioned above:
-
-.. sourcecode:: ipython
-
- In [149]: matplotlib.artist.getp(fig.patch)
-	alpha = 1.0
-	animated = False
-	antialiased or aa = True
-	axes = None
-	clip_box = None
-	clip_on = False
-	clip_path = None
-	contains = None
-	edgecolor or ec = w
-	facecolor or fc = 0.75
-	figure = Figure(8.125x6.125)
-	fill = 1
-	hatch = None
-	height = 1
-	label =
-	linewidth or lw = 1.0
-	picker = None
-	transform = <Affine object at 0x134cca84>
-	verts = ((0, 0), (0, 1), (1, 1), (1, 0))
-	visible = True
-	width = 1
-	window_extent = <Bbox object at 0x134acbcc>
-	x = 0
-	y = 0
-	zorder = 1
-
-.. TODO: Update these URLs
-
-The docstrings for all of the classes also contain the ``Artist``
-properties, so you can consult the interactive "help" or the
-:ref:`artist-api` for a listing of properties for a given object.
-
-.. _object-containers:
-
-Object containers
-=================
-
-
-Now that we know how to inspect and set the properties of a given
-object we want to configure, we need to now how to get at that object.
-As mentioned in the introduction, there are two kinds of objects:
-primitives and containers. The primitives are usually the things you
-want to configure (the font of a :class:`~matplotlib.text.Text`
-instance, the width of a :class:`~matplotlib.lines.Line2D`) although
-the containers also have some properties as well -- for example the
-:class:`~matplotlib.axes.Axes` :class:`~matplotlib.artist.Artist` is a
-container that contains many of the primitives in your plot, but it
-also has properties like the ``xscale`` to control whether the xaxis
-is 'linear' or 'log'. In this section we'll review where the various
-container objects store the ``Artists`` that you want to get at.
-
-.. _figure-container:
-
-Figure container
-================
-
-The top level container ``Artist`` is the
-:class:`matplotlib.figure.Figure`, and it contains everything in the
-figure. The background of the figure is a
-:class:`~matplotlib.patches.Rectangle` which is stored in
-:attr:`Figure.patch <matplotlib.figure.Figure.patch>`. As
-you add subplots (:meth:`~matplotlib.figure.Figure.add_subplot`) and
-axes (:meth:`~matplotlib.figure.Figure.add_axes`) to the figure
-these will be appended to the :attr:`Figure.axes
-<matplotlib.figure.Figure.axes>`. These are also returned by the
-methods that create them:
-
-.. sourcecode:: ipython
-
- In [156]: fig = plt.figure()
-
- In [157]: ax1 = fig.add_subplot(211)
-
- In [158]: ax2 = fig.add_axes([0.1, 0.1, 0.7, 0.3])
-
- In [159]: ax1
- Out[159]: <matplotlib.axes.Subplot instance at 0xd54b26c>
-
- In [160]: print fig.axes
- [<matplotlib.axes.Subplot instance at 0xd54b26c>, <matplotlib.axes.Axes instance at 0xd3f0b2c>]
-
-Because the figure maintains the concept of the "current axes" (see
-:meth:`Figure.gca <matplotlib.figure.Figure.gca>` and
-:meth:`Figure.sca <matplotlib.figure.Figure.sca>`) to support the
-pylab/pyplot state machine, you should not insert or remove axes
-directly from the axes list, but rather use the
-:meth:`~matplotlib.figure.Figure.add_subplot` and
-:meth:`~matplotlib.figure.Figure.add_axes` methods to insert, and the
-:meth:`~matplotlib.figure.Figure.delaxes` method to delete. You are
-free however, to iterate over the list of axes or index into it to get
-access to ``Axes`` instances you want to customize. Here is an
-example which turns all the axes grids on::
-
- for ax in fig.axes:
- ax.grid(True)
-
-
-The figure also has its own text, lines, patches and images, which you
-can use to add primitives directly. The default coordinate system for
-the ``Figure`` will simply be in pixels (which is not usually what you
-want) but you can control this by setting the transform property of
-the ``Artist`` you are adding to the figure.
-
-.. TODO: Is that still true?
-
-More useful is "figure coordinates" where (0, 0) is the bottom-left of
-the figure and (1, 1) is the top-right of the figure which you can
-obtain by setting the ``Artist`` transform to :attr:`fig.transFigure
-<matplotlib.figure.Figure.transFigure>`:
-
-.. sourcecode:: ipython
-
- In [191]: fig = plt.figure()
-
- In [192]: l1 = matplotlib.lines.Line2D([0, 1], [0, 1],
- transform=fig.transFigure, figure=fig)
-
- In [193]: l2 = matplotlib.lines.Line2D([0, 1], [1, 0],
- transform=fig.transFigure, figure=fig)
-
- In [194]: fig.lines.extend([l1, l2])
-
- In [195]: fig.canvas.draw()
-
-.. plot:: pyplots/fig_x.py
-
-
-Here is a summary of the Artists the figure contains
-
-.. TODO: Add xrefs to this table
-
-================ ===============================================================
-Figure attribute Description
-================ ===============================================================
-axes A list of Axes instances (includes Subplot)
-patch The Rectangle background
-images A list of FigureImages patches - useful for raw pixel display
-legends A list of Figure Legend instances (different from Axes.legends)
-lines A list of Figure Line2D instances (rarely used, see Axes.lines)
-patches A list of Figure patches (rarely used, see Axes.patches)
-texts A list Figure Text instances
-================ ===============================================================
-
-.. _axes-container:
-
-Axes container
-==============
-
-The :class:`matplotlib.axes.Axes` is the center of the matplotlib
-universe -- it contains the vast majority of all the ``Artists`` used
-in a figure with many helper methods to create and add these
-``Artists`` to itself, as well as helper methods to access and
-customize the ``Artists`` it contains. Like the
-:class:`~matplotlib.figure.Figure`, it contains a
-:class:`~matplotlib.patches.Patch`
-:attr:`~matplotlib.axes.Axes.patch` which is a
-:class:`~matplotlib.patches.Rectangle` for Cartesian coordinates and a
-:class:`~matplotlib.patches.Circle` for polar coordinates; this patch
-determines the shape, background and border of the plotting region::
-
- ax = fig.add_subplot(111)
- rect = ax.patch # a Rectangle instance
- rect.set_facecolor('green')
-
-When you call a plotting method, eg. the canonical
-:meth:`~matplotlib.axes.Axes.plot` and pass in arrays or lists of
-values, the method will create a :meth:`matplotlib.lines.Line2D`
-instance, update the line with all the ``Line2D`` properties passed as
-keyword arguments, add the line to the :attr:`Axes.lines
-<matplotlib.axes.Axes.lines>` container, and returns it to you:
-
-.. sourcecode:: ipython
-
- In [213]: x, y = np.random.rand(2, 100)
-
- In [214]: line, = ax.plot(x, y, '-', color='blue', linewidth=2)
-
-``plot`` returns a list of lines because you can pass in multiple x, y
-pairs to plot, and we are unpacking the first element of the length
-one list into the line variable. The line has been added to the
-``Axes.lines`` list:
-
-.. sourcecode:: ipython
-
- In [229]: print ax.lines
- [<matplotlib.lines.Line2D instance at 0xd378b0c>]
-
-Similarly, methods that create patches, like
-:meth:`~matplotlib.axes.Axes.bar` creates a list of rectangles, will
-add the patches to the :attr:`Axes.patches
-<matplotlib.axes.Axes.patches>` list:
-
-.. sourcecode:: ipython
-
- In [233]: n, bins, rectangles = ax.hist(np.random.randn(1000), 50, facecolor='yellow')
-
- In [234]: rectangles
- Out[234]: <a list of 50 Patch objects>
-
- In [235]: print len(ax.patches)
-
-You should not add objects directly to the ``Axes.lines`` or
-``Axes.patches`` lists unless you know exactly what you are doing,
-because the ``Axes`` needs to do a few things when it creates and adds
-an object. It sets the figure and axes property of the ``Artist``, as
-well as the default ``Axes`` transformation (unless a transformation
-is set). It also inspects the data contained in the ``Artist`` to
-update the data structures controlling auto-scaling, so that the view
-limits can be adjusted to contain the plotted data. You can,
-nonetheless, create objects yourself and add them directly to the
-``Axes`` using helper methods like
-:meth:`~matplotlib.axes.Axes.add_line` and
-:meth:`~matplotlib.axes.Axes.add_patch`. Here is an annotated
-interactive session illustrating what is going on:
-
-.. sourcecode:: ipython
-
- In [261]: fig = plt.figure()
-
- In [262]: ax = fig.add_subplot(111)
-
- # create a rectangle instance
- In [263]: rect = matplotlib.patches.Rectangle( (1,1), width=5, height=12)
-
- # by default the axes instance is None
- In [264]: print rect.get_axes()
- None
-
- # and the transformation instance is set to the "identity transform"
- In [265]: print rect.get_transform()
- <Affine object at 0x13695544>
-
- # now we add the Rectangle to the Axes
- In [266]: ax.add_patch(rect)
-
- # and notice that the ax.add_patch method has set the axes
- # instance
- In [267]: print rect.get_axes()
- Axes(0.125,0.1;0.775x0.8)
-
- # and the transformation has been set too
- In [268]: print rect.get_transform()
- <Affine object at 0x15009ca4>
-
- # the default axes transformation is ax.transData
- In [269]: print ax.transData
- <Affine object at 0x15009ca4>
-
- # notice that the xlimits of the Axes have not been changed
- In [270]: print ax.get_xlim()
- (0.0, 1.0)
-
- # but the data limits have been updated to encompass the rectangle
- In [271]: print ax.dataLim.bounds
- (1.0, 1.0, 5.0, 12.0)
-
- # we can manually invoke the auto-scaling machinery
- In [272]: ax.autoscale_view()
-
- # and now the xlim are updated to encompass the rectangle
- In [273]: print ax.get_xlim()
- (1.0, 6.0)
-
- # we have to manually force a figure draw
- In [274]: ax.figure.canvas.draw()
-
-
-There are many, many ``Axes`` helper methods for creating primitive
-``Artists`` and adding them to their respective containers. The table
-below summarizes a small sampling of them, the kinds of ``Artist`` they
-create, and where they store them
-
-============================== ==================== =======================
-Helper method Artist Container
-============================== ==================== =======================
-ax.annotate - text annotations Annotate ax.texts
-ax.bar - bar charts Rectangle ax.patches
-ax.errorbar - error bar plots Line2D and Rectangle ax.lines and ax.patches
-ax.fill - shared area Polygon ax.patches
-ax.hist - histograms Rectangle ax.patches
-ax.imshow - image data AxesImage ax.images
-ax.legend - axes legends Legend ax.legends
-ax.plot - xy plots Line2D ax.lines
-ax.scatter - scatter charts PolygonCollection ax.collections
-ax.text - text Text ax.texts
-============================== ==================== =======================
-
-
-In addition to all of these ``Artists``, the ``Axes`` contains two
-important ``Artist`` containers: the :class:`~matplotlib.axis.XAxis`
-and :class:`~matplotlib.axis.YAxis`, which handle the drawing of the
-ticks and labels. These are stored as instance variables
-:attr:`~matplotlib.axes.Axes.xaxis` and
-:attr:`~matplotlib.axes.Axes.yaxis`. The ``XAxis`` and ``YAxis``
-containers will be detailed below, but note that the ``Axes`` contains
-many helper methods which forward calls on to the
-:class:`~matplotlib.axis.Axis` instances so you often do not need to
-work with them directly unless you want to. For example, you can set
-the font size of the ``XAxis`` ticklabels using the ``Axes`` helper
-method::
-
- for label in ax.get_xticklabels():
- label.set_color('orange')
-
-Below is a summary of the Artists that the Axes contains
-
-============== ======================================
-Axes attribute Description
-============== ======================================
-artists A list of Artist instances
-patch Rectangle instance for Axes background
-collections A list of Collection instances
-images A list of AxesImage
-legends A list of Legend instances
-lines A list of Line2D instances
-patches A list of Patch instances
-texts A list of Text instances
-xaxis matplotlib.axis.XAxis instance
-yaxis matplotlib.axis.YAxis instance
-============== ======================================
-
-.. _axis-container:
-
-Axis containers
-===============
-
-The :class:`matplotlib.axis.Axis` instances handle the drawing of the
-tick lines, the grid lines, the tick labels and the axis label. You
-can configure the left and right ticks separately for the y-axis, and
-the upper and lower ticks separately for the x-axis. The ``Axis``
-also stores the data and view intervals used in auto-scaling, panning
-and zooming, as well as the :class:`~matplotlib.ticker.Locator` and
-:class:`~matplotlib.ticker.Formatter` instances which control where
-the ticks are placed and how they are represented as strings.
-
-Each ``Axis`` object contains a :attr:`~matplotlib.axis.Axis.label` attribute (this is what :mod:`~matplotlib.pylab` modifies in calls to :func:`~matplotlib.pylab.xlabel` and :func:`~matplotlib.pylab.ylabel`) as well as a list of major and minor ticks. The ticks are :class:`~matplotlib.axis.XTick` and :class:`~matplotlib.axis.YTick` instances, which contain the actual line and text primitives that render the ticks and ticklabels. Because the ticks are dynamically created as needed (eg. when panning and zooming), you should access the lists of major and minor ticks through their accessor methods :meth:`~matplotlib.axis.Axis.get_major_ticks` and :meth:`~matplotlib.axis.Axis.get_minor_ticks`. Although the ticks contain all the primitives and will be covered below, the ``Axis`` methods contain accessor methods to return the tick lines, tick labels, tick locations etc.:
-
-.. sourcecode:: ipython
-
- In [285]: axis = ax.xaxis
-
- In [286]: axis.get_ticklocs()
- Out[286]: array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
-
- In [287]: axis.get_ticklabels()
- Out[287]: <a list of 10 Text major ticklabel objects>
-
- # note there are twice as many ticklines as labels because by
- # default there are tick lines at the top and bottom but only tick
- # labels below the xaxis; this can be customized
- In [288]: axis.get_ticklines()
- Out[288]: <a list of 20 Line2D ticklines objects>
-
- # by default you get the major ticks back
- In [291]: axis.get_ticklines()
- Out[291]: <a list of 20 Line2D ticklines objects>
-
- # but you can also ask for the minor ticks
- In [292]: axis.get_ticklines(minor=True)
- Out[292]: <a list of 0 Line2D ticklines objects>
-
-Here is a summary of some of the useful accessor methods of the ``Axis``
-(these have corresponding setters where useful, such as
-set_major_formatter)
-
-====================== =========================================================
-Accessor method Description
-====================== =========================================================
-get_scale The scale of the axis, eg 'log' or 'linear'
-get_view_interval The interval instance of the axis view limits
-get_data_interval The interval instance of the axis data limits
-get_gridlines A list of grid lines for the Axis
-get_label The axis label - a Text instance
-get_ticklabels A list of Text instances - keyword minor=True|False
-get_ticklines A list of Line2D instances - keyword minor=True|False
-get_ticklocs A list of Tick locations - keyword minor=True|False
-get_major_locator The matplotlib.ticker.Locator instance for major ticks
-get_major_formatter The matplotlib.ticker.Formatter instance for major ticks
-get_minor_locator The matplotlib.ticker.Locator instance for minor ticks
-get_minor_formatter The matplotlib.ticker.Formatter instance for minor ticks
-get_major_ticks A list of Tick instances for major ticks
-get_minor_ticks A list of Tick instances for minor ticks
-grid Turn the grid on or off for the major or minor ticks
-====================== =========================================================
-
-Here is an example, not recommended for its beauty, which customizes
-the axes and tick properties
-
-.. plot:: pyplots/fig_axes_customize_simple.py
- :include-source:
-
-
-.. _tick-container:
-
-Tick containers
-===============
-
-The :class:`matplotlib.axis.Tick` is the final container object in our
-descent from the :class:`~matplotlib.figure.Figure` to the
-:class:`~matplotlib.axes.Axes` to the :class:`~matplotlib.axis.Axis`
-to the :class:`~matplotlib.axis.Tick`. The ``Tick`` contains the tick
-and grid line instances, as well as the label instances for the upper
-and lower ticks. Each of these is accessible directly as an attribute
-of the ``Tick``. In addition, there are boolean variables that determine
-whether the upper labels and ticks are on for the x-axis and whether
-the right labels and ticks are on for the y-axis.
-
-============== ==========================================================
-Tick attribute Description
-============== ==========================================================
-tick1line Line2D instance
-tick2line Line2D instance
-gridline Line2D instance
-label1 Text instance
-label2 Text instance
-gridOn boolean which determines whether to draw the tickline
-tick1On boolean which determines whether to draw the 1st tickline
-tick2On boolean which determines whether to draw the 2nd tickline
-label1On boolean which determines whether to draw tick label
-label2On boolean which determines whether to draw tick label
-============== ==========================================================
-
-Here is an example which sets the formatter for the right side ticks with
-dollar signs and colors them green on the right side of the yaxis
-
-.. plot:: pyplots/dollar_ticks.py
- :include-source:
+.. _artist-tutorial:
+
+***************
+Artist tutorial
+***************
+
+There are three layers to the matplotlib API. The
+:class:`matplotlib.backend_bases.FigureCanvas` is the area onto which
+the figure is drawn, the :class:`matplotlib.backend_bases.Renderer` is
+the object which knows how to draw on the
+:class:`~matplotlib.backend_bases.FigureCanvas`, and the
+:class:`matplotlib.artist.Artist` is the object that knows how to use
+a renderer to paint onto the canvas. The
+:class:`~matplotlib.backend_bases.FigureCanvas` and
+:class:`~matplotlib.backend_bases.Renderer` handle all the details of
+talking to user interface toolkits like `wxPython
+<http://www.wxpython.org>`_ or drawing languages like PostScript®, and
+the ``Artist`` handles all the high level constructs like representing
+and laying out the figure, text, and lines. The typical user will
+spend 95% of his time working with the ``Artists``.
+
+There are two types of ``Artists``: primitives and containers. The primitives represent the standard graphical objects we want to paint onto our canvas: :class:`~matplotlib.lines.Line2D`, :class:`~matplotlib.patches.Rectangle`, :class:`~matplotlib.text.Text`, :class:`~matplotlib.image.AxesImage`, etc., and the containers are places to put them (:class:`~matplotlib.axis.Axis`, :class:`~matplotlib.axes.Axes` and :class:`~matplotlib.figure.Figure`). The standard use is to create a :class:`~matplotlib.figure.Figure` instance, use the ``Figure`` to create one or more :class:`~matplotlib.axes.Axes` or :class:`~matplotlib.axes.Subplot` instances, and use the ``Axes`` instance helper methods to create the primitives. In the example below, we create a ``Figure`` instance using :func:`matplotlib.pyplot.figure`, which is a convenience method for instantiating ``Figure`` instances and connecting them with your user interface or drawing toolkit ``FigureCanvas``. As we will discuss below, this is not necessary -- you
+can work directly with PostScript, PDF Gtk+, or wxPython ``FigureCanvas`` instances, instantiate your ``Figures`` directly and connect them yourselves -- but since we are focusing here on the ``Artist`` API we'll let :mod:`~matplotlib.pyplot` handle some of those details for us::
+
+ import matplotlib.pyplot as plt
+ fig = plt.figure()
+ ax = fig.add_subplot(2,1,1) # two rows, one column, first plot
+
+The :class:`~matplotlib.axes.Axes` is probably the most important
+class in the matplotlib API, and the one you will be working with most
+of the time. This is because the ``Axes`` is the plotting area into
+which most of the objects go, and the ``Axes`` has many special helper
+methods (:meth:`~matplotlib.axes.Axes.plot`,
+:meth:`~matplotlib.axes.Axes.text`,
+:meth:`~matplotlib.axes.Axes.hist`,
+:meth:`~matplotlib.axes.Axes.imshow`) to create the most common
+graphics primitives (:class:`~matplotlib.lines.Line2D`,
+:class:`~matplotlib.text.Text`,
+:class:`~matplotlib.patches.Rectangle`,
+:class:`~matplotlib.image.Image`, respectively). These helper methods
+will take your data (eg. ``numpy`` arrays and strings) and create
+primitive ``Artist`` instances as needed (eg. ``Line2D``), add them to
+the relevant containers, and draw them when requested. Most of you
+are probably familiar with the :class:`~matplotlib.axes.Subplot`,
+which is just a special case of an ``Axes`` that lives on a regular
+rows by columns grid of ``Subplot`` instances. If you want to create
+an ``Axes`` at an arbitrary location, simply use the
+:meth:`~matplotlib.figure.Figure.add_axes` method which takes a list
+of ``[left, bottom, width, height]`` values in 0-1 relative figure
+coordinates::
+
+ fig2 = plt.figure()
+ ax2 = fig2.add_axes([0.15, 0.1, 0.7, 0.3])
+
+Continuing with our example::
+
+ import numpy as np
+ t = np.arange(0.0, 1.0, 0.01)
+ s = np.sin(2*np.pi*t)
+ line, = ax.plot(t, s, color='blue', lw=2)
+
+In this example, ``ax`` is the ``Axes`` instance created by the
+``fig.add_subplot`` call above (remember ``Subplot`` is just a
+subclass of ``Axes``) and when you call ``ax.plot``, it creates a
+``Line2D`` instance and adds it to the :attr:`Axes.lines
+<matplotlib.axes.Axes.lines>` list. In the interactive `ipython
+<http://ipython.scipy.org/>`_ session below, you can see that the
+``Axes.lines`` list is length one and contains the same line that was
+returned by the ``line, = ax.plot...`` call:
+
+.. sourcecode:: ipython
+
+ In [101]: ax.lines[0]
+ Out[101]: <matplotlib.lines.Line2D instance at 0x19a95710>
+
+ In [102]: line
+ Out[102]: <matplotlib.lines.Line2D instance at 0x19a95710>
+
+If you make subsequent calls to ``ax.plot`` (and the hold state is "on"
+which is the default) then additional lines will be added to the list.
+You can remove lines later simply by calling the list methods; either
+of these will work::
+
+ del ax.lines[0]
+ ax.lines.remove(line) # one or the other, not both!
+
+The Axes also has helper methods to configure and decorate the x-axis
+and y-axis tick, tick labels and axis labels::
+
+ xtext = ax.set_xlabel('my xdata') # returns a Text instance
+ ytext = ax.set_ylabel('my xdata')
+
+When you call :meth:`ax.set_xlabel <matplotlib.axes.Axes.set_xlabel>`,
+it passes the information on the :class:`~matplotlib.text.Text`
+instance of the :class:`~matplotlib.axis.XAxis`. Each ``Axes``
+instance contains an :class:`~matplotlib.axis.XAxis` and a
+:class:`~matplotlib.axis.YAxis` instance, which handle the layout and
+drawing of the ticks, tick labels and axis labels.
+
+.. I'm commenting this out, since the new Sphinx cross-references
+.. sort of take care of this above - MGD
+
+.. Here are the most important matplotlib modules that contain the
+.. classes referenced above
+
+.. =============== ==================
+.. Artist Module
+.. =============== ==================
+.. Artist matplotlib.artist
+.. Rectangle matplotlib.patches
+.. Line2D matplotlib.lines
+.. Axes matplotlib.axes
+.. XAxis and YAxis matplotlib.axis
+.. Figure matplotlib.figure
+.. Text	 matplotlib.text
+.. =============== ==================
+
+Try creating the figure below.
+
+.. plot:: pyplots/fig_axes_labels_simple.py
+
+.. _customizing-artists:
+
+Customizing your objects
+========================
+
+Every element in the figure is represented by a matplotlib
+:class:`~matplotlib.artist.Artist`, and each has an extensive list of
+properties to configure its appearance. The figure itself contains a
+:class:`~matplotlib.patches.Rectangle` exactly the size of the figure,
+which you can use to set the background color and transparency of the
+figures. Likewise, each :class:`~matplotlib.axes.Axes` bounding box
+(the standard white box with black edges in the typical matplotlib
+plot, has a ``Rectangle`` instance that determines the color,
+transparency, and other properties of the Axes. These instances are
+stored as member variables :attr:`Figure.patch
+<matplotlib.figure.Figure.patch>` and :attr:`Axes.patch
+<matplotlib.axes.Axes.patch>` ("Patch" is a name inherited from
+MATLAB, and is a 2D "patch" of color on the figure, eg. rectangles,
+circles and polygons). Every matplotlib ``Artist`` has the following
+properties
+
+========== ======================================================================
+Property Description
+========== ======================================================================
+alpha 	 The transparency - a scalar from 0-1
+animated A boolean that is used to facilitate animated drawing
+axes The axes that the Artist lives in, possibly None
+clip_box The bounding box that clips the Artist
+clip_on Whether clipping is enabled
+clip_path The path the artist is clipped to
+contains A picking function to test whether the artist contains the pick point
+figure The figure instance the artist lives in, possibly None
+label A text label (eg. for auto-labeling)
+picker A python object that controls object picking
+transform The transformation
+visible A boolean whether the artist should be drawn
+zorder A number which determines the drawing order
+========== ======================================================================
+
+Each of the properties is accessed with an old-fashioned setter or
+getter (yes we know this irritates Pythonistas and we plan to support
+direct access via properties or traits but it hasn't been done yet).
+For example, to multiply the current alpha by a half::
+
+ a = o.get_alpha()
+ o.set_alpha(0.5*a)
+
+If you want to set a number of properties at once, you can also use
+the ``set`` method with keyword arguments. For example::
+
+ o.set(alpha=0.5, zorder=2)
+
+If you are working interactively at the python shell, a handy way to
+inspect the ``Artist`` properties is to use the
+:func:`matplotlib.artist.getp` function (simply
+:func:`~matplotlib.pylab.getp` in pylab), which lists the properties
+and their values. This works for classes derived from ``Artist`` as
+well, eg. ``Figure`` and ``Rectangle``. Here are the ``Figure`` rectangle
+properties mentioned above:
+
+.. sourcecode:: ipython
+
+ In [149]: matplotlib.artist.getp(fig.patch)
+	alpha = 1.0
+	animated = False
+	antialiased or aa = True
+	axes = None
+	clip_box = None
+	clip_on = False
+	clip_path = None
+	contains = None
+	edgecolor or ec = w
+	facecolor or fc = 0.75
+	figure = Figure(8.125x6.125)
+	fill = 1
+	hatch = None
+	height = 1
+	label =
+	linewidth or lw = 1.0
+	picker = None
+	transform = <Affine object at 0x134cca84>
+	verts = ((0, 0), (0, 1), (1, 1), (1, 0))
+	visible = True
+	width = 1
+	window_extent = <Bbox object at 0x134acbcc>
+	x = 0
+	y = 0
+	zorder = 1
+
+.. TODO: Update these URLs
+
+The docstrings for all of the classes also contain the ``Artist``
+properties, so you can consult the interactive "help" or the
+:ref:`artist-api` for a listing of properties for a given object.
+
+.. _object-containers:
+
+Object containers
+=================
+
+
+Now that we know how to inspect and set the properties of a given
+object we want to configure, we need to now how to get at that object.
+As mentioned in the introduction, there are two kinds of objects:
+primitives and containers. The primitives are usually the things you
+want to configure (the font of a :class:`~matplotlib.text.Text`
+instance, the width of a :class:`~matplotlib.lines.Line2D`) although
+the containers also have some properties as well -- for example the
+:class:`~matplotlib.axes.Axes` :class:`~matplotlib.artist.Artist` is a
+container that contains many of the primitives in your plot, but it
+also has properties like the ``xscale`` to control whether the xaxis
+is 'linear' or 'log'. In this section we'll review where the various
+container objects store the ``Artists`` that you want to get at.
+
+.. _figure-container:
+
+Figure container
+================
+
+The top level container ``Artist`` is the
+:class:`matplotlib.figure.Figure`, and it contains everything in the
+figure. The background of the figure is a
+:class:`~matplotlib.patches.Rectangle` which is stored in
+:attr:`Figure.patch <matplotlib.figure.Figure.patch>`. As
+you add subplots (:meth:`~matplotlib.figure.Figure.add_subplot`) and
+axes (:meth:`~matplotlib.figure.Figure.add_axes`) to the figure
+these will be appended to the :attr:`Figure.axes
+<matplotlib.figure.Figure.axes>`. These are also returned by the
+methods that create them:
+
+.. sourcecode:: ipython
+
+ In [156]: fig = plt.figure()
+
+ In [157]: ax1 = fig.add_subplot(211)
+
+ In [158]: ax2 = fig.add_axes([0.1, 0.1, 0.7, 0.3])
+
+ In [159]: ax1
+ Out[159]: <matplotlib.axes.Subplot instance at 0xd54b26c>
+
+ In [160]: print fig.axes
+ [<matplotlib.axes.Subplot instance at 0xd54b26c>, <matplotlib.axes.Axes instance at 0xd3f0b2c>]
+
+Because the figure maintains the concept of the "current axes" (see
+:meth:`Figure.gca <matplotlib.figure.Figure.gca>` and
+:meth:`Figure.sca <matplotlib.figure.Figure.sca>`) to support the
+pylab/pyplot state machine, you should not insert or remove axes
+directly from the axes list, but rather use the
+:meth:`~matplotlib.figure.Figure.add_subplot` and
+:meth:`~matplotlib.figure.Figure.add_axes` methods to insert, and the
+:meth:`~matplotlib.figure.Figure.delaxes` method to delete. You are
+free however, to iterate over the list of axes or index into it to get
+access to ``Axes`` instances you want to customize. Here is an
+example which turns all the axes grids on::
+
+ for ax in fig.axes:
+ ax.grid(True)
+
+
+The figure also has its own text, lines, patches and images, which you
+can use to add primitives directly. The default coordinate system for
+the ``Figure`` will simply be in pixels (which is not usually what you
+want) but you can control this by setting the transform property of
+the ``Artist`` you are adding to the figure.
+
+.. TODO: Is that still true?
+
+More useful is "figure coordinates" where (0, 0) is the bottom-left of
+the figure and (1, 1) is the top-right of the figure which you can
+obtain by setting the ``Artist`` transform to :attr:`fig.transFigure
+<matplotlib.figure.Figure.transFigure>`:
+
+.. sourcecode:: ipython
+
+ In [191]: fig = plt.figure()
+
+ In [192]: l1 = matplotlib.lines.Line2D([0, 1], [0, 1],
+ transform=fig.transFigure, figure=fig)
+
+ In [193]: l2 = matplotlib.lines.Line2D([0, 1], [1, 0],
+ transform=fig.transFigure, figure=fig)
+
+ In [194]: fig.lines.extend([l1, l2])
+
+ In [195]: fig.canvas.draw()
+
+.. plot:: pyplots/fig_x.py
+
+
+Here is a summary of the Artists the figure contains
+
+.. TODO: Add xrefs to this table
+
+================ ===============================================================
+Figure attribute Description
+================ ===============================================================
+axes A list of Axes instances (includes Subplot)
+patch The Rectangle background
+images A list of FigureImages patches - useful for raw pixel display
+legends A list of Figure Legend instances (different from Axes.legends)
+lines A list of Figure Line2D instances (rarely used, see Axes.lines)
+patches A list of Figure patches (rarely used, see Axes.patches)
+texts A list Figure Text instances
+================ ===============================================================
+
+.. _axes-container:
+
+Axes container
+==============
+
+The :class:`matplotlib.axes.Axes` is the center of the matplotlib
+universe -- it contains the vast majority of all the ``Artists`` used
+in a figure with many helper methods to create and add these
+``Artists`` to itself, as well as helper methods to access and
+customize the ``Artists`` it contains. Like the
+:class:`~matplotlib.figure.Figure`, it contains a
+:class:`~matplotlib.patches.Patch`
+:attr:`~matplotlib.axes.Axes.patch` which is a
+:class:`~matplotlib.patches.Rectangle` for Cartesian coordinates and a
+:class:`~matplotlib.patches.Circle` for polar coordinates; this patch
+determines the shape, background and border of the plotting region::
+
+ ax = fig.add_subplot(111)
+ rect = ax.patch # a Rectangle instance
+ rect.set_facecolor('green')
+
+When you call a plotting method, eg. the canonical
+:meth:`~matplotlib.axes.Axes.plot` and pass in arrays or lists of
+values, the method will create a :meth:`matplotlib.lines.Line2D`
+instance, update the line with all the ``Line2D`` properties passed as
+keyword arguments, add the line to the :attr:`Axes.lines
+<matplotlib.axes.Axes.lines>` container, and returns it to you:
+
+.. sourcecode:: ipython
+
+ In [213]: x, y = np.random.rand(2, 100)
+
+ In [214]: line, = ax.plot(x, y, '-', color='blue', linewidth=2)
+
+``plot`` returns a list of lines because you can pass in multiple x, y
+pairs to plot, and we are unpacking the first element of the length
+one list into the line variable. The line has been added to the
+``Axes.lines`` list:
+
+.. sourcecode:: ipython
+
+ In [229]: print ax.lines
+ [<matplotlib.lines.Line2D instance at 0xd378b0c>]
+
+Similarly, methods that create patches, like
+:meth:`~matplotlib.axes.Axes.bar` creates a list of rectangles, will
+add the patches to the :attr:`Axes.patches
+<matplotlib.axes.Axes.patches>` list:
+
+.. sourcecode:: ipython
+
+ In [233]: n, bins, rectangles = ax.hist(np.random.randn(1000), 50, facecolor='yellow')
+
+ In [234]: rectangles
+ Out[234]: <a list of 50 Patch objects>
+
+ In [235]: print len(ax.patches)
+
+You should not add objects directly to the ``Axes.lines`` or
+``Axes.patches`` lists unless you know exactly what you are doing,
+because the ``Axes`` needs to do a few things when it creates and adds
+an object. It sets the figure and axes property of the ``Artist``, as
+well as the default ``Axes`` transformation (unless a transformation
+is set). It also inspects the data contained in the ``Artist`` to
+update the data structures controlling auto-scaling, so that the view
+limits can be adjusted to contain the plotted data. You can,
+nonetheless, create objects yourself and add them directly to the
+``Axes`` using helper methods like
+:meth:`~matplotlib.axes.Axes.add_line` and
+:meth:`~matplotlib.axes.Axes.add_patch`. Here is an annotated
+interactive session illustrating what is going on:
+
+.. sourcecode:: ipython
+
+ In [261]: fig = plt.figure()
+
+ In [262]: ax = fig.add_subplot(111)
+
+ # create a rectangle instance
+ In [263]: rect = matplotlib.patches.Rectangle( (1,1), width=5, height=12)
+
+ # by default the axes instance is None
+ In [264]: print rect.get_axes()
+ None
+
+ # and the transformation instance is set to the "identity transform"
+ In [265]: print rect.get_transform()
+ <Affine object at 0x13695544>
+
+ # now we add the Rectangle to the Axes
+ In [266]: ax.add_patch(rect)
+
+ # and notice that the ax.add_patch method has set the axes
+ # instance
+ In [267]: print rect.get_axes()
+ Axes(0.125,0.1;0.775x0.8)
+
+ # and the transformation has been set too
+ In [268]: print rect.get_transform()
+ <Affine object at 0x15009ca4>
+
+ # the default axes transformation is ax.transData
+ In [269]: print ax.transData
+ <Affine object at 0x15009ca4>
+
+ # notice that the xlimits of the Axes have not been changed
+ In [270]: print ax.get_xlim()
+ (0.0, 1.0)
+
+ # but the data limits have been updated to encompass the rectangle
+ In [271]: print ax.dataLim.bounds
+ (1.0, 1.0, 5.0, 12.0)
+
+ # we can manually invoke the auto-scaling machinery
+ In [272]: ax.autoscale_view()
+
+ # and now the xlim are updated to encompass the rectangle
+ In [273]: print ax.get_xlim()
+ (1.0, 6.0)
+
+ # we have to manually force a figure draw
+ In [274]: ax.figure.canvas.draw()
+
+
+There are many, many ``Axes`` helper methods for creating primitive
+``Artists`` and adding them to their respective containers. The table
+below summarizes a small sampling of them, the kinds of ``Artist`` they
+create, and where they store them
+
+============================== ==================== =======================
+Helper method Artist Container
+============================== ==================== =======================
+ax.annotate - text annotations Annotate ax.texts
+ax.bar - bar charts Rectangle ax.patches
+ax.errorbar - error bar plots Line2D and Rectangle ax.lines and ax.patches
+ax.fill - shared area Polygon ax.patches
+ax.hist - histograms Rectangle ax.patches
+ax.imshow - image data AxesImage ax.images
+ax.legend - axes legends Legend ax.legends
+ax.plot - xy plots Line2D ax.lines
+ax.scatter - scatter charts PolygonCollection ax.collections
+ax.text - text Text ax.texts
+============================== ==================== =======================
+
+
+In addition to all of these ``Artists``, the ``Axes`` contains two
+important ``Artist`` containers: the :class:`~matplotlib.axis.XAxis`
+and :class:`~matplotlib.axis.YAxis`, which handle the drawing of the
+ticks and labels. These are stored as instance variables
+:attr:`~matplotlib.axes.Axes.xaxis` and
+:attr:`~matplotlib.axes.Axes.yaxis`. The ``XAxis`` and ``YAxis``
+containers will be detailed below, but note that the ``Axes`` contains
+many helper methods which forward calls on to the
+:class:`~matplotlib.axis.Axis` instances so you often do not need to
+work with them directly unless you want to. For example, you can set
+the font size of the ``XAxis`` ticklabels using the ``Axes`` helper
+method::
+
+ for label in ax.get_xticklabels():
+ label.set_color('orange')
+
+Below is a summary of the Artists that the Axes contains
+
+============== ======================================
+Axes attribute Description
+============== ======================================
+artists A list of Artist instances
+patch Rectangle instance for Axes background
+collections A list of Collection instances
+images A list of AxesImage
+legends A list of Legend instances
+lines A list of Line2D instances
+patches A list of Patch instances
+texts A list of Text instances
+xaxis matplotlib.axis.XAxis instance
+yaxis matplotlib.axis.YAxis instance
+============== ======================================
+
+.. _axis-container:
+
+Axis containers
+===============
+
+The :class:`matplotlib.axis.Axis` instances handle the drawing of the
+tick lines, the grid lines, the tick labels and the axis label. You
+can configure the left and right ticks separately for the y-axis, and
+the upper and lower ticks separately for the x-axis. The ``Axis``
+also stores the data and view intervals used in auto-scaling, panning
+and zooming, as well as the :class:`~matplotlib.ticker.Locator` and
+:class:`~matplotlib.ticker.Formatter` instances which control where
+the ticks are placed and how they are represented as strings.
+
+Each ``Axis`` object contains a :attr:`~matplotlib.axis.Axis.label` attribute (this is what :mod:`~matplotlib.pylab` modifies in calls to :func:`~matplotlib.pylab.xlabel` and :func:`~matplotlib.pylab.ylabel`) as well as a list of major and minor ticks. The ticks are :class:`~matplotlib.axis.XTick` and :class:`~matplotlib.axis.YTick` instances, which contain the actual line and text primitives that render the ticks and ticklabels. Because the ticks are dynamically created as needed (eg. when panning and zooming), you should access the lists of major and minor ticks through their accessor methods :meth:`~matplotlib.axis.Axis.get_major_ticks` and :meth:`~matplotlib.axis.Axis.get_minor_ticks`. Although the ticks contain all the primitives and will be covered below, the ``Axis`` methods contain accessor methods to return the tick lines, tick labels, tick locations etc.:
+
+.. sourcecode:: ipython
+
+ In [285]: axis = ax.xaxis
+
+ In [286]: axis.get_ticklocs()
+ Out[286]: array([ 0., 1., 2., 3., 4., 5., 6., 7., 8., 9.])
+
+ In [287]: axis.get_ticklabels()
+ Out[287]: <a list of 10 Text major ticklabel objects>
+
+ # note there are twice as many ticklines as labels because by
+ # default there are tick lines at the top and bottom but only tick
+ # labels below the xaxis; this can be customized
+ In [288]: axis.get_ticklines()
+ Out[288]: <a list of 20 Line2D ticklines objects>
+
+ # by default you get the major ticks back
+ In [291]: axis.get_ticklines()
+ Out[291]: <a list of 20 Line2D ticklines objects>
+
+ # but you can also ask for the minor ticks
+ In [292]: axis.get_ticklines(minor=True)
+ Out[292]: <a list of 0 Line2D ticklines objects>
+
+Here is a summary of some of the useful accessor methods of the ``Axis``
+(these have corresponding setters where useful, such as
+set_major_formatter)
+
+====================== =========================================================
+Accessor method Description
+====================== =========================================================
+get_scale The scale of the axis, eg 'log' or 'linear'
+get_view_interval ...
 
[truncated message content]
From: <ef...@us...> - 2010年06月26日 07:37:51
Revision: 8467
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8467&view=rev
Author: efiring
Date: 2010年06月26日 07:37:44 +0000 (2010年6月26日)
Log Message:
-----------
disable non-functional interactive.py demo: print message and exit.
Otherwise, this demo will hang.
Modified Paths:
--------------
 trunk/matplotlib/examples/user_interfaces/interactive.py
 trunk/matplotlib/examples/user_interfaces/interactive2.py
Modified: trunk/matplotlib/examples/user_interfaces/interactive.py
===================================================================
--- trunk/matplotlib/examples/user_interfaces/interactive.py	2010年06月24日 21:17:30 UTC (rev 8466)
+++ trunk/matplotlib/examples/user_interfaces/interactive.py	2010年06月26日 07:37:44 UTC (rev 8467)
@@ -1,6 +1,11 @@
 #!/usr/bin/env python
 """Multithreaded interactive interpreter with GTK and Matplotlib support.
 
+WARNING:
+As of 2010年06月25日, this is not working, at least on Linux.
+I have disabled it as a runnable script. - EF
+
+
 Usage:
 
 pyint-gtk.py -> starts shell with gtk thread running separately
@@ -183,7 +188,7 @@
 specific GTK hooks in it."""
 
 def __init__(self,banner=None):
- banner = """\nWelcome to matplotlib, a matlab-like python environment.
+ banner = """\nWelcome to matplotlib, a MATLAB-like python environment.
 help(matlab) -> help on matlab compatible commands from matplotlib.
 help(plotting) -> help on plotting commands.
 """
@@ -221,6 +226,9 @@
 matplotlib.interactive(1) # turn on interaction
 
 if __name__ == '__main__':
+ print "This demo is not presently functional, so running"
+ print "it as a script has been disabled."
+ sys.exit()
 # Quick sys.argv hack to extract the option and leave filenames in sys.argv.
 # For real option handling, use optparse or getopt.
 if len(sys.argv) > 1 and sys.argv[1]=='-pylab':
Modified: trunk/matplotlib/examples/user_interfaces/interactive2.py
===================================================================
--- trunk/matplotlib/examples/user_interfaces/interactive2.py	2010年06月24日 21:17:30 UTC (rev 8466)
+++ trunk/matplotlib/examples/user_interfaces/interactive2.py	2010年06月26日 07:37:44 UTC (rev 8467)
@@ -25,7 +25,7 @@
 
 Welcome to matplotlib.
 
- help(matplotlib) -- shows a list of all matlab(TM) compatible commands provided
+ help(matplotlib) -- some general information about matplotlib
 help(plotting) -- shows a list of plot specific commands
 
 """
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8466
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8466&view=rev
Author: efiring
Date: 2010年06月24日 21:17:30 +0000 (2010年6月24日)
Log Message:
-----------
backend_gtk: don't use idle events for draw_rubberband.
Use of idle events for draw_rubberband was a peculiarity of backend_gtk.
When using zoom-to-rect, it often caused a rubberband draw event
to occur after the canvas redraw at the end of the zoom, leaving
the canvas showing the state before the zoom action instead of
showing the result of the action.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py	2010年06月24日 18:25:16 UTC (rev 8465)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py	2010年06月24日 21:17:30 UTC (rev 8466)
@@ -611,11 +611,9 @@
 self.win = window
 gtk.Toolbar.__init__(self)
 NavigationToolbar2.__init__(self, canvas)
- self._idle_draw_id = 0
 
 def set_message(self, s):
- if self._idle_draw_id == 0:
- self.message.set_label(s)
+ self.message.set_label(s)
 
 def set_cursor(self, cursor):
 self.canvas.window.set_cursor(cursord[cursor])
@@ -644,7 +642,8 @@
 h = abs(y1 - y0)
 
 rect = [int(val)for val in min(x0,x1), min(y0, y1), w, h]
- try: lastrect, imageBack = self._imageBack
+ try:
+ lastrect, imageBack = self._imageBack
 except AttributeError:
 #snap image back
 if event.inaxes is None:
@@ -655,16 +654,9 @@
 b = int(height)-(b+h)
 axrect = l,b,w,h
 self._imageBack = axrect, drawable.get_image(*axrect)
- drawable.draw_rectangle(gc, False, *rect)
- self._idle_draw_id = 0
 else:
- def idle_draw(*args):
- drawable.draw_image(gc, imageBack, 0, 0, *lastrect)
- drawable.draw_rectangle(gc, False, *rect)
- self._idle_draw_id = 0
- return False
- if self._idle_draw_id == 0:
- self._idle_draw_id = gobject.idle_add(idle_draw)
+ drawable.draw_image(gc, imageBack, 0, 0, *lastrect)
+ drawable.draw_rectangle(gc, False, *rect)
 
 
 def _init_toolbar(self):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8465
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8465&view=rev
Author: mdboom
Date: 2010年06月24日 18:25:16 +0000 (2010年6月24日)
Log Message:
-----------
[3018198] Fixing the build with clang
Typo in agg causes a template instantiation bug on compilers that actually instantiate everything.
Modified Paths:
--------------
 trunk/matplotlib/agg24/include/agg_scanline_u.h
Modified: trunk/matplotlib/agg24/include/agg_scanline_u.h
===================================================================
--- trunk/matplotlib/agg24/include/agg_scanline_u.h	2010年06月24日 17:59:48 UTC (rev 8464)
+++ trunk/matplotlib/agg24/include/agg_scanline_u.h	2010年06月24日 18:25:16 UTC (rev 8465)
@@ -2,8 +2,8 @@
 // Anti-Grain Geometry - Version 2.4
 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
 //
-// Permission to copy, use, modify, sell and distribute this software 
-// is granted provided this copyright notice appears in all copies. 
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
 // This software is provided "as is" without express or implied
 // warranty, and with no claim as to its suitability for any purpose.
 //
@@ -13,12 +13,12 @@
 // http://www.antigrain.com
 //----------------------------------------------------------------------------
 //
-// Adaptation for 32-bit screen coordinates (scanline32_u) has been sponsored by 
+// Adaptation for 32-bit screen coordinates (scanline32_u) has been sponsored by
 // Liberty Technology Systems, Inc., visit http://lib-sys.com
 //
 // Liberty Technology Systems, Inc. is the provider of
 // PostScript and PDF technology for software developers.
-// 
+//
 //----------------------------------------------------------------------------
 
 #ifndef AGG_SCANLINE_U_INCLUDED
@@ -32,22 +32,22 @@
 //
 // Unpacked scanline container class
 //
- // This class is used to transfer data from a scanline rasterizer 
- // to the rendering buffer. It's organized very simple. The class stores 
- // information of horizontal spans to render it into a pixel-map buffer. 
- // Each span has staring X, length, and an array of bytes that determine the 
- // cover-values for each pixel. 
- // Before using this class you should know the minimal and maximal pixel 
+ // This class is used to transfer data from a scanline rasterizer
+ // to the rendering buffer. It's organized very simple. The class stores
+ // information of horizontal spans to render it into a pixel-map buffer.
+ // Each span has staring X, length, and an array of bytes that determine the
+ // cover-values for each pixel.
+ // Before using this class you should know the minimal and maximal pixel
 // coordinates of your scanline. The protocol of using is:
 // 1. reset(min_x, max_x)
- // 2. add_cell() / add_span() - accumulate scanline. 
+ // 2. add_cell() / add_span() - accumulate scanline.
 // When forming one scanline the next X coordinate must be always greater
 // than the last stored one, i.e. it works only with ordered coordinates.
 // 3. Call finalize(y) and render the scanline.
 // 3. Call reset_spans() to prepare for the new scanline.
- // 
+ //
 // 4. Rendering:
- // 
+ //
 // Scanline provides an iterator class that allows you to extract
 // the spans and the cover values for each pixel. Be aware that clipping
 // has not been done yet, so you should perform it yourself.
@@ -61,10 +61,10 @@
 // ************************************
 //
 // scanline_u8::const_iterator span = sl.begin();
- // 
- // unsigned char* row = m_rbuf->row(y); // The the address of the beginning 
+ //
+ // unsigned char* row = m_rbuf->row(y); // The the address of the beginning
 // // of the current row
- // 
+ //
 // unsigned num_spans = sl.num_spans(); // Number of spans. It's guaranteed that
 // // num_spans is always greater than 0.
 //
@@ -75,7 +75,7 @@
 //
 // int num_pix = span->len; // Number of pixels of the span.
 // // Always greater than 0, still it's
- // // better to use "int" instead of 
+ // // better to use "int" instead of
 // // "unsigned" because it's more
 // // convenient for clipping
 // int x = span->x;
@@ -86,24 +86,24 @@
 // **************************************
 //
 // unsigned char* dst = row + x; // Calculate the start address of the row.
- // // In this case we assume a simple 
+ // // In this case we assume a simple
 // // grayscale image 1-byte per pixel.
 // do
 // {
- // *dst++ = *covers++; // Hypotetical rendering. 
+ // *dst++ = *covers++; // Hypotetical rendering.
 // }
 // while(--num_pix);
 //
 // ++span;
- // } 
+ // }
 // while(--num_spans); // num_spans cannot be 0, so this loop is quite safe
 //------------------------------------------------------------------------
 //
 // The question is: why should we accumulate the whole scanline when we
 // could render just separate spans when they're ready?
- // That's because using the scanline is generally faster. When is consists 
+ // That's because using the scanline is generally faster. When is consists
 // of more than one span the conditions for the processor cash system
- // are better, because switching between two different areas of memory 
+ // are better, because switching between two different areas of memory
 // (that can be very large) occurs less frequently.
 //------------------------------------------------------------------------
 class scanline_u8
@@ -203,9 +203,9 @@
 }
 
 //--------------------------------------------------------------------
- void finalize(int y) 
- { 
- m_y = y; 
+ void finalize(int y)
+ {
+ m_y = y;
 }
 
 //--------------------------------------------------------------------
@@ -238,11 +238,11 @@
 
 
 //==========================================================scanline_u8_am
- // 
+ //
 // The scanline container with alpha-masking
- // 
+ //
 //------------------------------------------------------------------------
- template<class AlphaMask> 
+ template<class AlphaMask>
 class scanline_u8_am : public scanline_u8
 {
 public:
@@ -264,9 +264,9 @@
 unsigned count = base_type::num_spans();
 do
 {
- m_alpha_mask->combine_hspan(span->x, 
- base_type::y(), 
- span->covers, 
+ m_alpha_mask->combine_hspan(span->x,
+ base_type::y(),
+ span->covers,
 span->len);
 ++span;
 }
@@ -390,8 +390,8 @@
 }
 else
 {
- m_spans.add(span(coord_type(x + m_min_x), 
- coord_type(len), 
+ m_spans.add(span(coord_type(x + m_min_x),
+ coord_type(len),
 &m_covers[x]));
 }
 m_last_x = x + len - 1;
@@ -408,17 +408,17 @@
 }
 else
 {
- m_spans.add(span(coord_type(x + m_min_x), 
- coord_type(len), 
+ m_spans.add(span(coord_type(x + m_min_x),
+ coord_type(len),
 &m_covers[x]));
 }
 m_last_x = x + len - 1;
 }
 
 //--------------------------------------------------------------------
- void finalize(int y) 
- { 
- m_y = y; 
+ void finalize(int y)
+ {
+ m_y = y;
 }
 
 //--------------------------------------------------------------------
@@ -450,15 +450,15 @@
 
 
 //========================================================scanline32_u8_am
- // 
+ //
 // The scanline container with alpha-masking
- // 
+ //
 //------------------------------------------------------------------------
- template<class AlphaMask> 
+ template<class AlphaMask>
 class scanline32_u8_am : public scanline32_u8
 {
 public:
- typedef scanline_u8 base_type;
+ typedef scanline32_u8 base_type;
 typedef AlphaMask alpha_mask_type;
 typedef base_type::cover_type cover_type;
 typedef base_type::coord_type coord_type;
@@ -477,9 +477,9 @@
 unsigned count = base_type::num_spans();
 do
 {
- m_alpha_mask->combine_hspan(span->x, 
- base_type::y(), 
- span->covers, 
+ m_alpha_mask->combine_hspan(span->x,
+ base_type::y(),
+ span->covers,
 span->len);
 ++span;
 }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2010年06月24日 17:59:55
Revision: 8464
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8464&view=rev
Author: mdboom
Date: 2010年06月24日 17:59:48 +0000 (2010年6月24日)
Log Message:
-----------
Speed up Gouraud shading in Agg backend.
Modified Paths:
--------------
 trunk/matplotlib/src/_backend_agg.cpp
 trunk/matplotlib/src/_backend_agg.h
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp	2010年06月24日 17:12:26 UTC (rev 8463)
+++ trunk/matplotlib/src/_backend_agg.cpp	2010年06月24日 17:59:48 UTC (rev 8464)
@@ -1824,19 +1824,15 @@
 }
 
 void
-RendererAgg::_draw_gouraud_triangle(const GCAgg& gc, const double* points,
+RendererAgg::_draw_gouraud_triangle(const double* points,
 const double* colors,
- agg::trans_affine trans)
+ agg::trans_affine trans,
+ bool has_clippath)
 {
 typedef agg::rgba8 color_t;
 typedef agg::span_gouraud_rgba<color_t> span_gen_t;
 typedef agg::span_allocator<color_t> span_alloc_t;
 
- theRasterizer.reset_clipping();
- rendererBase.reset_clipping(true);
- set_clipbox(gc.cliprect, theRasterizer);
- bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
-
 trans *= agg::trans_affine_scaling(1.0, -1.0);
 trans *= agg::trans_affine_translation(0.0, (double)height);
 
@@ -1897,6 +1893,11 @@
 PyArrayObject* points = NULL;
 PyArrayObject* colors = NULL;
 
+ theRasterizer.reset_clipping();
+ rendererBase.reset_clipping(true);
+ set_clipbox(gc.cliprect, theRasterizer);
+ bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
+
 try
 {
 points = (PyArrayObject*)PyArray_ContiguousFromAny
@@ -1916,7 +1917,8 @@
 }
 
 _draw_gouraud_triangle(
- gc, (double*)PyArray_DATA(points), (double*)PyArray_DATA(colors), trans);
+ (double*)PyArray_DATA(points), (double*)PyArray_DATA(colors),
+ trans, has_clippath);
 }
 catch (...)
 {
@@ -1951,6 +1953,11 @@
 PyArrayObject* points = NULL;
 PyArrayObject* colors = NULL;
 
+ theRasterizer.reset_clipping();
+ rendererBase.reset_clipping(true);
+ set_clipbox(gc.cliprect, theRasterizer);
+ bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
+
 try
 {
 points = (PyArrayObject*)PyArray_ContiguousFromAny
@@ -1976,7 +1983,9 @@
 
 for (int i = 0; i < PyArray_DIM(points, 0); ++i)
 {
- _draw_gouraud_triangle(gc, (double*)PyArray_GETPTR1(points, i), (double*)PyArray_GETPTR1(colors, i), trans);
+ _draw_gouraud_triangle(
+ (double*)PyArray_GETPTR1(points, i),
+ (double*)PyArray_GETPTR1(colors, i), trans, has_clippath);
 }
 }
 catch (...)
Modified: trunk/matplotlib/src/_backend_agg.h
===================================================================
--- trunk/matplotlib/src/_backend_agg.h	2010年06月24日 17:12:26 UTC (rev 8463)
+++ trunk/matplotlib/src/_backend_agg.h	2010年06月24日 17:59:48 UTC (rev 8464)
@@ -263,8 +263,8 @@
 
 void
 _draw_gouraud_triangle(
- const GCAgg& gc,
- const double* points, const double* colors, agg::trans_affine trans);
+ const double* points, const double* colors,
+ agg::trans_affine trans, bool has_clippath);
 
 private:
 void create_alpha_buffers();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2010年06月24日 17:12:32
Revision: 8463
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8463&view=rev
Author: mdboom
Date: 2010年06月24日 17:12:26 +0000 (2010年6月24日)
Log Message:
-----------
Clipping to the figure rectangle doesn't work on curves, so turn it off in that case.
Modified Paths:
--------------
 trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp	2010年06月24日 17:05:49 UTC (rev 8462)
+++ trunk/matplotlib/src/_backend_agg.cpp	2010年06月24日 17:12:26 UTC (rev 8463)
@@ -1304,7 +1304,7 @@
 
 trans *= agg::trans_affine_scaling(1.0, -1.0);
 trans *= agg::trans_affine_translation(0.0, (double)height);
- bool clip = !face.first && gc.hatchpath.isNone();
+ bool clip = !face.first && gc.hatchpath.isNone() && !path.has_curves();
 bool simplify = path.should_simplify() && clip;
 
 transformed_path_t tpath(path, trans);
@@ -1498,7 +1498,7 @@
 }
 }
 
- bool do_clip = !face.first && gc.hatchpath.isNone();
+ bool do_clip = !face.first && gc.hatchpath.isNone() && !has_curves;
 
 if (check_snap)
 {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2010年06月24日 17:05:55
Revision: 8462
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8462&view=rev
Author: mdboom
Date: 2010年06月24日 17:05:49 +0000 (2010年6月24日)
Log Message:
-----------
Use the more standard term "pop" rather than "flush" for removing the next item from the queue.
Modified Paths:
--------------
 trunk/matplotlib/src/path_converters.h
Modified: trunk/matplotlib/src/path_converters.h
===================================================================
--- trunk/matplotlib/src/path_converters.h	2010年06月24日 14:48:00 UTC (rev 8461)
+++ trunk/matplotlib/src/path_converters.h	2010年06月24日 17:05:49 UTC (rev 8462)
@@ -88,7 +88,7 @@
 }
 
 inline bool
- queue_flush(unsigned *cmd, double *x, double *y)
+ queue_pop(unsigned *cmd, double *x, double *y)
 {
 if (queue_nonempty())
 {
@@ -159,7 +159,7 @@
 if (m_has_curves)
 {
 /* This is the slow method for when there might be curves. */
- if (queue_flush(&code, x, y))
+ if (queue_pop(&code, x, y))
 {
 return code;
 }
@@ -216,7 +216,7 @@
 }
 }
 
- if (queue_flush(&code, x, y))
+ if (queue_pop(&code, x, y))
 {
 return code;
 }
@@ -567,7 +567,7 @@
 the queue before proceeding to the main loop below.
 -- Michael Droettboom */
 
- if (queue_flush(&cmd, x, y))
+ if (queue_pop(&cmd, x, y))
 {
 return cmd;
 }
@@ -740,7 +740,7 @@
 
 /* Return the first item in the queue, if any, otherwise
 indicate that we're done. */
- if (queue_flush(&cmd, x, y))
+ if (queue_pop(&cmd, x, y))
 {
 return cmd;
 }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2010年06月24日 14:48:06
Revision: 8461
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8461&view=rev
Author: mdboom
Date: 2010年06月24日 14:48:00 +0000 (2010年6月24日)
Log Message:
-----------
[3020704] set_xlim() problem
Bug in PathClipper when vertices fall precisely on the clipping edge.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/tests/test_simplification.py
 trunk/matplotlib/src/path_converters.h
Added Paths:
-----------
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.pdf
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.png
 trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.pdf
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.pdf
___________________________________________________________________
Added: svn:mime-type
 + application/octet-stream
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.png
===================================================================
(Binary files differ)
Property changes on: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.png
___________________________________________________________________
Added: svn:mime-type
 + application/octet-stream
Added: trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg
===================================================================
--- trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg	 (rev 0)
+++ trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg	2010年06月24日 14:48:00 UTC (rev 8461)
@@ -0,0 +1,104 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
+ "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<!-- Created with matplotlib (http://matplotlib.sourceforge.net/) -->
+<svg width="144pt" height="72pt" viewBox="0 0 144 72"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ version="1.1"
+ id="svg1">
+<filter id="colorAdd"><feComposite in="SourceGraphic" in2="BackgroundImage" operator="arithmetic" k2="1" k3="1"/></filter>
+<g id="figure1">
+<g id="patch1">
+<path style="fill: #ffffff; stroke: #ffffff; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" d="M0.000000 72.000000L144.000000 72.000000L144.000000 0.000000
+L0.000000 0.000000L0.000000 72.000000"/>
+</g>
+<g id="axes1">
+<g id="patch2">
+<path style="fill: #ffffff; opacity: 1.000000" d="M0.000000 72.000000L144.000000 72.000000L144.000000 0.000000
+L0.000000 0.000000L0.000000 72.000000"/>
+</g>
+<g id="line2d1">
+<defs>
+ <clipPath id="p7a7a30041bcd0eda414889f4295b8ec2">
+<rect x="0.000000" y="0.000000" width="144.000000" height="72.000000"/>
+ </clipPath>
+</defs><path style="fill: none; stroke: #0000ff; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" clip-path="url(#p7a7a30041bcd0eda414889f4295b8ec2)" d="M-180.000000 72.000000L36.000000 72.000000L72.000000 14.400000
+L108.000000 72.000000L144.000000 0.000000"/>
+</g>
+<g id="matplotlib.axis1">
+<g id="xtick1">
+<g id="line2d2">
+<defs><path id="m30e32995789d870ad79a2e54c91cf9c6" d="M0.000000 0.000000L0.000000 -4.000000"/></defs>
+<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m30e32995789d870ad79a2e54c91cf9c6" x="0.000000" y="72.000000"/>
+</g></g>
+</g>
+<g id="xtick2">
+<g id="line2d3">
+<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m30e32995789d870ad79a2e54c91cf9c6" x="36.000000" y="72.000000"/>
+</g></g>
+</g>
+<g id="xtick3">
+<g id="line2d4">
+<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m30e32995789d870ad79a2e54c91cf9c6" x="72.000000" y="72.000000"/>
+</g></g>
+</g>
+<g id="xtick4">
+<g id="line2d5">
+<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m30e32995789d870ad79a2e54c91cf9c6" x="108.000000" y="72.000000"/>
+</g></g>
+</g>
+<g id="xtick5">
+<g id="line2d6">
+<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m30e32995789d870ad79a2e54c91cf9c6" x="144.000000" y="72.000000"/>
+</g></g>
+</g>
+</g>
+<g id="matplotlib.axis2">
+<g id="ytick1">
+<g id="line2d7">
+<defs><path id="m3400efa6b1638b3fea9e19e898273957" d="M0.000000 0.000000L4.000000 0.000000"/></defs>
+<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m3400efa6b1638b3fea9e19e898273957" x="0.000000" y="72.000000"/>
+</g></g>
+</g>
+<g id="ytick2">
+<g id="line2d8">
+<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m3400efa6b1638b3fea9e19e898273957" x="0.000000" y="57.600000"/>
+</g></g>
+</g>
+<g id="ytick3">
+<g id="line2d9">
+<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m3400efa6b1638b3fea9e19e898273957" x="0.000000" y="43.200000"/>
+</g></g>
+</g>
+<g id="ytick4">
+<g id="line2d10">
+<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m3400efa6b1638b3fea9e19e898273957" x="0.000000" y="28.800000"/>
+</g></g>
+</g>
+<g id="ytick5">
+<g id="line2d11">
+<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m3400efa6b1638b3fea9e19e898273957" x="0.000000" y="14.400000"/>
+</g></g>
+</g>
+<g id="ytick6">
+<g id="line2d12">
+<g ><use style="fill: none; stroke: #000000; stroke-width: 0.500000; stroke-linejoin: round; stroke-linecap: butt; opacity: 1.000000" xlink:href="#m3400efa6b1638b3fea9e19e898273957" x="0.000000" y="0.000000"/>
+</g></g>
+</g>
+</g>
+<g id="patch3">
+<path style="fill: none; stroke: #000000; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" d="M0.000000 0.000000L144.000000 0.000000"/>
+</g>
+<g id="patch4">
+<path style="fill: none; stroke: #000000; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" d="M144.000000 72.000000L144.000000 0.000000"/>
+</g>
+<g id="patch5">
+<path style="fill: none; stroke: #000000; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" d="M0.000000 72.000000L144.000000 72.000000"/>
+</g>
+<g id="patch6">
+<path style="fill: none; stroke: #000000; stroke-width: 1.000000; stroke-linejoin: round; stroke-linecap: square; opacity: 1.000000" d="M0.000000 72.000000L0.000000 0.000000"/>
+</g>
+</g>
+</g>
+</svg>
Modified: trunk/matplotlib/lib/matplotlib/tests/test_simplification.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/tests/test_simplification.py	2010年06月24日 13:06:03 UTC (rev 8460)
+++ trunk/matplotlib/lib/matplotlib/tests/test_simplification.py	2010年06月24日 14:48:00 UTC (rev 8461)
@@ -186,7 +186,24 @@
 else:
 rcParams['path.simplify'] = True
 
+@image_comparison(baseline_images=['clipper_edge'])
+def test_clipper():
+ dat = (0, 1, 0, 2, 0, 3, 0, 4, 0, 5)
+ fig = plt.figure(figsize=(2, 1))
+ fig.subplots_adjust(left = 0, bottom = 0, wspace = 0, hspace = 0)
 
+ ax = fig.add_axes((0, 0, 1.0, 1.0), ylim = (0, 5), autoscale_on = False)
+ ax.plot(dat)
+ ax.xaxis.set_major_locator(plt.MultipleLocator(1))
+ ax.xaxis.set_major_formatter(plt.NullFormatter())
+ ax.yaxis.set_major_locator(plt.MultipleLocator(1))
+ ax.yaxis.set_major_formatter(plt.NullFormatter())
+ ax.xaxis.set_ticks_position('bottom')
+ ax.yaxis.set_ticks_position('left')
+
+ ax.set_xlim(5, 9)
+ fig.savefig('clipper_edge')
+
 if __name__=='__main__':
 import nose
 nose.runmodule(argv=['-s','--with-doctest'], exit=False)
Modified: trunk/matplotlib/src/path_converters.h
===================================================================
--- trunk/matplotlib/src/path_converters.h	2010年06月24日 13:06:03 UTC (rev 8460)
+++ trunk/matplotlib/src/path_converters.h	2010年06月24日 14:48:00 UTC (rev 8461)
@@ -288,7 +288,7 @@
 PathClipper(VertexSource& source, bool do_clipping,
 double width, double height) :
 m_source(&source), m_do_clipping(do_clipping),
- m_cliprect(0.0, 0.0, width, height), m_moveto(true),
+ m_cliprect(-1.0, -1.0, width + 1.0, height + 1.0), m_moveto(true),
 m_has_next(false)
 {
 // empty
@@ -296,10 +296,13 @@
 
 PathClipper(VertexSource& source, bool do_clipping,
 const agg::rect_base<double>& rect) :
- m_source(&source), m_do_clipping(do_clipping),
- m_cliprect(rect), m_moveto(true), m_has_next(false)
+ m_source(&source), m_do_clipping(do_clipping),
+ m_cliprect(rect), m_moveto(true), m_has_next(false)
 {
- // empty
+ m_cliprect.x1 -= 1.0;
+ m_cliprect.y1 -= 1.0;
+ m_cliprect.x2 += 1.0;
+ m_cliprect.y2 += 1.0;
 }
 
 inline void
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2010年06月24日 13:06:10
Revision: 8460
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8460&view=rev
Author: mdboom
Date: 2010年06月24日 13:06:03 +0000 (2010年6月24日)
Log Message:
-----------
Standardizing formatting of C/C++ code.
Modified Paths:
--------------
 trunk/matplotlib/src/_backend_agg.cpp
 trunk/matplotlib/src/_backend_agg.h
 trunk/matplotlib/src/_gtkagg.cpp
 trunk/matplotlib/src/_image.cpp
 trunk/matplotlib/src/_image.h
 trunk/matplotlib/src/_path.cpp
 trunk/matplotlib/src/_png.cpp
 trunk/matplotlib/src/_tkagg.cpp
 trunk/matplotlib/src/_ttconv.cpp
 trunk/matplotlib/src/_windowing.cpp
 trunk/matplotlib/src/_wxagg.cpp
 trunk/matplotlib/src/agg_py_path_iterator.h
 trunk/matplotlib/src/ft2font.cpp
 trunk/matplotlib/src/ft2font.h
 trunk/matplotlib/src/mplutils.cpp
 trunk/matplotlib/src/mplutils.h
 trunk/matplotlib/src/path_cleanup.cpp
 trunk/matplotlib/src/path_converters.h
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp	2010年06月23日 14:44:32 UTC (rev 8459)
+++ trunk/matplotlib/src/_backend_agg.cpp	2010年06月24日 13:06:03 UTC (rev 8460)
@@ -54,57 +54,82 @@
 /*
 Convert dashes from the Python representation as nested sequences to
 the C++ representation as a std::vector<std::pair<double, double> >
- (GCAgg::dash_t)
-*/
-void convert_dashes(const Py::Tuple& dashes, double dpi, GCAgg::dash_t& dashes_out,
- double& dashOffset_out) {
- if (dashes.length()!=2)
- throw Py::ValueError(Printf("Dash descriptor must be a length 2 tuple; found %d", dashes.length()).str());
+ (GCAgg::dash_t) */
+void
+convert_dashes(const Py::Tuple& dashes, double dpi,
+ GCAgg::dash_t& dashes_out, double& dashOffset_out)
+{
+ if (dashes.length() != 2)
+ {
+ throw Py::ValueError(
+ Printf("Dash descriptor must be a length 2 tuple; found %d",
+ dashes.length()).str()
+ );
+ }
 
- dashes_out.clear();
- dashOffset_out = 0.0;
- if (dashes[0].ptr() == Py_None)
- return;
+ dashes_out.clear();
+ dashOffset_out = 0.0;
+ if (dashes[0].ptr() == Py_None)
+ {
+ return;
+ }
 
- dashOffset_out = double(Py::Float(dashes[0])) * dpi/72.0;
+ dashOffset_out = double(Py::Float(dashes[0])) * dpi / 72.0;
 
- Py::SeqBase<Py::Object> dashSeq = dashes[1];
+ Py::SeqBase<Py::Object> dashSeq = dashes[1];
 
- size_t Ndash = dashSeq.length();
- if (Ndash % 2 != 0)
- throw Py::ValueError(Printf("Dash sequence must be an even length sequence; found %d", Ndash).str());
+ size_t Ndash = dashSeq.length();
+ if (Ndash % 2 != 0)
+ {
+ throw Py::ValueError(
+ Printf("Dash sequence must be an even length sequence; found %d", Ndash).str()
+ );
+ }
 
- dashes_out.clear();
- dashes_out.reserve(Ndash / 2);
+ dashes_out.clear();
+ dashes_out.reserve(Ndash / 2);
 
- double val0, val1;
- for (size_t i = 0; i < Ndash; i += 2) {
- val0 = double(Py::Float(dashSeq[i])) * dpi/72.0;
- val1 = double(Py::Float(dashSeq[i+1])) * dpi/72.0;
- dashes_out.push_back(std::make_pair(val0, val1));
- }
+ double val0, val1;
+ for (size_t i = 0; i < Ndash; i += 2)
+ {
+ val0 = double(Py::Float(dashSeq[i])) * dpi / 72.0;
+ val1 = double(Py::Float(dashSeq[i+1])) * dpi / 72.0;
+ dashes_out.push_back(std::make_pair(val0, val1));
+ }
 }
 
-Py::Object BufferRegion::to_string(const Py::Tuple &args) {
- // owned=true to prevent memory leak
- return Py::String(PyString_FromStringAndSize((const char*)data, height*stride), true);
+
+Py::Object
+BufferRegion::to_string(const Py::Tuple &args)
+{
+ // owned=true to prevent memory leak
+ return Py::String(PyString_FromStringAndSize((const char*)data, height*stride), true);
 }
 
-Py::Object BufferRegion::set_x(const Py::Tuple &args) {
+
+Py::Object
+BufferRegion::set_x(const Py::Tuple &args)
+{
 args.verify_length(1);
- size_t x = Py::Int( args[0] );
+ size_t x = Py::Int(args[0]);
 rect.x1 = x;
 return Py::Object();
 }
 
-Py::Object BufferRegion::set_y(const Py::Tuple &args) {
+
+Py::Object
+BufferRegion::set_y(const Py::Tuple &args)
+{
 args.verify_length(1);
- size_t y = Py::Int( args[0] );
+ size_t y = Py::Int(args[0]);
 rect.y1 = y;
 return Py::Object();
 }
 
-Py::Object BufferRegion::get_extents(const Py::Tuple &args) {
+
+Py::Object
+BufferRegion::get_extents(const Py::Tuple &args)
+{
 args.verify_length(0);
 
 Py::Tuple extents(4);
@@ -116,562 +141,673 @@
 return extents;
 }
 
-Py::Object BufferRegion::to_string_argb(const Py::Tuple &args) {
- // owned=true to prevent memory leak
- Py_ssize_t length;
- unsigned char* pix;
- unsigned char* begin;
- unsigned char* end;
- unsigned char tmp;
- size_t i, j;
 
- PyObject* str = PyString_FromStringAndSize((const char*)data, height*stride);
- if (PyString_AsStringAndSize(str, (char**)&begin, &length)) {
- throw Py::TypeError("Could not create memory for blit");
- }
+Py::Object
+BufferRegion::to_string_argb(const Py::Tuple &args)
+{
+ // owned=true to prevent memory leak
+ Py_ssize_t length;
+ unsigned char* pix;
+ unsigned char* begin;
+ unsigned char* end;
+ unsigned char tmp;
+ size_t i, j;
 
- pix = begin;
- end = begin + (height * stride);
- for (i = 0; i < (size_t)height; ++i) {
- pix = begin + i * stride;
- for (j = 0; j < (size_t)width; ++j) {
- // Convert rgba to argb
- tmp = pix[2];
- pix[2] = pix[0];
- pix[0] = tmp;
- pix += 4;
+ PyObject* str = PyString_FromStringAndSize(
+ (const char*)data, height * stride);
+ if (PyString_AsStringAndSize(str, (char**)&begin, &length))
+ {
+ throw Py::TypeError("Could not create memory for blit");
 }
- }
 
- return Py::String(str, true);
+ pix = begin;
+ end = begin + (height * stride);
+ for (i = 0; i < (size_t)height; ++i)
+ {
+ pix = begin + i * stride;
+ for (j = 0; j < (size_t)width; ++j)
+ {
+ // Convert rgba to argb
+ tmp = pix[2];
+ pix[2] = pix[0];
+ pix[0] = tmp;
+ pix += 4;
+ }
+ }
+
+ return Py::String(str, true);
 }
 
+
 GCAgg::GCAgg(const Py::Object &gc, double dpi) :
- dpi(dpi), isaa(true), dashOffset(0.0)
+ dpi(dpi), isaa(true), dashOffset(0.0)
 {
- _VERBOSE("GCAgg::GCAgg");
- linewidth = points_to_pixels ( gc.getAttr("_linewidth") ) ;
- alpha = Py::Float( gc.getAttr("_alpha") );
- color = get_color(gc);
- _set_antialiased(gc);
- _set_linecap(gc);
- _set_joinstyle(gc);
- _set_dashes(gc);
- _set_clip_rectangle(gc);
- _set_clip_path(gc);
- _set_snap(gc);
- _set_hatch_path(gc);
+ _VERBOSE("GCAgg::GCAgg");
+ linewidth = points_to_pixels(gc.getAttr("_linewidth")) ;
+ alpha = Py::Float(gc.getAttr("_alpha"));
+ color = get_color(gc);
+ _set_antialiased(gc);
+ _set_linecap(gc);
+ _set_joinstyle(gc);
+ _set_dashes(gc);
+ _set_clip_rectangle(gc);
+ _set_clip_path(gc);
+ _set_snap(gc);
+ _set_hatch_path(gc);
 }
 
+
 void
-GCAgg::_set_antialiased(const Py::Object& gc) {
- _VERBOSE("GCAgg::antialiased");
- isaa = Py::Int( gc.getAttr( "_antialiased") );
+GCAgg::_set_antialiased(const Py::Object& gc)
+{
+ _VERBOSE("GCAgg::antialiased");
+ isaa = Py::Int(gc.getAttr("_antialiased"));
 }
 
+
 agg::rgba
-GCAgg::get_color(const Py::Object& gc) {
- _VERBOSE("GCAgg::get_color");
- Py::Tuple rgb = Py::Tuple( gc.getAttr("_rgb") );
+GCAgg::get_color(const Py::Object& gc)
+{
+ _VERBOSE("GCAgg::get_color");
+ Py::Tuple rgb = Py::Tuple(gc.getAttr("_rgb"));
 
- double alpha = Py::Float( gc.getAttr("_alpha") );
+ double alpha = Py::Float(gc.getAttr("_alpha"));
 
- double r = Py::Float(rgb[0]);
- double g = Py::Float(rgb[1]);
- double b = Py::Float(rgb[2]);
- return agg::rgba(r, g, b, alpha);
+ double r = Py::Float(rgb[0]);
+ double g = Py::Float(rgb[1]);
+ double b = Py::Float(rgb[2]);
+ return agg::rgba(r, g, b, alpha);
 }
 
+
 double
-GCAgg::points_to_pixels( const Py::Object& points) {
- _VERBOSE("GCAgg::points_to_pixels");
- double p = Py::Float( points ) ;
- return p * dpi/72.0;
+GCAgg::points_to_pixels(const Py::Object& points)
+{
+ _VERBOSE("GCAgg::points_to_pixels");
+ double p = Py::Float(points) ;
+ return p * dpi / 72.0;
 }
 
+
 void
-GCAgg::_set_linecap(const Py::Object& gc) {
- _VERBOSE("GCAgg::_set_linecap");
+GCAgg::_set_linecap(const Py::Object& gc)
+{
+ _VERBOSE("GCAgg::_set_linecap");
 
- std::string capstyle = Py::String( gc.getAttr( "_capstyle" ) );
+ std::string capstyle = Py::String(gc.getAttr("_capstyle"));
 
- if (capstyle=="butt")
- cap = agg::butt_cap;
- else if (capstyle=="round")
- cap = agg::round_cap;
- else if(capstyle=="projecting")
- cap = agg::square_cap;
- else
- throw Py::ValueError(Printf("GC _capstyle attribute must be one of butt, round, projecting; found %s", capstyle.c_str()).str());
+ if (capstyle == "butt")
+ {
+ cap = agg::butt_cap;
+ }
+ else if (capstyle == "round")
+ {
+ cap = agg::round_cap;
+ }
+ else if (capstyle == "projecting")
+ {
+ cap = agg::square_cap;
+ }
+ else
+ {
+ throw Py::ValueError(Printf("GC _capstyle attribute must be one of butt, round, projecting; found %s", capstyle.c_str()).str());
+ }
 }
 
+
 void
-GCAgg::_set_joinstyle(const Py::Object& gc) {
- _VERBOSE("GCAgg::_set_joinstyle");
+GCAgg::_set_joinstyle(const Py::Object& gc)
+{
+ _VERBOSE("GCAgg::_set_joinstyle");
 
- std::string joinstyle = Py::String( gc.getAttr("_joinstyle") );
+ std::string joinstyle = Py::String(gc.getAttr("_joinstyle"));
 
- if (joinstyle == "miter")
- join = agg::miter_join_revert;
- else if (joinstyle == "round")
- join = agg::round_join;
- else if (joinstyle == "bevel")
- join = agg::bevel_join;
- else
- throw Py::ValueError(Printf("GC _joinstyle attribute must be one of butt, round, projecting; found %s", joinstyle.c_str()).str());
+ if (joinstyle == "miter")
+ {
+ join = agg::miter_join_revert;
+ }
+ else if (joinstyle == "round")
+ {
+ join = agg::round_join;
+ }
+ else if (joinstyle == "bevel")
+ {
+ join = agg::bevel_join;
+ }
+ else
+ {
+ throw Py::ValueError(Printf("GC _joinstyle attribute must be one of butt, round, projecting; found %s", joinstyle.c_str()).str());
+ }
 }
 
+
 void
-GCAgg::_set_dashes(const Py::Object& gc) {
- //return the dashOffset, dashes sequence tuple.
- _VERBOSE("GCAgg::_set_dashes");
+GCAgg::_set_dashes(const Py::Object& gc)
+{
+ //return the dashOffset, dashes sequence tuple.
+ _VERBOSE("GCAgg::_set_dashes");
 
- Py::Object dash_obj( gc.getAttr( "_dashes" ) );
- if (dash_obj.ptr() == Py_None) {
- dashes.clear();
- return;
- }
+ Py::Object dash_obj(gc.getAttr("_dashes"));
+ if (dash_obj.ptr() == Py_None)
+ {
+ dashes.clear();
+ return;
+ }
 
- convert_dashes(dash_obj, dpi, dashes, dashOffset);
+ convert_dashes(dash_obj, dpi, dashes, dashOffset);
 }
 
+
 void
-GCAgg::_set_clip_rectangle( const Py::Object& gc) {
- //set the clip rectangle from the gc
+GCAgg::_set_clip_rectangle(const Py::Object& gc)
+{
+ //set the clip rectangle from the gc
 
- _VERBOSE("GCAgg::_set_clip_rectangle");
+ _VERBOSE("GCAgg::_set_clip_rectangle");
 
- Py::Object o ( gc.getAttr( "_cliprect" ) );
- cliprect = o;
+ Py::Object o(gc.getAttr("_cliprect"));
+ cliprect = o;
 }
 
+
 void
-GCAgg::_set_clip_path( const Py::Object& gc) {
- //set the clip path from the gc
+GCAgg::_set_clip_path(const Py::Object& gc)
+{
+ //set the clip path from the gc
 
- _VERBOSE("GCAgg::_set_clip_path");
+ _VERBOSE("GCAgg::_set_clip_path");
 
- Py::Object method_obj = gc.getAttr("get_clip_path");
- Py::Callable method(method_obj);
- Py::Tuple path_and_transform = method.apply(Py::Tuple());
- if (path_and_transform[0].ptr() != Py_None) {
- clippath = path_and_transform[0];
- clippath_trans = py_to_agg_transformation_matrix(path_and_transform[1].ptr());
- }
+ Py::Object method_obj = gc.getAttr("get_clip_path");
+ Py::Callable method(method_obj);
+ Py::Tuple path_and_transform = method.apply(Py::Tuple());
+ if (path_and_transform[0].ptr() != Py_None)
+ {
+ clippath = path_and_transform[0];
+ clippath_trans = py_to_agg_transformation_matrix(path_and_transform[1].ptr());
+ }
 }
 
+
 void
-GCAgg::_set_snap( const Py::Object& gc) {
- //set the snap setting
+GCAgg::_set_snap(const Py::Object& gc)
+{
+ //set the snap setting
 
- _VERBOSE("GCAgg::_set_snap");
+ _VERBOSE("GCAgg::_set_snap");
 
- Py::Object method_obj = gc.getAttr("get_snap");
- Py::Callable method(method_obj);
- Py::Object py_snap = method.apply(Py::Tuple());
- if (py_snap.isNone()) {
- snap_mode = SNAP_AUTO;
- } else if (py_snap.isTrue()) {
- snap_mode = SNAP_TRUE;
- } else {
- snap_mode = SNAP_FALSE;
- }
+ Py::Object method_obj = gc.getAttr("get_snap");
+ Py::Callable method(method_obj);
+ Py::Object py_snap = method.apply(Py::Tuple());
+ if (py_snap.isNone())
+ {
+ snap_mode = SNAP_AUTO;
+ }
+ else if (py_snap.isTrue())
+ {
+ snap_mode = SNAP_TRUE;
+ }
+ else
+ {
+ snap_mode = SNAP_FALSE;
+ }
 }
 
+
 void
-GCAgg::_set_hatch_path( const Py::Object& gc) {
- _VERBOSE("GCAgg::_set_hatch_path");
+GCAgg::_set_hatch_path(const Py::Object& gc)
+{
+ _VERBOSE("GCAgg::_set_hatch_path");
 
- Py::Object method_obj = gc.getAttr("get_hatch_path");
- Py::Callable method(method_obj);
- hatchpath = method.apply(Py::Tuple());
+ Py::Object method_obj = gc.getAttr("get_hatch_path");
+ Py::Callable method(method_obj);
+ hatchpath = method.apply(Py::Tuple());
 }
 
+
 const size_t
 RendererAgg::PIXELS_PER_INCH(96);
 
+
 RendererAgg::RendererAgg(unsigned int width, unsigned int height, double dpi,
 int debug) :
- width(width),
- height(height),
- dpi(dpi),
- NUMBYTES(width*height*4),
- pixBuffer(NULL),
- renderingBuffer(),
- alphaBuffer(NULL),
- alphaMaskRenderingBuffer(),
- alphaMask(alphaMaskRenderingBuffer),
- pixfmtAlphaMask(alphaMaskRenderingBuffer),
- rendererBaseAlphaMask(),
- rendererAlphaMask(),
- scanlineAlphaMask(),
- slineP8(),
- slineBin(),
- pixFmt(),
- rendererBase(),
- rendererAA(),
- rendererBin(),
- theRasterizer(),
- debug(debug)
+ width(width),
+ height(height),
+ dpi(dpi),
+ NUMBYTES(width*height*4),
+ pixBuffer(NULL),
+ renderingBuffer(),
+ alphaBuffer(NULL),
+ alphaMaskRenderingBuffer(),
+ alphaMask(alphaMaskRenderingBuffer),
+ pixfmtAlphaMask(alphaMaskRenderingBuffer),
+ rendererBaseAlphaMask(),
+ rendererAlphaMask(),
+ scanlineAlphaMask(),
+ slineP8(),
+ slineBin(),
+ pixFmt(),
+ rendererBase(),
+ rendererAA(),
+ rendererBin(),
+ theRasterizer(),
+ debug(debug)
 {
- _VERBOSE("RendererAgg::RendererAgg");
- unsigned stride(width*4);
+ _VERBOSE("RendererAgg::RendererAgg");
+ unsigned stride(width*4);
 
- pixBuffer = new agg::int8u[NUMBYTES];
- renderingBuffer.attach(pixBuffer, width, height, stride);
- pixFmt.attach(renderingBuffer);
- rendererBase.attach(pixFmt);
- rendererBase.clear(agg::rgba(1, 1, 1, 0));
- rendererAA.attach(rendererBase);
- rendererBin.attach(rendererBase);
- hatchRenderingBuffer.attach(hatchBuffer, HATCH_SIZE, HATCH_SIZE, HATCH_SIZE*4);
+ pixBuffer = new agg::int8u[NUMBYTES];
+ renderingBuffer.attach(pixBuffer, width, height, stride);
+ pixFmt.attach(renderingBuffer);
+ rendererBase.attach(pixFmt);
+ rendererBase.clear(agg::rgba(1, 1, 1, 0));
+ rendererAA.attach(rendererBase);
+ rendererBin.attach(rendererBase);
+ hatchRenderingBuffer.attach(hatchBuffer, HATCH_SIZE, HATCH_SIZE,
+ HATCH_SIZE*4);
 }
 
-void RendererAgg::create_alpha_buffers() {
- if (!alphaBuffer) {
- unsigned stride(width*4);
- alphaBuffer = new agg::int8u[NUMBYTES];
- alphaMaskRenderingBuffer.attach(alphaBuffer, width, height, stride);
- rendererBaseAlphaMask.attach(pixfmtAlphaMask);
- rendererAlphaMask.attach(rendererBaseAlphaMask);
- }
+
+void
+RendererAgg::create_alpha_buffers()
+{
+ if (!alphaBuffer)
+ {
+ unsigned stride(width*4);
+ alphaBuffer = new agg::int8u[NUMBYTES];
+ alphaMaskRenderingBuffer.attach(alphaBuffer, width, height, stride);
+ rendererBaseAlphaMask.attach(pixfmtAlphaMask);
+ rendererAlphaMask.attach(rendererBaseAlphaMask);
+ }
 }
 
+
 template<class R>
 void
-RendererAgg::set_clipbox(const Py::Object& cliprect, R& rasterizer) {
- //set the clip rectangle from the gc
+RendererAgg::set_clipbox(const Py::Object& cliprect, R& rasterizer)
+{
+ //set the clip rectangle from the gc
 
- _VERBOSE("RendererAgg::set_clipbox");
+ _VERBOSE("RendererAgg::set_clipbox");
 
- double l, b, r, t;
- if (py_convert_bbox(cliprect.ptr(), l, b, r, t)) {
- rasterizer.clip_box(int(mpl_round(l)), height - int(mpl_round(b)),
- int(mpl_round(r)), height - int(mpl_round(t)));
- }
+ double l, b, r, t;
+ if (py_convert_bbox(cliprect.ptr(), l, b, r, t))
+ {
+ rasterizer.clip_box(int(mpl_round(l)), height - int(mpl_round(b)),
+ int(mpl_round(r)), height - int(mpl_round(t)));
+ }
 
- _VERBOSE("RendererAgg::set_clipbox done");
+ _VERBOSE("RendererAgg::set_clipbox done");
 }
 
+
 std::pair<bool, agg::rgba>
-RendererAgg::_get_rgba_face(const Py::Object& rgbFace, double alpha) {
- _VERBOSE("RendererAgg::_get_rgba_face");
- std::pair<bool, agg::rgba> face;
+RendererAgg::_get_rgba_face(const Py::Object& rgbFace, double alpha)
+{
+ _VERBOSE("RendererAgg::_get_rgba_face");
+ std::pair<bool, agg::rgba> face;
 
- if (rgbFace.ptr() == Py_None) {
- face.first = false;
- }
- else {
- face.first = true;
- Py::Tuple rgb = Py::Tuple(rgbFace);
- face.second = rgb_to_color(rgb, alpha);
- }
- return face;
+ if (rgbFace.ptr() == Py_None)
+ {
+ face.first = false;
+ }
+ else
+ {
+ face.first = true;
+ Py::Tuple rgb = Py::Tuple(rgbFace);
+ face.second = rgb_to_color(rgb, alpha);
+ }
+ return face;
 }
 
+
 Py::Object
-RendererAgg::copy_from_bbox(const Py::Tuple& args) {
- //copy region in bbox to buffer and return swig/agg buffer object
- args.verify_length(1);
+RendererAgg::copy_from_bbox(const Py::Tuple& args)
+{
+ //copy region in bbox to buffer and return swig/agg buffer object
+ args.verify_length(1);
 
- Py::Object box_obj = args[0];
- double l, b, r, t;
- if (!py_convert_bbox(box_obj.ptr(), l, b, r, t))
- throw Py::TypeError("Invalid bbox provided to copy_from_bbox");
+ Py::Object box_obj = args[0];
+ double l, b, r, t;
+ if (!py_convert_bbox(box_obj.ptr(), l, b, r, t))
+ {
+ throw Py::TypeError("Invalid bbox provided to copy_from_bbox");
+ }
 
- // std::cout << l << " " << b << " " << r << " " << t << " " << (height - (int)b) << " " << height - (int)t << std::endl;
- agg::rect_i rect((int)l, height - (int)t, (int)r, height - (int)b);
+ agg::rect_i rect((int)l, height - (int)t, (int)r, height - (int)b);
 
- BufferRegion* reg = NULL;
- try {
- reg = new BufferRegion(rect, true);
- } catch (...) {
- throw Py::MemoryError("RendererAgg::copy_from_bbox could not allocate memory for buffer");
- }
+ BufferRegion* reg = NULL;
+ try
+ {
+ reg = new BufferRegion(rect, true);
+ }
+ catch (...)
+ {
+ throw Py::MemoryError(
+ "RendererAgg::copy_from_bbox could not allocate memory for buffer");
+ }
 
- if (!reg) {
- throw Py::MemoryError("RendererAgg::copy_from_bbox could not allocate memory for buffer");
- }
+ if (!reg)
+ {
+ throw Py::MemoryError(
+ "RendererAgg::copy_from_bbox could not allocate memory for buffer");
+ }
 
- try {
- agg::rendering_buffer rbuf;
- rbuf.attach(reg->data, reg->width, reg->height, reg->stride);
+ try
+ {
+ agg::rendering_buffer rbuf;
+ rbuf.attach(reg->data, reg->width, reg->height, reg->stride);
 
- pixfmt pf(rbuf);
- renderer_base rb(pf);
- rb.copy_from(renderingBuffer, &rect, -rect.x1, -rect.y1);
- } catch (...) {
- delete reg;
- throw Py::RuntimeError("An unknown error occurred in copy_from_bbox");
- }
- return Py::asObject(reg);
+ pixfmt pf(rbuf);
+ renderer_base rb(pf);
+ rb.copy_from(renderingBuffer, &rect, -rect.x1, -rect.y1);
+ }
+ catch (...)
+ {
+ delete reg;
+ throw Py::RuntimeError("An unknown error occurred in copy_from_bbox");
+ }
+ return Py::asObject(reg);
 }
 
+
 Py::Object
-RendererAgg::restore_region(const Py::Tuple& args) {
- //copy BufferRegion to buffer
- args.verify_length(1);
- BufferRegion* region = static_cast<BufferRegion*>(args[0].ptr());
+RendererAgg::restore_region(const Py::Tuple& args)
+{
+ //copy BufferRegion to buffer
+ args.verify_length(1);
+ BufferRegion* region = static_cast<BufferRegion*>(args[0].ptr());
 
- if (region->data==NULL)
- throw Py::ValueError("Cannot restore_region from NULL data");
- //return Py::Object();
+ if (region->data == NULL)
+ {
+ throw Py::ValueError("Cannot restore_region from NULL data");
+ }
 
- //std::cout << "restoring " << region->width << " " << region->height << " " << region->stride << " " << region->rect.x1 << " " << region->rect.y1 << std::endl;
+ agg::rendering_buffer rbuf;
+ rbuf.attach(region->data,
+ region->width,
+ region->height,
+ region->stride);
 
- agg::rendering_buffer rbuf;
- rbuf.attach(region->data,
- region->width,
- region->height,
- region->stride);
+ rendererBase.copy_from(rbuf, 0, region->rect.x1, region->rect.y1);
 
- rendererBase.copy_from(rbuf, 0, region->rect.x1, region->rect.y1);
-
- return Py::Object();
+ return Py::Object();
 }
 
+
 // Restore the part of the saved region with offsets
 Py::Object
-RendererAgg::restore_region2(const Py::Tuple& args) {
- //copy BufferRegion to buffer
- args.verify_length(7);
+RendererAgg::restore_region2(const Py::Tuple& args)
+{
+ //copy BufferRegion to buffer
+ args.verify_length(7);
 
+ int x(0), y(0), xx1(0), yy1(0), xx2(0), yy2(0);
+ try
+ {
+ xx1 = Py::Int(args[1]);
+ yy1 = Py::Int(args[2]);
+ xx2 = Py::Int(args[3]);
+ yy2 = Py::Int(args[4]);
+ x = Py::Int(args[5]);
+ y = Py::Int(args[6]);
+ }
+ catch (Py::TypeError)
+ {
+ throw Py::TypeError("Invalid input arguments to draw_text_image");
+ }
 
 
- int x(0),y(0), xx1(0),yy1(0), xx2(0), yy2(0);
- try {
- xx1 = Py::Int( args[1] );
- yy1 = Py::Int( args[2] );
- xx2 = Py::Int( args[3] );
- yy2 = Py::Int( args[4] );
- x = Py::Int( args[5] );
- y = Py::Int( args[6] );
- }
- catch (Py::TypeError) {
- throw Py::TypeError("Invalid input arguments to draw_text_image");
- }
+ BufferRegion* region = static_cast<BufferRegion*>(args[0].ptr());
 
+ if (region->data == NULL)
+ {
+ throw Py::ValueError("Cannot restore_region from NULL data");
+ }
 
- BufferRegion* region = static_cast<BufferRegion*>(args[0].ptr());
+ agg::rect_i rect(xx1 - region->rect.x1, (yy1 - region->rect.y1),
+ xx2 - region->rect.x1, (yy2 - region->rect.y1));
 
- if (region->data==NULL)
- throw Py::ValueError("Cannot restore_region from NULL data");
+ agg::rendering_buffer rbuf;
+ rbuf.attach(region->data,
+ region->width,
+ region->height,
+ region->stride);
 
- agg::rect_i rect(xx1-region->rect.x1, (yy1-region->rect.y1),
- xx2-region->rect.x1, (yy2-region->rect.y1));
+ rendererBase.copy_from(rbuf, &rect, x, y);
 
-
- agg::rendering_buffer rbuf;
- rbuf.attach(region->data,
- region->width,
- region->height,
- region->stride);
-
- rendererBase.copy_from(rbuf, &rect, x, y);
-
- return Py::Object();
+ return Py::Object();
 }
 
 
-bool RendererAgg::render_clippath(const Py::Object& clippath, const agg::trans_affine& clippath_trans) {
- typedef agg::conv_transform<PathIterator> transformed_path_t;
- typedef agg::conv_curve<transformed_path_t> curve_t;
+bool
+RendererAgg::render_clippath(const Py::Object& clippath,
+ const agg::trans_affine& clippath_trans)
+{
+ typedef agg::conv_transform<PathIterator> transformed_path_t;
+ typedef agg::conv_curve<transformed_path_t> curve_t;
 
- bool has_clippath = (clippath.ptr() != Py_None);
+ bool has_clippath = (clippath.ptr() != Py_None);
 
- if (has_clippath &&
- (clippath.ptr() != lastclippath.ptr() ||
- clippath_trans != lastclippath_transform)) {
- create_alpha_buffers();
- agg::trans_affine trans(clippath_trans);
- trans *= agg::trans_affine_scaling(1.0, -1.0);
- trans *= agg::trans_affine_translation(0.0, (double)height);
+ if (has_clippath &&
+ (clippath.ptr() != lastclippath.ptr() ||
+ clippath_trans != lastclippath_transform))
+ {
+ create_alpha_buffers();
+ agg::trans_affine trans(clippath_trans);
+ trans *= agg::trans_affine_scaling(1.0, -1.0);
+ trans *= agg::trans_affine_translation(0.0, (double)height);
 
- PathIterator clippath_iter(clippath);
- rendererBaseAlphaMask.clear(agg::gray8(0, 0));
- transformed_path_t transformed_clippath(clippath_iter, trans);
- agg::conv_curve<transformed_path_t> curved_clippath(transformed_clippath);
- theRasterizer.add_path(curved_clippath);
- rendererAlphaMask.color(agg::gray8(255, 255));
- agg::render_scanlines(theRasterizer, scanlineAlphaMask, rendererAlphaMask);
- lastclippath = clippath;
- lastclippath_transform = clippath_trans;
- }
+ PathIterator clippath_iter(clippath);
+ rendererBaseAlphaMask.clear(agg::gray8(0, 0));
+ transformed_path_t transformed_clippath(clippath_iter, trans);
+ agg::conv_curve<transformed_path_t> curved_clippath(transformed_clippath);
+ theRasterizer.add_path(curved_clippath);
+ rendererAlphaMask.color(agg::gray8(255, 255));
+ agg::render_scanlines(theRasterizer, scanlineAlphaMask, rendererAlphaMask);
+ lastclippath = clippath;
+ lastclippath_transform = clippath_trans;
+ }
 
- return has_clippath;
+ return has_clippath;
 }
 
 #define MARKER_CACHE_SIZE 512
 
+
 Py::Object
-RendererAgg::draw_markers(const Py::Tuple& args) {
- typedef agg::conv_transform<PathIterator> transformed_path_t;
- typedef PathSnapper<transformed_path_t> snap_t;
- typedef agg::conv_curve<snap_t> curve_t;
- typedef agg::conv_stroke<curve_t> stroke_t;
- typedef agg::pixfmt_amask_adaptor<pixfmt, alpha_mask_type> pixfmt_amask_type;
- typedef agg::renderer_base<pixfmt_amask_type> amask_ren_type;
- typedef agg::renderer_scanline_aa_solid<amask_ren_type> amask_aa_renderer_type;
- typedef agg::renderer_scanline_bin_solid<amask_ren_type> amask_bin_renderer_type;
- args.verify_length(5, 6);
+RendererAgg::draw_markers(const Py::Tuple& args)
+{
+ typedef agg::conv_transform<PathIterator> transformed_path_t;
+ typedef PathSnapper<transformed_path_t> snap_t;
+ typedef agg::conv_curve<snap_t> curve_t;
+ typedef agg::conv_stroke<curve_t> stroke_t;
+ typedef agg::pixfmt_amask_adaptor<pixfmt, alpha_mask_type> pixfmt_amask_type;
+ typedef agg::renderer_base<pixfmt_amask_type> amask_ren_type;
+ typedef agg::renderer_scanline_aa_solid<amask_ren_type> amask_aa_renderer_type;
+ typedef agg::renderer_scanline_bin_solid<amask_ren_type> amask_bin_renderer_type;
+ args.verify_length(5, 6);
 
- Py::Object gc_obj = args[0];
- Py::Object marker_path_obj = args[1];
- agg::trans_affine marker_trans = py_to_agg_transformation_matrix(args[2].ptr());
- Py::Object path_obj = args[3];
- agg::trans_affine trans = py_to_agg_transformation_matrix(args[4].ptr());
- Py::Object face_obj;
- if (args.size() == 6)
- face_obj = args[5];
+ Py::Object gc_obj = args[0];
+ Py::Object marker_path_obj = args[1];
+ agg::trans_affine marker_trans = py_to_agg_transformation_matrix(args[2].ptr());
+ Py::Object path_obj = args[3];
+ agg::trans_affine trans = py_to_agg_transformation_matrix(args[4].ptr());
+ Py::Object face_obj;
+ if (args.size() == 6)
+ {
+ face_obj = args[5];
+ }
 
- GCAgg gc(gc_obj, dpi);
+ GCAgg gc(gc_obj, dpi);
 
- // Deal with the difference in y-axis direction
- marker_trans *= agg::trans_affine_scaling(1.0, -1.0);
- trans *= agg::trans_affine_scaling(1.0, -1.0);
- trans *= agg::trans_affine_translation(0.0, (double)height);
+ // Deal with the difference in y-axis direction
+ marker_trans *= agg::trans_affine_scaling(1.0, -1.0);
+ trans *= agg::trans_affine_scaling(1.0, -1.0);
+ trans *= agg::trans_affine_translation(0.0, (double)height);
 
- PathIterator marker_path(marker_path_obj);
- transformed_path_t marker_path_transformed(marker_path, marker_trans);
- snap_t marker_path_snapped(marker_path_transformed,
- gc.snap_mode,
- marker_path.total_vertices(),
- gc.linewidth);
- curve_t marker_path_curve(marker_path_snapped);
+ PathIterator marker_path(marker_path_obj);
+ transformed_path_t marker_path_transformed(marker_path, marker_trans);
+ snap_t marker_path_snapped(marker_path_transformed,
+ gc.snap_mode,
+ marker_path.total_vertices(),
+ gc.linewidth);
+ curve_t marker_path_curve(marker_path_snapped);
 
- PathIterator path(path_obj);
- transformed_path_t path_transformed(path, trans);
- snap_t path_snapped(path_transformed,
- gc.snap_mode,
- path.total_vertices(),
- 1.0);
- curve_t path_curve(path_snapped);
- path_curve.rewind(0);
+ PathIterator path(path_obj);
+ transformed_path_t path_transformed(path, trans);
+ snap_t path_snapped(path_transformed,
+ gc.snap_mode,
+ path.total_vertices(),
+ 1.0);
+ curve_t path_curve(path_snapped);
+ path_curve.rewind(0);
 
- facepair_t face = _get_rgba_face(face_obj, gc.alpha);
+ facepair_t face = _get_rgba_face(face_obj, gc.alpha);
 
- //maxim's suggestions for cached scanlines
- agg::scanline_storage_aa8 scanlines;
- theRasterizer.reset();
- theRasterizer.reset_clipping();
- rendererBase.reset_clipping(true);
+ //maxim's suggestions for cached scanlines
+ agg::scanline_storage_aa8 scanlines;
+ theRasterizer.reset();
+ theRasterizer.reset_clipping();
+ rendererBase.reset_clipping(true);
 
- agg::int8u staticFillCache[MARKER_CACHE_SIZE];
- agg::int8u staticStrokeCache[MARKER_CACHE_SIZE];
- agg::int8u* fillCache = staticFillCache;
- agg::int8u* strokeCache = staticStrokeCache;
+ agg::int8u staticFillCache[MARKER_CACHE_SIZE];
+ agg::int8u staticStrokeCache[MARKER_CACHE_SIZE];
+ agg::int8u* fillCache = staticFillCache;
+ agg::int8u* strokeCache = staticStrokeCache;
 
- try {
- unsigned fillSize = 0;
- if (face.first) {
- theRasterizer.add_path(marker_path_curve);
- agg::render_scanlines(theRasterizer, slineP8, scanlines);
- fillSize = scanlines.byte_size();
- if (fillSize >= MARKER_CACHE_SIZE)
- fillCache = new agg::int8u[fillSize];
- scanlines.serialize(fillCache);
- }
+ try
+ {
+ unsigned fillSize = 0;
+ if (face.first)
+ {
+ theRasterizer.add_path(marker_path_curve);
+ agg::render_scanlines(theRasterizer, slineP8, scanlines);
+ fillSize = scanlines.byte_size();
+ if (fillSize >= MARKER_CACHE_SIZE)
+ {
+ fillCache = new agg::int8u[fillSize];
+ }
+ scanlines.serialize(fillCache);
+ }
 
- stroke_t stroke(marker_path_curve);
- stroke.width(gc.linewidth);
- stroke.line_cap(gc.cap);
- stroke.line_join(gc.join);
- theRasterizer.reset();
- theRasterizer.add_path(stroke);
- agg::render_scanlines(theRasterizer, slineP8, scanlines);
- unsigned strokeSize = scanlines.byte_size();
- if (strokeSize >= MARKER_CACHE_SIZE)
- strokeCache = new agg::int8u[strokeSize];
- scanlines.serialize(strokeCache);
+ stroke_t stroke(marker_path_curve);
+ stroke.width(gc.linewidth);
+ stroke.line_cap(gc.cap);
+ stroke.line_join(gc.join);
+ theRasterizer.reset();
+ theRasterizer.add_path(stroke);
+ agg::render_scanlines(theRasterizer, slineP8, scanlines);
+ unsigned strokeSize = scanlines.byte_size();
+ if (strokeSize >= MARKER_CACHE_SIZE)
+ {
+ strokeCache = new agg::int8u[strokeSize];
+ }
+ scanlines.serialize(strokeCache);
 
- theRasterizer.reset_clipping();
- rendererBase.reset_clipping(true);
- set_clipbox(gc.cliprect, rendererBase);
- bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
+ theRasterizer.reset_clipping();
+ rendererBase.reset_clipping(true);
+ set_clipbox(gc.cliprect, rendererBase);
+ bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
 
- double x, y;
+ double x, y;
 
- agg::serialized_scanlines_adaptor_aa8 sa;
- agg::serialized_scanlines_adaptor_aa8::embedded_scanline sl;
+ agg::serialized_scanlines_adaptor_aa8 sa;
+ agg::serialized_scanlines_adaptor_aa8::embedded_scanline sl;
 
- agg::rect_d clipping_rect(
- -(scanlines.min_x() + 1.0),
- -(scanlines.min_y() + 1.0),
- width + scanlines.max_x() + 1.0,
- height + scanlines.max_y() + 1.0);
+ agg::rect_d clipping_rect(
+ -(scanlines.min_x() + 1.0),
+ -(scanlines.min_y() + 1.0),
+ width + scanlines.max_x() + 1.0,
+ height + scanlines.max_y() + 1.0);
 
- if (has_clippath) {
- while (path_curve.vertex(&x, &y) != agg::path_cmd_stop) {
- if (MPL_notisfinite64(x) || MPL_notisfinite64(y)) {
- continue;
- }
+ if (has_clippath)
+ {
+ while (path_curve.vertex(&x, &y) != agg::path_cmd_stop)
+ {
+ if (MPL_notisfinite64(x) || MPL_notisfinite64(y))
+ {
+ continue;
+ }
 
- x = (double)(int)x; y = (double)(int)y;
+ x = (double)(int)x;
+ y = (double)(int)y;
 
- // Cull points outside the boundary of the image. Values
- // that are too large may overflow and create segfaults.
- // because they can create segfaults of they overflow; eg
- // http://sourceforge.net/tracker/?func=detail&aid=2865490&group_id=80706&atid=560720
- if (!clipping_rect.hit_test(x, y)) {
- continue;
- }
+ // Cull points outside the boundary of the image.
+ // Values that are too large may overflow and create
+ // segfaults.
+ // http://sourceforge.net/tracker/?func=detail&aid=2865490&group_id=80706&atid=560720
+ if (!clipping_rect.hit_test(x, y))
+ {
+ continue;
+ }
 
- pixfmt_amask_type pfa(pixFmt, alphaMask);
- amask_ren_type r(pfa);
- amask_aa_renderer_type ren(r);
+ pixfmt_amask_type pfa(pixFmt, alphaMask);
+ amask_ren_type r(pfa);
+ amask_aa_renderer_type ren(r);
 
- if (face.first) {
- ren.color(face.second);
- sa.init(fillCache, fillSize, x, y);
- agg::render_scanlines(sa, sl, ren);
+ if (face.first)
+ {
+ ren.color(face.second);
+ sa.init(fillCache, fillSize, x, y);
+ agg::render_scanlines(sa, sl, ren);
+ }
+ ren.color(gc.color);
+ sa.init(strokeCache, strokeSize, x, y);
+ agg::render_scanlines(sa, sl, ren);
+ }
 }
- ren.color(gc.color);
- sa.init(strokeCache, strokeSize, x, y);
- agg::render_scanlines(sa, sl, ren);
- }
- } else {
- while (path_curve.vertex(&x, &y) != agg::path_cmd_stop) {
- if (MPL_notisfinite64(x) || MPL_notisfinite64(y)) {
- continue;
- }
+ else
+ {
+ while (path_curve.vertex(&x, &y) != agg::path_cmd_stop)
+ {
+ if (MPL_notisfinite64(x) || MPL_notisfinite64(y))
+ {
+ continue;
+ }
 
- x = (double)(int)x; y = (double)(int)y;
+ x = (double)(int)x;
+ y = (double)(int)y;
 
- // Cull points outside the boundary of the image. Values
- // that are too large may overflow and create segfaults.
- // because they can create segfaults of they overflow; eg
- // http://sourceforge.net/tracker/?func=detail&aid=2865490&group_id=80706&atid=560720
- if (!clipping_rect.hit_test(x, y)) {
- continue;
- }
+ // Cull points outside the boundary of the image.
+ // Values that are too large may overflow and create
+ // segfaults.
+ // http://sourceforge.net/tracker/?func=detail&aid=2865490&group_id=80706&atid=560720
+ if (!clipping_rect.hit_test(x, y))
+ {
+ continue;
+ }
 
- if (face.first) {
- rendererAA.color(face.second);
- sa.init(fillCache, fillSize, x, y);
- agg::render_scanlines(sa, sl, rendererAA);
+ if (face.first)
+ {
+ rendererAA.color(face.second);
+ sa.init(fillCache, fillSize, x, y);
+ agg::render_scanlines(sa, sl, rendererAA);
+ }
+
+ rendererAA.color(gc.color);
+ sa.init(strokeCache, strokeSize, x, y);
+ agg::render_scanlines(sa, sl, rendererAA);
+ }
 }
+ }
+ catch (...)
+ {
+ if (fillCache != staticFillCache)
+ delete[] fillCache;
+ if (strokeCache != staticStrokeCache)
+ delete[] strokeCache;
+ throw;
+ }
 
- rendererAA.color(gc.color);
- sa.init(strokeCache, strokeSize, x, y);
- agg::render_scanlines(sa, sl, rendererAA);
- }
- }
- } catch(...) {
 if (fillCache != staticFillCache)
- delete[] fillCache;
+ delete[] fillCache;
 if (strokeCache != staticStrokeCache)
- delete[] strokeCache;
- throw;
- }
+ delete[] strokeCache;
 
- if (fillCache != staticFillCache)
- delete[] fillCache;
- if (strokeCache != staticStrokeCache)
- delete[] strokeCache;
-
- return Py::Object();
+ return Py::Object();
 }
 
+
 /**
 * This is a custom span generator that converts spans in the
 * 8-bit inverted greyscale font buffer to rgba that agg can use.
@@ -680,1380 +816,1626 @@
 class font_to_rgba
 {
 public:
- typedef ChildGenerator child_type;
- typedef agg::rgba8 color_type;
- typedef typename child_type::color_type child_color_type;
- typedef agg::span_allocator<child_color_type> span_alloc_type;
+ typedef ChildGenerator child_type;
+ typedef agg::rgba8 color_type;
+ typedef typename child_type::color_type child_color_type;
+ typedef agg::span_allocator<child_color_type> span_alloc_type;
 
 private:
- child_type* _gen;
- color_type _color;
- span_alloc_type _allocator;
+ child_type* _gen;
+ color_type _color;
+ span_alloc_type _allocator;
 
 public:
- font_to_rgba(child_type* gen, color_type color) :
- _gen(gen),
- _color(color) {
- }
+ font_to_rgba(child_type* gen, color_type color) :
+ _gen(gen),
+ _color(color)
+ {
 
- inline void generate(color_type* output_span, int x, int y, unsigned len)
- {
- _allocator.allocate(len);
- child_color_type* input_span = _allocator.span();
- _gen->generate(input_span, x, y, len);
+ }
 
- do {
- *output_span = _color;
- output_span->a = ((unsigned int)_color.a * (unsigned int)input_span->v) >> 8;
- ++output_span;
- ++input_span;
- } while (--len);
- }
+ inline void
+ generate(color_type* output_span, int x, int y, unsigned len)
+ {
+ _allocator.allocate(len);
+ child_color_type* input_span = _allocator.span();
+ _gen->generate(input_span, x, y, len);
 
- void prepare()
- {
- _gen->prepare();
- }
+ do
+ {
+ *output_span = _color;
+ output_span->a = ((unsigned int)_color.a *
+ (unsigned int)input_span->v) >> 8;
+ ++output_span;
+ ++input_span;
+ }
+ while (--len);
+ }
 
+ void
+ prepare()
+ {
+ _gen->prepare();
+ }
 };
 
+
 // MGDTODO: Support clip paths
 Py::Object
-RendererAgg::draw_text_image(const Py::Tuple& args) {
- _VERBOSE("RendererAgg::draw_text");
+RendererAgg::draw_text_image(const Py::Tuple& args)
+{
+ _VERBOSE("RendererAgg::draw_text");
 
- typedef agg::span_allocator<agg::gray8> gray_span_alloc_type;
- typedef agg::span_allocator<agg::rgba8> color_span_alloc_type;
- typedef agg::span_interpolator_linear<> interpolator_type;
- typedef agg::image_accessor_clip<agg::pixfmt_gray8> image_accessor_type;
- //typedef agg::span_image_filter_gray_2x2<image_accessor_type, interpolator_type>
- // image_span_gen_type;
- typedef agg::span_image_filter_gray<image_accessor_type, interpolator_type>
- image_span_gen_type;
+ typedef agg::span_allocator<agg::gray8> gray_span_alloc_type;
+ typedef agg::span_allocator<agg::rgba8> color_span_alloc_type;
+ typedef agg::span_interpolator_linear<> interpolator_type;
+ typedef agg::image_accessor_clip<agg::pixfmt_gray8> image_accessor_type;
+ typedef agg::span_image_filter_gray<image_accessor_type,
+ interpolator_type> image_span_gen_type;
+ typedef font_to_rgba<image_span_gen_type> span_gen_type;
+ typedef agg::renderer_scanline_aa<renderer_base, color_span_alloc_type,
+ span_gen_type> renderer_type;
 
- typedef font_to_rgba<image_span_gen_type> span_gen_type;
- typedef agg::renderer_scanline_aa<renderer_base, color_span_alloc_type, span_gen_type>
- renderer_type;
+ args.verify_length(5);
 
- args.verify_length(5);
+ const unsigned char* buffer = NULL;
+ int width, height;
+ Py::Object image_obj = args[0];
+ PyArrayObject* image_array = NULL;
 
- const unsigned char* buffer = NULL;
- int width, height;
- Py::Object image_obj = args[0];
- PyArrayObject* image_array = NULL;
- if (PyArray_Check(image_obj.ptr())) {
- image_array = (PyArrayObject*)PyArray_FromObject(image_obj.ptr(), PyArray_UBYTE, 2, 2);
- if (!image_array)
- throw Py::ValueError("First argument to draw_text_image must be a FT2Font.Image object or a Nx2 uint8 numpy array.");
- buffer = (unsigned char *)PyArray_DATA(image_array);
- width = PyArray_DIM(image_array, 1);
- height = PyArray_DIM(image_array, 0);
- } else {
- FT2Image *image = static_cast<FT2Image*>(args[0].ptr());
- if (!image->get_buffer())
- throw Py::ValueError("First argument to draw_text_image must be a FT2Font.Image object or a Nx2 uint8 numpy array.");
- buffer = image->get_buffer();
- width = image->get_width();
- height = image->get_height();
- }
+ if (PyArray_Check(image_obj.ptr()))
+ {
+ image_array = (PyArrayObject*)PyArray_FromObject(image_obj.ptr(), PyArray_UBYTE, 2, 2);
+ if (!image_array)
+ {
+ throw Py::ValueError(
+ "First argument to draw_text_image must be a FT2Font.Image object or a Nx2 uint8 numpy array.");
+ }
+ buffer = (unsigned char *)PyArray_DATA(image_array);
+ width = PyArray_DIM(image_array, 1);
+ height = PyArray_DIM(image_array, 0);
+ }
+ else
+ {
+ FT2Image *image = static_cast<FT2Image*>(args[0].ptr());
+ if (!image->get_buffer())
+ {
+ throw Py::ValueError(
+ "First argument to draw_text_image must be a FT2Font.Image object or a Nx2 uint8 numpy array.");
+ }
+ buffer = image->get_buffer();
+ width = image->get_width();
+ height = image->get_height();
+ }
 
- int x(0),y(0);
- try {
- x = Py::Int( args[1] );
- y = Py::Int( args[2] );
- }
- catch (Py::TypeError) {
- Py_XDECREF(image_array);
- throw Py::TypeError("Invalid input arguments to draw_text_image");
- }
+ int x(0), y(0);
+ try
+ {
+ x = Py::Int(args[1]);
+ y = Py::Int(args[2]);
+ }
+ catch (Py::TypeError)
+ {
+ Py_XDECREF(image_array);
+ throw Py::TypeError("Invalid input arguments to draw_text_image");
+ }
 
- double angle = Py::Float( args[3] );
+ double angle = Py::Float(args[3]);
 
- GCAgg gc(args[4], dpi);
+ GCAgg gc(args[4], dpi);
 
- theRasterizer.reset_clipping();
- rendererBase.reset_clipping(true);
- set_clipbox(gc.cliprect, theRasterizer);
+ theRasterizer.reset_clipping();
+ rendererBase.reset_clipping(true);
+ set_clipbox(gc.cliprect, theRasterizer);
 
- agg::rendering_buffer srcbuf((agg::int8u*)buffer, width, height, width);
- agg::pixfmt_gray8 pixf_img(srcbuf);
+ agg::rendering_buffer srcbuf((agg::int8u*)buffer, width, height, width);
+ agg::pixfmt_gray8 pixf_img(srcbuf);
 
- agg::trans_affine mtx;
- mtx *= agg::trans_affine_translation(0, -height);
- mtx *= agg::trans_affine_rotation(-angle * agg::pi / 180.0);
- mtx *= agg::trans_affine_translation(x, y);
+ agg::trans_affine mtx;
+ mtx *= agg::trans_affine_translation(0, -height);
+ mtx *= agg::trans_affine_rotation(-angle * agg::pi / 180.0);
+ mtx *= agg::trans_affine_translation(x, y);
 
- agg::path_storage rect;
- rect.move_to(0, 0);
- rect.line_to(width, 0);
- rect.line_to(width, height);
- rect.line_to(0, height);
- rect.line_to(0, 0);
- agg::conv_transform<agg::path_storage> rect2(rect, mtx);
+ agg::path_storage rect;
+ rect.move_to(0, 0);
+ rect.line_to(width, 0);
+ rect.line_to(width, height);
+ rect.line_to(0, height);
+ rect.line_to(0, 0);
+ agg::conv_transform<agg::path_storage> rect2(rect, mtx);
 
- agg::trans_affine inv_mtx(mtx);
- inv_mtx.invert();
+ agg::trans_affine inv_mtx(mtx);
+ inv_mtx.invert();
 
- agg::image_filter_lut filter;
- filter.calculate(agg::image_filter_spline36());
- interpolator_type interpolator(inv_mtx);
- color_span_alloc_type sa;
- image_accessor_type ia(pixf_img, 0);
- image_span_gen_type image_span_generator(ia, interpolator, filter);
- span_gen_type output_span_generator(&image_span_generator, gc.color);
- renderer_type ri(rendererBase, sa, output_span_generator);
+ agg::image_filter_lut filter;
+ filter.calculate(agg::image_filter_spline36());
+ interpolator_type interpolator(inv_mtx);
+ color_span_alloc_type sa;
+ image_accessor_type ia(pixf_img, 0);
+ image_span_gen_type image_span_generator(ia, interpolator, filter);
+ span_gen_type output_span_generator(&image_span_generator, gc.color);
+ renderer_type ri(rendererBase, sa, output_span_generator);
 
- theRasterizer.add_path(rect2);
- agg::render_scanlines(theRasterizer, slineP8, ri);
+ theRasterizer.add_path(rect2);
+ agg::render_scanlines(theRasterizer, slineP8, ri);
 
- Py_XDECREF(image_array);
+ Py_XDECREF(image_array);
 
- return Py::Object();
+ return Py::Object();
 }
 
 
 Py::Object
-RendererAgg::draw_image(const Py::Tuple& args) {
- _VERBOSE("RendererAgg::draw_image");
+RendererAgg::draw_image(const Py::Tuple& args)
+{
+ _VERBOSE("RendererAgg::draw_image");
 
- args.verify_length(4, 7); // 7 if affine matrix if given
+ args.verify_length(4, 7); // 7 if affine matrix if given
 
- GCAgg gc(args[0], dpi);
- Image *image = static_cast<Image*>(args[3].ptr());
- bool has_clippath = false;
- agg::trans_affine affine_trans;
- bool has_affine = false;
- double x, y, w, h;
+ GCAgg gc(args[0], dpi);
+ Image *image = static_cast<Image*>(args[3].ptr());
+ bool has_clippath = false;
+ agg::trans_affine affine_trans;
+ bool has_affine = false;
+ double x, y, w, h;
 
-
- if (args.size() == 7) {
- has_affine = true;
- x = Py::Float(args[1]);
- y = Py::Float(args[2]);
- w = Py::Float(args[4]);
- h = Py::Float(args[5]);
- affine_trans = py_to_agg_transformation_matrix(args[6].ptr());
- } else {
- x = mpl_round(Py::Float(args[1]));
- y = mpl_round(Py::Float(args[2]));
- w = h = 0; /* w and h not used in this case, but assign to prevent
+ if (args.size() == 7)
+ {
+ has_affine = true;
+ x = Py::Float(args[1]);
+ y = Py::Float(args[2]);
+ w = Py::Float(args[4]);
+ h = Py::Float(args[5]);
+ affine_trans = py_to_agg_transformation_matrix(args[6].ptr());
+ }
+ else
+ {
+ x = mpl_round(Py::Float(args[1]));
+ y = mpl_round(Py::Float(args[2]));
+ w = h = 0; /* w and h not used in this case, but assign to prevent
 warnings from the compiler */
- }
+ }
 
+ theRasterizer.reset_clipping();
+ rendererBase.reset_clipping(true);
+ set_clipbox(gc.cliprect, theRasterizer);
+ has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
 
- theRasterizer.reset_clipping();
- rendererBase.reset_clipping(true);
- set_clipbox(gc.cliprect, theRasterizer);
- has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
+ Py::Tuple empty;
+ image->flipud_out(empty);
+ pixfmt pixf(*(image->rbufOut));
 
- Py::Tuple empty;
- image->flipud_out(empty);
- pixfmt pixf(*(image->rbufOut));
+ if (has_affine | has_clippath)
+ {
+ agg::trans_affine mtx;
+ agg::path_storage rect;
 
- if (has_affine | has_clippath) {
- agg::trans_affine mtx;
- agg::path_storage rect;
+ if (has_affine)
+ {
+ mtx *= agg::trans_affine_scaling(1, -1);
+ mtx *= agg::trans_affine_translation(0, image->rowsOut);
+ mtx *= agg::trans_affine_scaling(w / (image->colsOut),
+ h / (image->rowsOut));
+ mtx *= agg::trans_affine_translation(x, y);
+ mtx *= affine_trans;
+ mtx *= agg::trans_affine_scaling(1.0, -1.0);
+ mtx *= agg::trans_affine_translation(0.0, (double) height);
+ }
+ else
+ {
+ mtx *= agg::trans_affine_translation(
+ (int)x,
+ (int)(height - (y + image->rowsOut)));
+ }
 
- if (has_affine) {
- mtx *= agg::trans_affine_scaling(1, -1);
- mtx *= agg::trans_affine_translation(0, image->rowsOut);
- mtx *= agg::trans_affine_scaling(w/(image->colsOut), h/(image->rowsOut));
- mtx *= agg::trans_affine_translation(x, y);
- mtx *= affine_trans;
- mtx *= agg::trans_affine_scaling(1.0, -1.0);
- mtx *= agg::trans_affine_translation(0.0, (double) height);
- } else {
- mtx *= agg::trans_affine_translation((int)x, (int)(height-(y+image->rowsOut)));
- }
+ rect.move_to(0, 0);
+ rect.line_to(image->colsOut, 0);
+ rect.line_to(image->colsOut, image->rowsOut);
+ rect.line_to(0, image->rowsOut);
+ rect.line_to(0, 0);
 
- rect.move_to(0, 0);
- rect.line_to(image->colsOut, 0);
- rect.line_to(image->colsOut, image->rowsOut);
- rect.line_to(0, image->rowsOut);
- rect.line_to(0, 0);
+ agg::conv_transform<agg::path_storage> rect2(rect, mtx);
 
- agg::conv_transform<agg::path_storage> rect2(rect, mtx);
+ agg::trans_affine inv_mtx(mtx);
+ inv_mtx.invert();
 
- agg::trans_affine inv_mtx(mtx);
- inv_mtx.invert();
+ typedef agg::span_allocator<agg::rgba8> color_span_alloc_type;
+ typedef agg::image_accessor_clip<agg::pixfmt_rgba32>
+ image_accessor_type;
+ typedef agg::span_interpolator_linear<> interpolator_type;
+ typedef agg::span_image_filter_rgba_nn<image_accessor_type,
+ interpolator_type> image_span_gen_type;
 
+ color_span_alloc_type sa;
+ image_accessor_type ia(pixf, agg::rgba8(0, 0, 0, 0));
+ interpolator_type interpolator(inv_mtx);
+ image_span_gen_type image_span_generator(ia, interpolator);
 
- typedef agg::span_allocator<agg::rgba8> color_span_alloc_type;
- typedef agg::image_accessor_clip<agg::pixfmt_rgba32> image_accessor_type;
- typedef agg::span_interpolator_linear<> interpolator_type;
- typedef agg::span_image_filter_rgba_nn<image_accessor_type, interpolator_type> image_span_gen_type;
+ if (has_clippath)
+ {
+ typedef agg::pixfmt_amask_adaptor<pixfmt, alpha_mask_type>
+ pixfmt_amask_type;
+ typedef agg::renderer_base<pixfmt_amask_type> amask_ren_type;
+ typedef agg::renderer_scanline_aa<amask_ren_type,
+ color_span_alloc_type,
+ image_span_gen_type>
+ renderer_type_alpha;
 
+ pixfmt_amask_type pfa(pixFmt, alphaMask);
+ amask_ren_type r(pfa);
+ renderer_type_alpha ri(r, sa, image_span_generator);
 
- color_span_alloc_type sa;
- image_accessor_type ia(pixf, agg::rgba8(0, 0, 0, 0));
- interpolator_type interpolator(inv_mtx);
- image_span_gen_type image_span_generator(ia, interpolator);
+ theRasterizer.add_path(rect2);
+ agg::render_scanlines(theRasterizer, slineP8, ri);
+ }
+ else
+ {
+ typedef agg::renderer_base<pixfmt> ren_type;
+ typedef agg::renderer_scanline_aa<ren_type,
+ color_span_alloc_type,
+ image_span_gen_type>
+ renderer_type;
 
+ ren_type r(pixFmt);
+ renderer_type ri(r, sa, image_span_generator);
 
- if (has_clippath) {
- typedef agg::pixfmt_amask_adaptor<pixfmt, alpha_mask_type> pixfmt_amask_type;
- typedef agg::renderer_base<pixfmt_amask_type> amask_ren_type;
- typedef agg::renderer_scanline_aa<amask_ren_type, color_span_alloc_type, image_span_gen_type> renderer_type_alpha;
+ theRasterizer.add_path(rect2);
+ agg::render_scanlines(theRasterizer, slineP8, ri);
+ }
 
- pixfmt_amask_type pfa(pixFmt, alphaMask);
- amask_ren_type r(pfa);
- renderer_type_alpha ri(r, sa, image_span_generator);
-
- theRasterizer.add_path(rect2);
- agg::render_scanlines(theRasterizer, slineP8, ri);
- } else {
- typedef agg::renderer_base<pixfmt> ren_type;
- typedef agg::renderer_scanline_aa<ren_type, color_span_alloc_type, image_span_gen_type> renderer_type;
- ren_type r(pixFmt);
- renderer_type ri(r, sa, image_span_generator);
-
- theRasterizer.add_path(rect2);
- agg::render_scanlines(theRasterizer, slineP8, ri);
 }
+ else
+ {
+ set_clipbox(gc.cliprect, rendererBase);
+ rendererBase.blend_from(pixf, 0, (int)x, (int)(height - (y + image->rowsOut)));
+ }
 
- } else {
- set_clipbox(gc.cliprect, rendererBase);
- rendererBase.blend_from(pixf, 0, (int)x, (int)(height-(y+image->rowsOut)));
- }
+ image->flipud_out(empty);
 
- image->flipud_out(empty);
-
- return Py::Object();
+ return Py::Object();
 }
 
 
-
-
 template<class path_t>
 void RendererAgg::_draw_path(path_t& path, bool has_clippath,
- const facepair_t& face, const GCAgg& gc) {
- typedef agg::conv_stroke<path_t> stroke_t;
- typedef agg::conv_dash<path_t> dash_t;
- typedef agg::conv_stroke<dash_t> stroke_dash_t;
- typedef agg::pixfmt_amask_adaptor<pixfmt, alpha_mask_type> pixfmt_amask_type;
- typedef agg::renderer_base<pixfmt_amask_type> amask_ren_type;
- typedef agg::renderer_scanline_aa_solid<amask_ren_type> amask_aa_renderer_type;
- typedef agg::renderer_scanline_bin_solid<amask_ren_type> amask_bin_renderer_type;
+ const facepair_t& face, const GCAgg& gc)
+{
+ typedef agg::conv_stroke<path_t> stroke_t;
+ typedef agg::conv_dash<path_t> dash_t;
+ typedef agg::conv_stroke<dash_t> stroke_dash_t;
+ typedef agg::pixfmt_amask_adaptor<pixfmt, alpha_mask_type> pixfmt_amask_type;
+ typedef agg::renderer_base<pixfmt_amask_type> amask_ren_type;
+ typedef agg::renderer_scanline_aa_solid<amask_ren_type> amask_aa_renderer_type;
+ typedef agg::renderer_scanline_bin_solid<amask_ren_type> amask_bin_renderer_type;
 
- // Render face
- if (face.first) {
- theRasterizer.add_path(path);
+ // Render face
+ if (face.first)
+ {
+ theRasterizer.add_path(path);
 
- if (gc.isaa) {
- if (has_clippath) {
- pixfmt_amask_type pfa(pixFmt, alphaMask);
- amask_ren_type r(pfa);
- amask_aa_renderer_type ren(r);
- ren.color(face.second);
- agg::render_scanlines(theRasterizer, slineP8, ren);
- } else {
- rendererAA.color(face.second);
- agg::render_scanlines(theRasterizer, slineP8, rendererAA);
- }
- } else {
- if (has_clippath) {
- pixfmt_amask_type pfa(pixFmt, alphaMask);
- amask_ren_type r(pfa);
- amask_bin_renderer_type ren(r);
- ren.color(face.second);
- agg::render_scanlines(theRasterizer, slineP8, ren);
- } else {
- rendererBin.color(face.second);
- agg::render_scanlines(theRasterizer, slineP8, rendererBin);
- }
+ if (gc.isaa)
+ {
+ if (has_clippath)
+ {
+ pixfmt_amask_type pfa(pixFmt, alphaMask);
+ amask_ren_type r(pfa);
+ amask_aa_renderer_type ren(r);
+ ren.color(face.second);
+ agg::render_scanlines(theRasterizer, slineP8, ren);
+ }
+ else
+ {
+ rendererAA.color(face.second);
+ agg::render_scanlines(theRasterizer, slineP8, rendererAA);
+ }
+ }
+ else
+ {
+ if (has_clippath)
+ {
+ pixfmt_amask_type pfa(pixFmt, alphaMask);
+ amask_ren_type r(pfa);
+ amask_bin_renderer_type ren(r);
+ ren.color(face.second);
+ agg::render_scanlines(theRasterizer, slineP8, ren);
+ }
+ else
+ {
+ rendererBin.color(face.second);
+ agg::render_scanlines(theRasterizer, slineP8, rendererBin);
+ }
+ }
 }
- }
 
- // Render hatch
- if (!gc.hatchpath.isNone()) {
- // Reset any clipping that may be in effect, since we'll be
- // drawing the hatch in a scratch buffer at origin (0, 0)
- theRasterizer.reset_clipping();
- rendererBase.reset_clipping(true);
+ // Render hatch
+ if (!gc.hatchpath.isNone())
+ {
+ // Reset any clipping that may be in effect, since we'll be
+ // drawing the hatch in a scratch buffer at origin (0, 0)
+ theRasterizer.reset_clipping();
+ rendererBase.reset_clipping(true);
 
- // Create and transform the path
- typedef agg::conv_transform<PathIterator> hatch_p...
 
[truncated message content]
Revision: 8459
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8459&view=rev
Author: mdboom
Date: 2010年06月23日 14:44:32 +0000 (2010年6月23日)
Log Message:
-----------
Add unit test to ensure that rendering complexity exceeded exception is properly propagated to Python.
Modified Paths:
--------------
 trunk/matplotlib/lib/matplotlib/tests/test_simplification.py
Modified: trunk/matplotlib/lib/matplotlib/tests/test_simplification.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/tests/test_simplification.py	2010年06月23日 14:43:52 UTC (rev 8458)
+++ trunk/matplotlib/lib/matplotlib/tests/test_simplification.py	2010年06月23日 14:44:32 UTC (rev 8459)
@@ -6,6 +6,10 @@
 from pylab import *
 import numpy as np
 from matplotlib import patches, path, transforms
+
+from nose.tools import raises
+import cStringIO
+
 nan = np.nan
 Path = path.Path
 
@@ -165,6 +169,24 @@
 assert len(segs) == 1
 assert segs[0][1] == Path.MOVETO
 
+@raises(OverflowError)
+def test_throw_rendering_complexity_exceeded():
+ rcParams['path.simplify'] = False
+
+ xx = np.arange(200000)
+ yy = np.random.rand(200000)
+ yy[1000] = np.nan
+ fig = plt.figure()
+ ax = fig.add_subplot(111)
+ ax.plot(xx, yy)
+ try:
+ fig.savefig(cStringIO.StringIO())
+ except e:
+ raise e
+ else:
+ rcParams['path.simplify'] = True
+
+
 if __name__=='__main__':
 import nose
 nose.runmodule(argv=['-s','--with-doctest'], exit=False)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2010年06月23日 14:44:01
Revision: 8458
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8458&view=rev
Author: mdboom
Date: 2010年06月23日 14:43:52 +0000 (2010年6月23日)
Log Message:
-----------
Uses doubles for rectangle clipping everywhere in the Agg backend.
Modified Paths:
--------------
 trunk/matplotlib/src/_backend_agg.h
 trunk/matplotlib/src/_image.cpp
Modified: trunk/matplotlib/src/_backend_agg.h
===================================================================
--- trunk/matplotlib/src/_backend_agg.h	2010年06月23日 14:18:05 UTC (rev 8457)
+++ trunk/matplotlib/src/_backend_agg.h	2010年06月23日 14:43:52 UTC (rev 8458)
@@ -55,7 +55,7 @@
 typedef agg::renderer_base<pixfmt> renderer_base;
 typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_aa;
 typedef agg::renderer_scanline_bin_solid<renderer_base> renderer_bin;
-typedef agg::rasterizer_scanline_aa<> rasterizer;
+typedef agg::rasterizer_scanline_aa<agg::rasterizer_sl_clip_dbl> rasterizer;
 
 typedef agg::scanline_p8 scanline_p8;
 typedef agg::scanline_bin scanline_bin;
Modified: trunk/matplotlib/src/_image.cpp
===================================================================
--- trunk/matplotlib/src/_image.cpp	2010年06月23日 14:18:05 UTC (rev 8457)
+++ trunk/matplotlib/src/_image.cpp	2010年06月23日 14:43:52 UTC (rev 8458)
@@ -39,7 +39,7 @@
 typedef agg::pixfmt_rgba32 pixfmt;
 typedef agg::renderer_base<pixfmt> renderer_base;
 typedef agg::span_interpolator_linear<> interpolator_type;
-typedef agg::rasterizer_scanline_aa<> rasterizer;
+typedef agg::rasterizer_scanline_aa<agg::rasterizer_sl_clip_dbl> rasterizer;
 
 
 Image::Image() :
@@ -351,7 +351,7 @@
 pixfmt pixf(*rbufOut);
 renderer_base rb(pixf);
 rb.clear(bg);
- agg::rasterizer_scanline_aa<agg::rasterizer_sl_clip_dbl> ras;
+ rasterizer ras;
 agg::scanline_u8 sl;
 
 ras.clip_box(0, 0, numcols, numrows);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2010年06月23日 14:18:16
Revision: 8457
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8457&view=rev
Author: mdboom
Date: 2010年06月23日 14:18:05 +0000 (2010年6月23日)
Log Message:
-----------
Do image clipping of images in doubles rather than ints -- prevents the "disappearing image when zooming in too far" problem.
Modified Paths:
--------------
 trunk/matplotlib/src/_image.cpp
Modified: trunk/matplotlib/src/_image.cpp
===================================================================
--- trunk/matplotlib/src/_image.cpp	2010年06月22日 19:30:57 UTC (rev 8456)
+++ trunk/matplotlib/src/_image.cpp	2010年06月23日 14:18:05 UTC (rev 8457)
@@ -29,6 +29,7 @@
 #include "agg_span_image_filter_rgb.h"
 #include "agg_span_image_filter_rgba.h"
 #include "agg_span_interpolator_linear.h"
+#include "agg_rasterizer_sl_clip.h"
 #include "util/agg_color_conv_rgb8.h"
 #include "_image.h"
 #include "mplutils.h"
@@ -350,7 +351,7 @@
 pixfmt pixf(*rbufOut);
 renderer_base rb(pixf);
 rb.clear(bg);
- agg::rasterizer_scanline_aa<> ras;
+ agg::rasterizer_scanline_aa<agg::rasterizer_sl_clip_dbl> ras;
 agg::scanline_u8 sl;
 
 ras.clip_box(0, 0, numcols, numrows);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2010年06月22日 19:31:03
Revision: 8456
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8456&view=rev
Author: mdboom
Date: 2010年06月22日 19:30:57 +0000 (2010年6月22日)
Log Message:
-----------
Fix severe slowness with very high image magnification.
Modified Paths:
--------------
 trunk/matplotlib/src/_image.cpp
Modified: trunk/matplotlib/src/_image.cpp
===================================================================
--- trunk/matplotlib/src/_image.cpp	2010年06月22日 16:30:24 UTC (rev 8455)
+++ trunk/matplotlib/src/_image.cpp	2010年06月22日 19:30:57 UTC (rev 8456)
@@ -353,6 +353,7 @@
 agg::rasterizer_scanline_aa<> ras;
 agg::scanline_u8 sl;
 
+ ras.clip_box(0, 0, numcols, numrows);
 
 //srcMatrix *= resizingMatrix;
 //imageMatrix *= resizingMatrix;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

Showing results of 126

1 2 3 .. 6 > >> (Page 1 of 6)
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





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

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

More information about our ad policies

Ad destination/click URL:

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