You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <jd...@us...> - 2007-10-18 15:02:14
|
Revision: 3961 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3961&view=rev Author: jdh2358 Date: 2007-10-18 08:02:13 -0700 (Thu, 18 Oct 2007) Log Message: ----------- Fixed collection.set_facecolor to respect alpha Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/collections.py trunk/matplotlib/lib/matplotlib/mlab.py Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2007-10-18 14:51:16 UTC (rev 3960) +++ trunk/matplotlib/lib/matplotlib/collections.py 2007-10-18 15:02:13 UTC (rev 3961) @@ -239,7 +239,8 @@ ACCEPTS: matplotlib color arg or sequence of rgba tuples """ - self._facecolors = _colors.colorConverter.to_rgba_list(c) + self._facecolors = _colors.colorConverter.to_rgba_list(c, self._alpha) + def set_facecolors(self, c): self.set_facecolor(c) Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2007-10-18 14:51:16 UTC (rev 3960) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-10-18 15:02:13 UTC (rev 3961) @@ -1342,9 +1342,15 @@ process_skiprows(reader) + def myfloat(x): + if x==missing: + return npy.nan + else: + return float(x) + def get_func(item, func): # promote functions in this order - funcmap = {int:float, float:dateutil.parser.parse, dateutil.parser.parse:str} + funcmap = {int:myfloat, myfloat:dateutil.parser.parse, dateutil.parser.parse:str} try: func(item) except: if func==str: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-10-18 14:51:21
|
Revision: 3960 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3960&view=rev Author: mdboom Date: 2007-10-18 07:51:16 -0700 (Thu, 18 Oct 2007) Log Message: ----------- More examples working. Minor speedups. Modified Paths: -------------- branches/transforms/PASSED_DEMOS branches/transforms/lib/matplotlib/collections.py branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/pyplot.py branches/transforms/lib/matplotlib/quiver.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/PASSED_DEMOS =================================================================== --- branches/transforms/PASSED_DEMOS 2007-10-17 01:15:48 UTC (rev 3959) +++ branches/transforms/PASSED_DEMOS 2007-10-18 14:51:16 UTC (rev 3960) @@ -164,8 +164,8 @@ pstest.py pylab_with_gtk.py pythonic_matplotlib.py O -quadmesh_demo.py [MASKED VALUES NOT QUITE RIGHT] -quiver_demo.py [SEGFAULTS] +quadmesh_demo.py O [MASKED VALUES ARE SHOWN DUE TO A BUG IN TRUNK] +quiver_demo.py O rc_traits.py [N/A] scatter_custom_symbol.py O scatter_demo2.py O Modified: branches/transforms/lib/matplotlib/collections.py =================================================================== --- branches/transforms/lib/matplotlib/collections.py 2007-10-17 01:15:48 UTC (rev 3959) +++ branches/transforms/lib/matplotlib/collections.py 2007-10-18 14:51:16 UTC (rev 3960) @@ -356,7 +356,6 @@ If the scalar mappable array is not none, update colors from scalar data """ - #print 'update_scalarmappable: self._A', self._A if self._A is None: return if len(self._A.shape)>1: raise ValueError('Collections can only map rank 1 arrays') @@ -364,7 +363,6 @@ self._facecolors = self.to_rgba(self._A, self._alpha) else: self._edgecolors = self.to_rgba(self._A, self._alpha) - #print self._facecolors # these are not available for the object inspector until after the @@ -445,7 +443,7 @@ return self._paths def draw(self, renderer): - self.update_scalarmappable() ####################### + self.update_scalarmappable() self._linewidths = (1,) if self._showedges: Modified: branches/transforms/lib/matplotlib/lines.py =================================================================== --- branches/transforms/lib/matplotlib/lines.py 2007-10-17 01:15:48 UTC (rev 3959) +++ branches/transforms/lib/matplotlib/lines.py 2007-10-18 14:51:16 UTC (rev 3960) @@ -281,6 +281,8 @@ if is_numlike(self._picker): self.pickradius = self._picker + self._xorig = npy.asarray([]) + self._yorig = npy.asarray([]) self.set_data(xdata, ydata) self._logcache = None @@ -377,9 +379,13 @@ else: x, y = args - self._xorig = x - self._yorig = y - self.recache() + x = npy.asarray(x) + y = npy.asarray(y) + if ((x.shape != self._xorig.shape or npy.any(x != self._xorig)) or + (y.shape != self._yorig.shape or npy.any(y != self._yorig))): + self._xorig = x + self._yorig = y + self.recache() def recache(self): #if self.axes is None: print 'recache no axes' @@ -625,8 +631,10 @@ ACCEPTS: npy.array """ - self._xorig = x - self.recache() + x = npy.asarray(x) + if x.shape != self._xorig.shape or npy.any(x != self._xorig): + self._xorig = x + self.recache() def set_ydata(self, y): """ @@ -634,10 +642,11 @@ ACCEPTS: npy.array """ + y = npy.asarray(y) + if y.shape != self._yorig.shape or npy.any(y != self._yorig): + self._yorig = y + self.recache() - self._yorig = y - self.recache() - def set_dashes(self, seq): """ Set the dash sequence, sequence of dashes with on off ink in Modified: branches/transforms/lib/matplotlib/pyplot.py =================================================================== --- branches/transforms/lib/matplotlib/pyplot.py 2007-10-17 01:15:48 UTC (rev 3959) +++ branches/transforms/lib/matplotlib/pyplot.py 2007-10-18 14:51:16 UTC (rev 3960) @@ -312,7 +312,7 @@ A matplotlib.legend.Legend instance is returned """ - l= gcf().legend(handles, labels, loc, **kwargs) + l = gcf().legend(handles, labels, loc, **kwargs) draw_if_interactive() return l Modified: branches/transforms/lib/matplotlib/quiver.py =================================================================== --- branches/transforms/lib/matplotlib/quiver.py 2007-10-17 01:15:48 UTC (rev 3959) +++ branches/transforms/lib/matplotlib/quiver.py 2007-10-18 14:51:16 UTC (rev 3960) @@ -206,24 +206,24 @@ def _text_x(self, x): if self.labelpos == 'E': - return x + self.labelsep.get() + return x + self.labelsep elif self.labelpos == 'W': - return x - self.labelsep.get() + return x - self.labelsep else: return x def _text_y(self, y): if self.labelpos == 'N': - return y + self.labelsep.get() + return y + self.labelsep elif self.labelpos == 'S': - return y - self.labelsep.get() + return y - self.labelsep else: return y def draw(self, renderer): self._init() self.vector.draw(renderer) - x, y = self.get_transform().xy_tup((self.X, self.Y)) + x, y = self.get_transform().transform_point((self.X, self.Y)) self.text.set_x(self._text_x(x)) self.text.set_y(self._text_y(y)) self.text.draw(renderer) @@ -323,7 +323,7 @@ if not self._initialized: trans = self._set_transform() ax = self.ax - sx, sy = trans.transform_point((ax.bbox.width, ax.bbox.height)) + sx, sy = trans.inverted().transform_point((ax.bbox.width, ax.bbox.height)) self.span = sx sn = max(8, min(25, math.sqrt(self.N))) if self.width is None: @@ -333,12 +333,7 @@ self._init() if self._new_UV: verts = self._make_verts(self.U, self.V) - # Using nan internally here is the easiest - # way to support masked inputs; it doesn't - # require adding mask support to PolyCollection, - # and it keeps all array dimensions (X, Y, U, V, C) - # intact. - self.set_verts(verts.filled(npy.nan)) + self.set_verts(verts) self._new_UV = False collections.PolyCollection.draw(self, renderer) @@ -353,11 +348,11 @@ ax = self.ax if self.units in ('x', 'y'): if self.units == 'x': - dx0 = ax.viewLim.ur().x() - ax.viewLim.ll().x() - dx1 = ax.bbox.ur().x() - ax.bbox.ll().x() + dx0 = ax.viewLim.width + dx1 = ax.bbox.width else: - dx0 = ax.viewLim.ur().y() - ax.viewLim.ll().y() - dx1 = ax.bbox.ur().y() - ax.bbox.ll().y() + dx0 = ax.viewLim.height + dx1 = ax.bbox.height dx = dx1/dx0 else: if self.units == 'width': @@ -365,13 +360,12 @@ elif self.units == 'height': dx = ax.bbox.height elif self.units == 'dots': - dx = transforms.Value(1) + dx = 1.0 elif self.units == 'inches': dx = ax.figure.dpi else: raise ValueError('unrecognized units') - bb = transforms.Bbox.from_lbrt(0, 0, dx, dx) - trans = transforms.BboxTransform(transforms.Bbox.unit(), bb) + trans = transforms.Affine2D().scale(dx) self.set_transform(trans) return trans Modified: branches/transforms/lib/matplotlib/transforms.py =================================================================== --- branches/transforms/lib/matplotlib/transforms.py 2007-10-17 01:15:48 UTC (rev 3959) +++ branches/transforms/lib/matplotlib/transforms.py 2007-10-18 14:51:16 UTC (rev 3960) @@ -90,7 +90,7 @@ """ # Shortcut: If self is already invalid, that means its parents # are as well, so we don't need to do anything. - if self._invalid: + if self._invalid or not len(self._parents): return # If we are an affine transform being changed, we can set the @@ -127,7 +127,7 @@ """ return self - def write_graphviz(self, fobj): + def write_graphviz(self, fobj, highlight=[]): """ For debugging purposes. @@ -146,14 +146,22 @@ if root in seen: return seen.add(root) - fobj.write('%s [label="%s"];\n' % - (hash(root), root.__class__.__name__)) + props = {} + label = root.__class__.__name__ + if root._invalid: + label = '[%s]' % label + if root in highlight: + props['style'] = 'bold' if root.is_affine: - fobj.write('%s [style=filled, color=".7 .7 .9"];\n' % - hash(root)) - elif root.is_bbox: - fobj.write('%s [style=filled, color=".9 .9 .7"];\n' % - hash(root)) + props['shape'] = 'parallelogram' + if root.is_bbox: + props['shape'] = 'box' + props['label'] = '"%s"' % label + props = ' '.join(['%s=%s' % (key, val) for key, val in props.items()]) + + fobj.write('%s [%s];\n' % + (hash(root), props)) + for child in root._children: name = '?' for key, val in root.__dict__.items(): @@ -627,20 +635,23 @@ minpos = npy.array([-npy.inf, -npy.inf], npy.float_) if ignore: - self._points = npy.array( + points = npy.array( [[x.min(), y.min()], [x.max(), y.max()]], npy.float_) self._minpos = minpos else: - self._points = npy.array( + points = npy.array( [[min(x.min(), self.xmin), min(y.min(), self.ymin)], [max(x.max(), self.xmax), max(y.max(), self.ymax)]], npy.float_) self._minpos = npy.minimum(minpos, self._minpos) - self.invalidate() + if npy.any(self._points != points): + self._points = points + self.invalidate() + def update_from_data_xy(self, xy, ignore=None): """ Update the bounds of the Bbox based on the passed in data. @@ -695,8 +706,10 @@ def _set_bounds(self, bounds): l, b, w, h = bounds - self._points = npy.array([[l, b], [l+w, b+h]], npy.float_) - self.invalidate() + points = npy.array([[l, b], [l+w, b+h]], npy.float_) + if npy.any(self._points != points): + self._points = points + self.invalidate() bounds = property(BboxBase._get_bounds, _set_bounds) def _get_minpos(self): @@ -725,15 +738,17 @@ of the form: [[xmin, ymin], [xmax, ymax]]. No error checking is performed, as this method is mainly for internal use. """ - self._points = points - self.invalidate() + if npy.any(self._points != points): + self._points = points + self.invalidate() def set(self, other): """ Set this bounding box from the "frozen" bounds of another Bbox. """ - self._points = other.get_points() - self.invalidate() + if npy.any(self._points != other.get_points()): + self._points = other.get_points() + self.invalidate() class TransformedBbox(BboxBase): @@ -1848,8 +1863,6 @@ self._a = a self._b = b self.set_children(a, b) - self._mtx = None - self._affine = None def frozen(self): self._invalid = 0 @@ -1905,14 +1918,11 @@ transform_path_non_affine.__doc__ = Transform.transform_path_non_affine.__doc__ def get_affine(self): - if self._invalid or self._affine is None: - if self._a.is_affine and self._b.is_affine: - self._affine = Affine2D(npy.dot(self._b.get_affine().get_matrix(), - self._a.get_affine().get_matrix())) - else: - self._affine = self._b.get_affine() - self._invalid = 0 - return self._affine + if self._a.is_affine and self._b.is_affine: + return Affine2D(npy.dot(self._b.get_affine().get_matrix(), + self._a.get_affine().get_matrix())) + else: + return self._b.get_affine() get_affine.__doc__ = Transform.get_affine.__doc__ def inverted(self): @@ -2046,7 +2056,6 @@ self._transform = transform self.set_children(transform) self._transformed_path = None - self.get_affine = self._transform.get_affine def get_transformed_path_and_affine(self): """ @@ -2071,8 +2080,10 @@ self._transform.transform_path_non_affine(self._path) self._invalid = 0 return self._transform.transform_path_affine(self._transformed_path) + + def get_affine(self): + return self._transform.get_affine() - def nonsingular(vmin, vmax, expander=0.001, tiny=1e-15, increasing=True): ''' Ensure the endpoints of a range are not too close together. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2007-10-17 01:15:49
|
Revision: 3959 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3959&view=rev Author: jdh2358 Date: 2007-10-16 18:15:48 -0700 (Tue, 16 Oct 2007) Log Message: ----------- made a classes dir for course specific items Modified Paths: -------------- trunk/py4science/examples/distributions.py trunk/py4science/examples/logistic/maplib.pyc Added Paths: ----------- trunk/py4science/classes/ trunk/py4science/classes/course_checklist_umich.py trunk/py4science/classes/pomona_agenda.doc trunk/py4science/classes/pomona_agenda.txt Copied: trunk/py4science/classes/course_checklist_umich.py (from rev 3942, trunk/py4science/course_checklist_umich.py) =================================================================== --- trunk/py4science/classes/course_checklist_umich.py (rev 0) +++ trunk/py4science/classes/course_checklist_umich.py 2007-10-17 01:15:48 UTC (rev 3959) @@ -0,0 +1,15 @@ +#!/usr/bin/env python +"""Minimal test script to check for modules needed in python course""" + +modules = ['numpy','scipy','matplotlib','IPython'] + + +for mname in modules: + try: + exec "import %s" % mname + except ImportError: + print '*** ERROR: module %s could not be imported.' % mname + else: + print '%s: OK' % mname + +print 'Also remember to check that SPE is installed.' Added: trunk/py4science/classes/pomona_agenda.doc =================================================================== (Binary files differ) Property changes on: trunk/py4science/classes/pomona_agenda.doc ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/py4science/classes/pomona_agenda.txt =================================================================== --- trunk/py4science/classes/pomona_agenda.txt (rev 0) +++ trunk/py4science/classes/pomona_agenda.txt 2007-10-17 01:15:48 UTC (rev 3959) @@ -0,0 +1,45 @@ +DAY 1: + +Introduction: + + 35 min : Scientific computing in python (standard overhead talk) + + 45 min: The core tools -- ipython, numpy, matplotlib and scipy. (type along) + +Break: 15 min + +Exercises session 1: + + 45 min: Working with data files, web based resources, date handling, + CSV files, and record arrays. Word counting exercise. + (urllib, csv, dateutils, matplotlib.mlab) + + 45 min: Numerical integration, trapz and Newton's quadrature (scipy.integrate) + +Lunch Break: 45 min + +Exercises session 2: + + 45 min: Linear algebra: Moire Glass patterns + + 45 min: Statisical distributions, random numbers, central limit theorem (scipy.stats) + + 45 min: Descriptive statistics and graphs: mean, variance, skew, + kurtosis, histograms, autocorrelation, power spectra, + spectrogram (scipy.stats, matplotlib.mlab and pylab) + +Break: 15 min + +Exercises session 3: + + 60 min: Interpolation, data modeling and optimization (scipy.interpolate and scipy.optimize) + + 45 min: Using code from other languages (FORTRAN, C, C++) -- + Presentation (pyrex, weave, f2py, ctypes) + + +DAY 2: + +Exercise Session 4: + + 45 minutes: screen scraping - extracting data from web pages (BeautifulSoup) \ No newline at end of file Modified: trunk/py4science/examples/distributions.py =================================================================== --- trunk/py4science/examples/distributions.py 2007-10-16 19:39:57 UTC (rev 3958) +++ trunk/py4science/examples/distributions.py 2007-10-17 01:15:48 UTC (rev 3959) @@ -4,7 +4,7 @@ source using the random number generator. Verify the numerical results by plotting the analytical density functions from scipy.stats """ -import numpy +import numpy as npy import scipy.stats from pylab import figure, show, close @@ -18,14 +18,14 @@ # in each time interval, the probability of an emission rate = 20. # the emission rate in Hz -dx = 0.001 # the sampling interval in seconds -t = numpy.arange(N)*dx # the time vector +dt = 0.001 # the sampling interval in seconds +t = npy.arange(N)*dt # the time vector # the probability of an emission is proportionate to the rate and the interval -emit_times = t[uninse < rate*dx] +emit_times = t[uninse < rate*dt] # the difference in the emission times is the wait time -wait_times = numpy.diff(emit_times) +wait_times = npy.diff(emit_times) # plot the distribution of waiting times and the expected exponential # density function lambda exp( lambda wt) where lambda is the rate @@ -37,7 +37,7 @@ fig = figure() ax = fig.add_subplot(111) p, bins, patches = ax.hist(wait_times, 100, normed=True) -l1, = ax.plot(bins, rate*numpy.exp(-rate * bins), lw=2, color='red') +l1, = ax.plot(bins, rate*npy.exp(-rate * bins), lw=2, color='red') l2, = ax.plot(bins, scipy.stats.expon.pdf(bins, 0, 1./rate), lw=2, ls='--', color='green') ax.set_xlabel('waiting time') @@ -53,7 +53,7 @@ # gamma distribution. Use scipy.stats.gamma to compare the fits. # Hint: you can stride your emission times array to get every 2nd # emission -wait_times2 = numpy.diff(emit_times[::2]) +wait_times2 = npy.diff(emit_times[::2]) fig = figure() ax = fig.add_subplot(111) p, bins, patches = ax.hist(wait_times2, 100, normed=True) @@ -79,8 +79,8 @@ # variance expon_mean, expon_var = scipy.stats.expon(0, 1./rate).stats() mu, var = 10*expon_mean, 10*expon_var -sigma = numpy.sqrt(var) -wait_times10 = numpy.diff(emit_times[::10]) +sigma = npy.sqrt(var) +wait_times10 = npy.diff(emit_times[::10]) fig = figure() ax = fig.add_subplot(111) p, bins, patches = ax.hist(wait_times10, 100, normed=True) Modified: trunk/py4science/examples/logistic/maplib.pyc =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-10-16 19:40:09
|
Revision: 3958 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3958&view=rev Author: mdboom Date: 2007-10-16 12:39:57 -0700 (Tue, 16 Oct 2007) Log Message: ----------- figlegends work now. (Phew!) Rendering quality fixes drawing axis-aligned line segments in Agg. Modified Paths: -------------- branches/transforms/PASSED_DEMOS branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/backend_bases.py branches/transforms/lib/matplotlib/backends/backend_ps.py branches/transforms/lib/matplotlib/figure.py branches/transforms/lib/matplotlib/image.py branches/transforms/lib/matplotlib/legend.py branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/transforms.py branches/transforms/src/_backend_agg.cpp branches/transforms/src/_backend_agg.h Modified: branches/transforms/PASSED_DEMOS =================================================================== --- branches/transforms/PASSED_DEMOS 2007-10-16 14:41:29 UTC (rev 3957) +++ branches/transforms/PASSED_DEMOS 2007-10-16 19:39:57 UTC (rev 3958) @@ -35,26 +35,26 @@ color_demo.py O colours.py [???] contour_demo.py O -contourf_demo.py [FLOATING POINT EXCEPTION] -contour_image.py [FLOATING POINT EXCEPTION] +contourf_demo.py O +contour_image.py O coords_demo.py O coords_report.py O csd_demo.py O cursor_demo.py O -custom_figure_class.py [EXCEPT FOR PS OUTPUT] +custom_figure_class.py O customize_rc.py custom_ticker1.py O dannys_example.py [REQUIRES NUMERIC] dash_control.py O dashpointlabel.py O -dashtick.py +dashtick.py O data_browser.py O data_helper.py [N/A] date_demo1.py O date_demo2.py O -date_demo_convert.py O [PASSES] -date_demo_rrule.py O [PASSES] -date_index_formatter.py O [PASSES] +date_demo_convert.py O +date_demo_rrule.py O +date_index_formatter.py O dynamic_collection.py O dynamic_demo.py [GTK] dynamic_demo_wx.py [WX] @@ -77,7 +77,7 @@ errorbar_demo.py O errorbar_limits.py O figimage_demo.py O -figlegend_demo.py [HORRIBLY BROKEN] +figlegend_demo.py O figtext.py O fill_between_posneg.py O fill_between.py O @@ -94,7 +94,7 @@ glyph_to_path.py [Requires PIL] gradient_bar.py O gtk_spreadsheet.py -hatch_demo.py [Requires PS] +hatch_demo.py O histogram_demo_canvasagg.py [???] histogram_demo.py O image_demo2.py O Modified: branches/transforms/lib/matplotlib/axes.py =================================================================== --- branches/transforms/lib/matplotlib/axes.py 2007-10-16 14:41:29 UTC (rev 3957) +++ branches/transforms/lib/matplotlib/axes.py 2007-10-16 19:39:57 UTC (rev 3958) @@ -1248,7 +1248,10 @@ l, b, w, h = self.bbox.bounds # composite images need special args so they will not # respect z-order for now - renderer.draw_image(l, b, im, self.bbox) + renderer.draw_image( + l, b, im, self.bbox, + self.axesPatch.get_path(), + self.axesPatch.get_transform()) artists.extend(self.collections) artists.extend(self.patches) @@ -4379,6 +4382,7 @@ im.set_data(X) im.set_alpha(alpha) self._set_artist_props(im) + im.set_clip_path(self.axesPatch) #if norm is None and shape is None: # im.set_clim(vmin, vmax) if vmin is not None or vmax is not None: Modified: branches/transforms/lib/matplotlib/backend_bases.py =================================================================== --- branches/transforms/lib/matplotlib/backend_bases.py 2007-10-16 14:41:29 UTC (rev 3957) +++ branches/transforms/lib/matplotlib/backend_bases.py 2007-10-16 19:39:57 UTC (rev 3958) @@ -68,7 +68,7 @@ Nlinestyles = len(linestyles) Naa = len(antialiaseds) - if (Nfacecolors == 0 and Nedgecolors == 0) or N == 0: + if (Nfacecolors == 0 and Nedgecolors == 0) or Npaths == 0: return ttransforms = [] @@ -113,7 +113,7 @@ """ return 1.0 - def draw_image(self, x, y, im, bbox): + def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): """ Draw the Image instance into the current axes; x is the distance in pixels from the left hand side of the canvas. y is Modified: branches/transforms/lib/matplotlib/backends/backend_ps.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-10-16 14:41:29 UTC (rev 3957) +++ branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-10-16 19:39:57 UTC (rev 3958) @@ -371,7 +371,7 @@ """ return self.image_magnification - def draw_image(self, x, y, im, bbox): + def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): """ Draw the Image instance into the current axes; x is the distance in pixels from the left hand side of the canvas and y @@ -397,9 +397,16 @@ figh = self.height*72 #print 'values', origin, flipud, figh, h, y + clip = [] if bbox is not None: clipx,clipy,clipw,cliph = bbox.bounds - clip = '%s clipbox' % _nums_to_str(clipw, cliph, clipx, clipy) + clip.append('%s clipbox' % _nums_to_str(clipw, cliph, clipx, clipy)) + if clippath is not None: + print "clippath" + id = self._get_clip_path(clippath, clippath_trans) + clip.append('%s' % id) + clip = '\n'.join(clip) + #y = figh-(y+h) ps = """gsave %(clip)s @@ -507,7 +514,7 @@ Nlinestyles = len(linestyles) Naa = len(antialiaseds) - if (Nfacecolors == 0 and Nedgecolors == 0) or N == 0: + if (Nfacecolors == 0 and Nedgecolors == 0) or Npaths == 0: return for i in range(Ntpaths): Modified: branches/transforms/lib/matplotlib/figure.py =================================================================== --- branches/transforms/lib/matplotlib/figure.py 2007-10-16 14:41:29 UTC (rev 3957) +++ branches/transforms/lib/matplotlib/figure.py 2007-10-16 19:39:57 UTC (rev 3958) @@ -627,7 +627,8 @@ ims) im.is_grayscale = False l, b, w, h = self.bbox.bounds - renderer.draw_image(l, b, im, self.bbox) + renderer.draw_image(l, b, im, self.bbox, + *self.get_transformed_clip_path_and_affine()) # render the axes @@ -702,7 +703,6 @@ handles = flatten(handles) l = Legend(self, handles, labels, *args, **kwargs) - self._set_artist_props(l) self.legends.append(l) return l Modified: branches/transforms/lib/matplotlib/image.py =================================================================== --- branches/transforms/lib/matplotlib/image.py 2007-10-16 14:41:29 UTC (rev 3957) +++ branches/transforms/lib/matplotlib/image.py 2007-10-16 19:39:57 UTC (rev 3958) @@ -181,7 +181,8 @@ if not self.get_visible(): return im = self.make_image(renderer.get_image_magnification()) l, b, widthDisplay, heightDisplay = self.axes.bbox.bounds - renderer.draw_image(l, b, im, self.axes.bbox.frozen()) + renderer.draw_image(l, b, im, self.axes.bbox.frozen(), + *self.get_transformed_clip_path_and_affine()) def contains(self, mouseevent): """Test whether the mouse event occured within the image. @@ -481,7 +482,8 @@ def draw(self, renderer, *args, **kwargs): if not self.get_visible(): return im = self.make_image() - renderer.draw_image(self.ox, self.oy, im, self.figure.bbox) + renderer.draw_image(self.ox, self.oy, im, self.figure.bbox, + *self.get_transformed_clip_path_and_affine()) def write_png(self, fname): """Write the image to png file with fname""" Modified: branches/transforms/lib/matplotlib/legend.py =================================================================== --- branches/transforms/lib/matplotlib/legend.py 2007-10-16 14:41:29 UTC (rev 3957) +++ branches/transforms/lib/matplotlib/legend.py 2007-10-16 19:39:57 UTC (rev 3958) @@ -165,7 +165,8 @@ raise TypeError("Legend needs either Axes or Figure as parent") self.parent = parent self._offsetTransform = Affine2D() - self.set_transform( self._offsetTransform + BboxTransform(Bbox.unit(), parent.bbox) ) + self._parentTransform = BboxTransform(Bbox.unit(), parent.bbox) + Artist.set_transform(self, self._offsetTransform + self._parentTransform) if loc is None: loc = rcParams["legend.loc"] @@ -192,6 +193,12 @@ self._loc = loc + self.legendPatch = Rectangle( + xy=(0.0, 0.0), width=0.5, height=0.5, + facecolor='w', edgecolor='k', + ) + self._set_artist_props(self.legendPatch) + # make a trial box in the middle of the axes. relocate it # based on it's bbox left, top = 0.5, 0.5 @@ -203,20 +210,6 @@ self.texts = self._get_texts(labels, textleft, top) self.legendHandles = self._get_handles(handles, self.texts) - - if len(self.texts): - left, top = self.texts[-1].get_position() - HEIGHT = self._approx_text_height()*len(self.texts) - else: - HEIGHT = 0.2 - - bottom = top-HEIGHT - left -= self.handlelen + self.handletextsep + self.pad - self.legendPatch = Rectangle( - xy=(left, bottom), width=0.5, height=HEIGHT, - facecolor='w', edgecolor='k', - ) - self._set_artist_props(self.legendPatch) self._drawFrame = True def _set_artist_props(self, a): @@ -282,6 +275,7 @@ legline.update_from(handle) self._set_artist_props(legline) # after update legline.set_clip_box(None) + legline.set_clip_path(self.legendPatch) legline.set_markersize(self.markerscale*legline.get_markersize()) ret.append(legline) @@ -293,12 +287,14 @@ p.update_from(handle) self._set_artist_props(p) p.set_clip_box(None) + p.set_clip_path(self.legendPatch) ret.append(p) elif isinstance(handle, LineCollection): ydata = (y-HEIGHT/2)*npy.ones(self._xdata.shape, float) legline = Line2D(self._xdata, ydata) self._set_artist_props(legline) legline.set_clip_box(None) + legline.set_clip_path(self.legendPatch) lw = handle.get_linewidth()[0] dashes = handle.get_dashes() color = handle.get_colors()[0] @@ -316,6 +312,7 @@ p.set_edgecolor(handle._edgecolors[0]) self._set_artist_props(p) p.set_clip_box(None) + p.set_clip_path(self.legendPatch) ret.append(p) else: @@ -536,7 +533,7 @@ handle.set_height(h/2) # Set the data for the legend patch - bbox = self._get_handle_text_bbox(renderer).frozen() + bbox = self._get_handle_text_bbox(renderer) bbox = bbox.expanded(1 + self.pad, 1 + self.pad) l, b, w, h = bbox.bounds Modified: branches/transforms/lib/matplotlib/lines.py =================================================================== --- branches/transforms/lib/matplotlib/lines.py 2007-10-16 14:41:29 UTC (rev 3957) +++ branches/transforms/lib/matplotlib/lines.py 2007-10-16 19:39:57 UTC (rev 3958) @@ -748,7 +748,7 @@ def _draw_diamond(self, renderer, gc, path, path_trans): side = renderer.points_to_pixels(self._markersize) - transform = Affine2D().translate(0.5, 0.5).rotate_deg(45).scale(side) + transform = Affine2D().translate(-0.5, -0.5).rotate_deg(45).scale(side) rgbFace = self._get_rgb_face() renderer.draw_markers(gc, Path.unit_rectangle(), transform, path, path_trans, rgbFace) @@ -756,8 +756,8 @@ def _draw_thin_diamond(self, renderer, gc, path, path_trans): offset = renderer.points_to_pixels(self._markersize) - transform = Affine2D().translate(0.5, 0.5) \ - .rotate_deg(45).scale(offset * 0.8, offset) + transform = Affine2D().translate(-0.5, -0.5) \ + .rotate_deg(45).scale(offset * 0.6, offset) rgbFace = self._get_rgb_face() renderer.draw_markers(gc, Path.unit_rectangle(), transform, path, path_trans, rgbFace) Modified: branches/transforms/lib/matplotlib/transforms.py =================================================================== --- branches/transforms/lib/matplotlib/transforms.py 2007-10-16 14:41:29 UTC (rev 3957) +++ branches/transforms/lib/matplotlib/transforms.py 2007-10-16 19:39:57 UTC (rev 3958) @@ -822,7 +822,7 @@ raise TypeError( "Can not add Transform to object of type '%s'" % type(other)) - def __array__(self): + def __array__(self, *args, **kwargs): """ Used by C/C++ -based backends to get at the array matrix data. """ Modified: branches/transforms/src/_backend_agg.cpp =================================================================== --- branches/transforms/src/_backend_agg.cpp 2007-10-16 14:41:29 UTC (rev 3957) +++ branches/transforms/src/_backend_agg.cpp 2007-10-16 19:39:57 UTC (rev 3958) @@ -99,7 +99,7 @@ the C++ representation as a std::vector<std::pair<double, double> > (GCAgg::dash_t) */ -void convert_dashes(const Py::Tuple& dashes, bool snap, double dpi, GCAgg::dash_t& dashes_out, +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()); @@ -124,10 +124,6 @@ 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; - if (snap) { - val0 = (int)val0 + 0.5; - val1 = (int)val1 + 0.5; - } dashes_out.push_back(std::make_pair(val0, val1)); } } @@ -143,8 +139,6 @@ conv_quantize(VertexSource& source, bool quantize) : m_source(&source), m_quantize(quantize) {} - void set_source(VertexSource& source) { m_source = &source; } - void rewind(unsigned path_id) { m_source->rewind(path_id); } @@ -158,18 +152,14 @@ return cmd; } - void activate(bool quantize) { - m_quantize = quantize; - } - private: VertexSource* m_source; bool m_quantize; }; -GCAgg::GCAgg(const Py::Object &gc, double dpi, bool snapto) : - dpi(dpi), snapto(snapto), isaa(true), linewidth(1.0), alpha(1.0), +GCAgg::GCAgg(const Py::Object &gc, double dpi) : + dpi(dpi), isaa(true), linewidth(1.0), alpha(1.0), dashOffset(0.0) { _VERBOSE("GCAgg::GCAgg"); @@ -184,8 +174,8 @@ _set_clip_path(gc); } -GCAgg::GCAgg(double dpi, bool snapto) : - dpi(dpi), snapto(snapto), isaa(true), linewidth(1.0), alpha(1.0), +GCAgg::GCAgg(double dpi) : + dpi(dpi), isaa(true), linewidth(1.0), alpha(1.0), dashOffset(0.0) { @@ -260,7 +250,7 @@ return; } - convert_dashes(dash_obj, snapto, dpi, dashes, dashOffset); + convert_dashes(dash_obj, dpi, dashes, dashOffset); } void @@ -435,17 +425,31 @@ bool should_snap(Path& path, const agg::trans_affine& trans) { // If this is a straight horizontal or vertical line, quantize to nearest // pixels - bool snap = false; - if (path.total_vertices() == 2) { - double x0, y0, x1, y1; - path.vertex(0, &x0, &y0); - trans.transform(&x0, &y0); - path.vertex(1, &x1, &y1); + double x0, y0, x1, y1; + unsigned code; + code = path.vertex(&x0, &y0); + trans.transform(&x0, &y0); + + while ((code = path.vertex(&x1, &y1)) != agg::path_cmd_stop) { + + switch (code) { + case agg::path_cmd_curve3: + case agg::path_cmd_curve4: + path.rewind(0); + return false; + } + trans.transform(&x1, &y1); - snap = (fabs(x0 - x1) < 1.0 || fabs(y0 - y1) < 1.0); + if (!(fabs(x0 - x1) < 0.1 || fabs(y0 - y1) < 0.1)) { + path.rewind(0); + return false; + } + x0 = x1; + y0 = y1; } - return snap; + path.rewind(0); + return true; } Py::Object @@ -563,10 +567,10 @@ curve_t marker_path_curve(marker_path_transformed); PathIterator path(path_obj); + bool snap = should_snap(path, trans); transformed_path_t path_transformed(path, trans); - // bool snap = should_snap(path, trans); - GCAgg gc = GCAgg(gc_obj, dpi, true); - quantize_t path_quantized(path_transformed, true); + GCAgg gc = GCAgg(gc_obj, dpi); + quantize_t path_quantized(path_transformed, snap); path_quantized.rewind(0); facepair_t face = _get_rgba_face(face_obj, gc.alpha); @@ -793,31 +797,37 @@ Py::Object RendererAgg::draw_image(const Py::Tuple& args) { _VERBOSE("RendererAgg::draw_image"); - args.verify_length(4); + args.verify_length(4, 6); float x = Py::Float(args[0]); float y = Py::Float(args[1]); Image *image = static_cast<Image*>(args[2].ptr()); Py::Object box_obj = args[3]; - + Py::Object clippath; + agg::trans_affine clippath_trans; + if (args.size() == 6) { + clippath = args[4]; + clippath_trans = py_to_agg_transformation_matrix(args[5]); + } + theRasterizer->reset_clipping(); rendererBase->reset_clipping(true); set_clipbox(box_obj, rendererBase); - + + Py::Tuple empty; pixfmt pixf(*(image->rbufOut)); - - - Py::Tuple empty; image->flipud_out(empty); + rendererBase->blend_from(pixf, 0, (int)x, (int)(height-(y+image->rowsOut))); + image->flipud_out(empty); return Py::Object(); } void RendererAgg::_draw_path(PathIterator& path, agg::trans_affine trans, - bool snap, bool has_clippath, - const facepair_t& face, const GCAgg& gc) { + bool has_clippath, const facepair_t& face, + const GCAgg& gc) { typedef agg::conv_transform<PathIterator> transformed_path_t; typedef conv_quantize<transformed_path_t> quantize_t; typedef agg::conv_curve<quantize_t> curve_t; @@ -833,6 +843,7 @@ trans *= agg::trans_affine_translation(0.0, (double)height); // Build the transform stack + bool snap = should_snap(path, trans); transformed_path_t tpath(path, trans); quantize_t quantized(tpath, snap); // Benchmarking shows that there is no noticable slowdown to always @@ -871,25 +882,36 @@ // Render stroke if (gc.linewidth != 0.0) { + double linewidth = gc.linewidth; + if (snap) + linewidth = round(linewidth); + if (gc.dashes.size() == 0) { stroke_t stroke(curve); - stroke.width(gc.linewidth); + stroke.width(linewidth); stroke.line_cap(gc.cap); stroke.line_join(gc.join); theRasterizer->add_path(stroke); } else { dash_t dash(curve); for (GCAgg::dash_t::const_iterator i = gc.dashes.begin(); - i != gc.dashes.end(); ++i) - dash.add_dash(i->first, i->second); + i != gc.dashes.end(); ++i) { + double val0 = i->first; + double val1 = i->second; + if (snap) { + val0 = (int)val0 + 0.5; + val1 = (int)val1 + 0.5; + } + dash.add_dash(val0, val1); + } stroke_dash_t stroke(dash); stroke.line_cap(gc.cap); stroke.line_join(gc.join); - stroke.width(gc.linewidth); + stroke.width(linewidth); theRasterizer->add_path(stroke); } - if (gc.isaa && !(snap && gc.linewidth < 1.5)) { + if (gc.isaa && !(snap)) { if (has_clippath) { pixfmt_amask_type pfa(*pixFmt, *alphaMask); amask_ren_type r(pfa); @@ -928,8 +950,7 @@ face_obj = args[3]; PathIterator path(path_obj); - bool snap = should_snap(path, trans); - GCAgg gc = GCAgg(gc_obj, dpi, snap); + GCAgg gc = GCAgg(gc_obj, dpi); facepair_t face = _get_rgba_face(face_obj, gc.alpha); theRasterizer->reset_clipping(); @@ -937,7 +958,7 @@ set_clipbox(gc.cliprect, theRasterizer); bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans); - _draw_path(path, trans, snap, has_clippath, face, gc); + _draw_path(path, trans, has_clippath, face, gc); return Py::Object(); } @@ -962,7 +983,7 @@ Py::SeqBase<Py::Object> linestyles_obj = args[11]; Py::SeqBase<Py::Int> antialiaseds = args[12]; - GCAgg gc(dpi, false); + GCAgg gc(dpi); PyArrayObject* offsets = NULL; PyArrayObject* facecolors = NULL; @@ -973,13 +994,15 @@ if (!offsets || offsets->dimensions[1] != 2) throw Py::ValueError("Offsets array must be Nx2"); - PyArrayObject* facecolors = (PyArrayObject*)PyArray_FromObject(facecolors_obj.ptr(), PyArray_DOUBLE, 1, 2); + PyArrayObject* facecolors = (PyArrayObject*)PyArray_FromObject + (facecolors_obj.ptr(), PyArray_DOUBLE, 1, 2); if (!facecolors || (facecolors->nd == 1 && facecolors->dimensions[0] != 0) || (facecolors->nd == 2 && facecolors->dimensions[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); + PyArrayObject* edgecolors = (PyArrayObject*)PyArray_FromObject + (edgecolors_obj.ptr(), PyArray_DOUBLE, 1, 2); if (!edgecolors || (edgecolors->nd == 1 && edgecolors->dimensions[0] != 0) || (edgecolors->nd == 2 && edgecolors->dimensions[1] != 4)) @@ -995,10 +1018,10 @@ size_t Nlinestyles = std::min(linestyles_obj.length(), N); size_t Naa = antialiaseds.length(); - if ((Nfacecolors == 0 && Nedgecolors == 0) || N == 0) + 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; @@ -1018,7 +1041,7 @@ i = 0; for (dashes_t::iterator d = dashes.begin(); d != dashes.end(); ++d, ++i) { - convert_dashes(Py::Tuple(linestyles_obj[i]), false, dpi, d->second, d->first); + convert_dashes(Py::Tuple(linestyles_obj[i]), dpi, d->second, d->first); } // Handle any clipping globally @@ -1034,34 +1057,34 @@ for (i = 0; i < N; ++i) { PathIterator path(paths[i % Npaths]); - bool snap = (path.total_vertices() == 2); - double xo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 0); - double yo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 1); + double xo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 0); + double yo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 1); offset_trans.transform(&xo, &yo); agg::trans_affine_translation transOffset(xo, yo); agg::trans_affine& trans = transforms[i % Ntransforms]; 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)); + 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)); } if (Nedgecolors) { 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)); - gc.linewidth = double(Py::Float(linewidths[i % Nlinewidths])) * dpi/72.0; - gc.dashes = dashes[i % Nlinestyles].second; - gc.dashOffset = dashes[i % Nlinestyles].first; + 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)); + gc.linewidth = double(Py::Float(linewidths[i % Nlinewidths])) * dpi/72.0; + gc.dashes = dashes[i % Nlinestyles].second; + gc.dashOffset = dashes[i % Nlinestyles].first; } - gc.isaa = bool(Py::Int(antialiaseds[i % Naa])); - _draw_path(path, trans * transOffset, snap, has_clippath, face, gc); + gc.isaa = bool(Py::Int(antialiaseds[i % Naa])); + + _draw_path(path, trans * transOffset, has_clippath, face, gc); } } catch (...) { Py_XDECREF(offsets); Modified: branches/transforms/src/_backend_agg.h =================================================================== --- branches/transforms/src/_backend_agg.h 2007-10-16 14:41:29 UTC (rev 3957) +++ branches/transforms/src/_backend_agg.h 2007-10-16 19:39:57 UTC (rev 3958) @@ -109,11 +109,10 @@ class GCAgg { public: - GCAgg(const Py::Object& gc, double dpi, bool snapto=false); - GCAgg(double dpi, bool snapto=false); + GCAgg(const Py::Object& gc, double dpi); + GCAgg(double dpi); double dpi; - bool snapto; bool isaa; agg::line_cap_e cap; @@ -219,8 +218,7 @@ void set_clipbox(Py::Object& cliprect, R rasterizer); bool render_clippath(const Py::Object& clippath, const agg::trans_affine& clippath_trans); void _draw_path(PathIterator& path, agg::trans_affine trans, - bool snap, bool has_clippath, - const facepair_t& face, const GCAgg& gc); + bool has_clippath, const facepair_t& face, const GCAgg& gc); private: Py::Object lastclippath; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-10-16 14:41:37
|
Revision: 3957 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3957&view=rev Author: mdboom Date: 2007-10-16 07:41:29 -0700 (Tue, 16 Oct 2007) Log Message: ----------- Fixing mistake in last merge Modified Paths: -------------- branches/transforms/lib/matplotlib/patches.py Modified: branches/transforms/lib/matplotlib/patches.py =================================================================== --- branches/transforms/lib/matplotlib/patches.py 2007-10-16 14:35:12 UTC (rev 3956) +++ branches/transforms/lib/matplotlib/patches.py 2007-10-16 14:41:29 UTC (rev 3957) @@ -771,32 +771,6 @@ """ A scale-free ellipse """ - offset = 4.0 * (npy.sqrt(2) - 1) / 3.0 - - circle = npy.array([ - [-1.0, 0.0], - - [-1.0, offset], - [-offset, 1.0], - [0.0, 1.0], - - [offset, 1.0], - [1.0, offset], - [1.0, 0.0], - - [1.0, -offset], - [offset, -1.0], - [0.0, -1.0], - - [-offset, -1.0], - [-1.0, -offset], - [-1.0, 0.0], - - [-1.0, 0.0] - ], - npy.float_) - - def __str__(self): return "Ellipse(%d,%d;%dx%d)"%(self.center[0],self.center[1],self.width,self.height) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-10-16 14:35:18
|
Revision: 3956 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3956&view=rev Author: mdboom Date: 2007-10-16 07:35:12 -0700 (Tue, 16 Oct 2007) Log Message: ----------- Merged revisions 3933-3955 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib ........ r3935 | mdboom | 2007-10-11 13:03:50 -0400 (Thu, 11 Oct 2007) | 1 line Fixed minor import bug ........ r3941 | jdh2358 | 2007-10-14 15:00:50 -0400 (Sun, 14 Oct 2007) | 1 line added ellipse compare script ........ r3949 | jdh2358 | 2007-10-15 16:00:54 -0400 (Mon, 15 Oct 2007) | 3 lines fixed an aspect=auto problem with bezier ellipse approx ........ r3950 | jdh2358 | 2007-10-15 16:52:32 -0400 (Mon, 15 Oct 2007) | 2 lines Fixed a texst clipping bug in backend agg ........ r3951 | jdh2358 | 2007-10-15 17:08:35 -0400 (Mon, 15 Oct 2007) | 2 lines Fixed an annotation unit bug ........ r3952 | jdh2358 | 2007-10-15 17:22:03 -0400 (Mon, 15 Oct 2007) | 2 lines fixed a unit problem with annotations ........ r3953 | mdboom | 2007-10-16 08:28:49 -0400 (Tue, 16 Oct 2007) | 1 line Fix build on Windows with MSVC .NET 2003 ........ r3954 | jdh2358 | 2007-10-16 09:45:59 -0400 (Tue, 16 Oct 2007) | 2 lines restored unit support for ellipses -- and added examples/units/ellipse_with_units.py ........ Modified Paths: -------------- branches/transforms/CHANGELOG branches/transforms/boilerplate.py branches/transforms/lib/matplotlib/backends/backend_ps.py branches/transforms/lib/matplotlib/cbook.py branches/transforms/lib/matplotlib/mlab.py branches/transforms/lib/matplotlib/patches.py branches/transforms/lib/matplotlib/text.py branches/transforms/src/_backend_agg.cpp branches/transforms/ttconv/ttutil.cpp branches/transforms/unit/ellipse_compare.py Added Paths: ----------- branches/transforms/examples/units/annotate_with_units.py branches/transforms/examples/units/ellipse_with_units.py Property Changed: ---------------- branches/transforms/ Property changes on: branches/transforms ___________________________________________________________________ Name: svnmerge-integrated - /trunk/matplotlib:1-3932 + /trunk/matplotlib:1-3955 Modified: branches/transforms/CHANGELOG =================================================================== --- branches/transforms/CHANGELOG 2007-10-16 14:17:53 UTC (rev 3955) +++ branches/transforms/CHANGELOG 2007-10-16 14:35:12 UTC (rev 3956) @@ -1,3 +1,12 @@ +2007-10-15 Fixed a bug in patches.Ellipse that was broken for + aspect='auto'. Scale free ellipses now work properly for + equal and auto on Agg and PS, and they fall back on a + polygonal approximation for nonlinear transformations until + we convince oursleves that the spline approximation holds + for nonlinear transformations. Added + unit/ellipse_compare.py to compare spline with vertex + approx for both aspects. JDH + 2007-10-05 remove generator expressions from texmanager and mpltraits. generator expressions are not supported by python-2.3 - DSD Modified: branches/transforms/boilerplate.py =================================================================== --- branches/transforms/boilerplate.py 2007-10-16 14:17:53 UTC (rev 3955) +++ branches/transforms/boilerplate.py 2007-10-16 14:35:12 UTC (rev 3956) @@ -2,10 +2,9 @@ # file is pasted into pylab.py. We did try to do this the smart way, # with callable functions and new.function, but could never get the # docstrings right for python2.2. See -# http://groups-beta.google.com/group/comp.lang.python/messages/1b14640f3a4ad3dc,b3d7453af21e5f82,17739e70ac6f710c,9d5291fce29cbbb1,c5b578e4ffc6af28,056ff270daa2f414?thread_id=dcd63ec13096a0f6&mode=thread +# http://groups.google.com/group/comp.lang.python/browse_frm/thread/dcd63ec13096a0f6/1b14640f3a4ad3dc?#1b14640f3a4ad3dc - # note we check for __doc__ is not None since py2exe optimize removes # the docstrings Copied: branches/transforms/examples/units/annotate_with_units.py (from rev 3954, trunk/matplotlib/examples/units/annotate_with_units.py) =================================================================== --- branches/transforms/examples/units/annotate_with_units.py (rev 0) +++ branches/transforms/examples/units/annotate_with_units.py 2007-10-16 14:35:12 UTC (rev 3956) @@ -0,0 +1,27 @@ + +import pylab +from basic_units import cm + +fig = pylab.figure() +ax = fig.add_subplot(111) + + +ax.annotate( "Note 01", [0.5*cm, 0.5*cm] ) + +# xy and text both unitized +ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data', + xytext=(0.8*cm, 0.95*cm), textcoords='data', + arrowprops=dict(facecolor='black', shrink=0.05), + horizontalalignment='right', verticalalignment='top') + +# mixing units w/ nonunits +ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data', + xytext=(0.8, 0.95), textcoords='axes fraction', + arrowprops=dict(facecolor='black', shrink=0.05), + horizontalalignment='right', verticalalignment='top') + + +ax.set_xlim(0*cm, 4*cm) +ax.set_ylim(0*cm, 4*cm) +pylab.show() + Copied: branches/transforms/examples/units/ellipse_with_units.py (from rev 3954, trunk/matplotlib/examples/units/ellipse_with_units.py) =================================================================== --- branches/transforms/examples/units/ellipse_with_units.py (rev 0) +++ branches/transforms/examples/units/ellipse_with_units.py 2007-10-16 14:35:12 UTC (rev 3956) @@ -0,0 +1,49 @@ +""" +Compare the ellipse generated with arcs versus a polygonal approximation +""" +from basic_units import cm +import numpy as npy +from matplotlib import patches +from pylab import figure, show + +xcenter, ycenter = 0.38*cm, 0.52*cm +#xcenter, ycenter = 0., 0. +width, height = 1e-1*cm, 3e-1*cm +angle = -30 + +theta = npy.arange(0.0, 360.0, 1.0)*npy.pi/180.0 +x = 0.5 * width * npy.cos(theta) +y = 0.5 * height * npy.sin(theta) + +rtheta = angle*npy.pi/180. +R = npy.array([ + [npy.cos(rtheta), -npy.sin(rtheta)], + [npy.sin(rtheta), npy.cos(rtheta)], + ]) + + +x, y = npy.dot(R, npy.array([x, y])) +x += xcenter +y += ycenter + +fig = figure() +ax = fig.add_subplot(211, aspect='auto') +ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) + +e1 = patches.Ellipse((xcenter, ycenter), width, height, + angle=angle, linewidth=2, fill=False, zorder=2) + +ax.add_patch(e1) + +ax = fig.add_subplot(212, aspect='equal') +ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1) +e2 = patches.Ellipse((xcenter, ycenter), width, height, + angle=angle, linewidth=2, fill=False, zorder=2) + + +ax.add_patch(e2) + +#fig.savefig('ellipse_compare.png') +fig.savefig('ellipse_compare') + +show() Modified: branches/transforms/lib/matplotlib/backends/backend_ps.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-10-16 14:17:53 UTC (rev 3955) +++ branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-10-16 14:35:12 UTC (rev 3956) @@ -331,7 +331,7 @@ size = prop.get_size_in_points() font.set_size(size, 72.0) return font - + def _rgba(self, im): return im.as_rgba_str() @@ -398,7 +398,7 @@ #print 'values', origin, flipud, figh, h, y if bbox is not None: - clipx,clipy,clipw,cliph = bbox.get_bounds() + clipx,clipy,clipw,cliph = bbox.bounds clip = '%s clipbox' % _nums_to_str(clipw, cliph, clipx, clipy) #y = figh-(y+h) ps = """gsave @@ -1425,5 +1425,15 @@ box clip newpath - } bind def""" + } bind def""", + """/unitcircle { + newpath +-1. 0. moveto +-1.0 0.552284749831 -0.552284749831 1.0 0.0 1.0 curveto +0.552284749831 1.0 1.0 0.552284749831 1.0 0.0 curveto +1.0 -0.552284749831 0.552284749831 -1.0 0.0 -1.0 curveto +-0.552284749831 -1.0 -1.0 -0.552284749831 -1.0 0.0 curveto +closepath + } bind def""", + ] Modified: branches/transforms/lib/matplotlib/cbook.py =================================================================== --- branches/transforms/lib/matplotlib/cbook.py 2007-10-16 14:17:53 UTC (rev 3955) +++ branches/transforms/lib/matplotlib/cbook.py 2007-10-16 14:35:12 UTC (rev 3956) @@ -232,17 +232,18 @@ except TypeError: return False else: return True -def to_filehandle(fname): +def to_filehandle(fname, flag='r'): """ fname can be a filename or a file handle. Support for gzipped - files is automatic, if the filename ends in .gz + files is automatic, if the filename ends in .gz. flag is a + read/write flag for file """ if is_string_like(fname): if fname.endswith('.gz'): import gzip - fh = gzip.open(fname) + fh = gzip.open(fname, flag) else: - fh = file(fname) + fh = file(fname, flag) elif hasattr(fname, 'seek'): fh = fname else: Modified: branches/transforms/lib/matplotlib/mlab.py =================================================================== --- branches/transforms/lib/matplotlib/mlab.py 2007-10-16 14:17:53 UTC (rev 3955) +++ branches/transforms/lib/matplotlib/mlab.py 2007-10-16 14:35:12 UTC (rev 3956) @@ -809,6 +809,8 @@ If p is a scalar, the largest value of x less than or equal to the p percentage point in the sequence is returned. """ + + x = npy.ravel(x) x.sort() Nx = len(x) @@ -1282,7 +1284,10 @@ converterd, if not None, is a dictionary mapping column number or munged column name to a converter function - See examples/loadrec.py + names, if not None, is a list of header names. In this case, no + header will be read from the file + + if no rows are found, None is returned See examples/loadrec.py """ if converterd is None: @@ -1291,9 +1296,42 @@ import dateutil.parser parsedate = dateutil.parser.parse + fh = cbook.to_filehandle(fname) - reader = csv.reader(fh, delimiter=delimiter) + + class FH: + """ + for space delimited files, we want different behavior than + comma or tab. Generally, we want multiple spaces to be + treated as a single separator, whereas with comma and tab we + want multiple commas to return multiple (empty) fields. The + join/strip trick below effects this + """ + def __init__(self, fh): + self.fh = fh + + def close(self): + self.fh.close() + + def seek(self, arg): + self.fh.seek(arg) + + def fix(self, s): + return ' '.join(s.split()) + + + def next(self): + return self.fix(self.fh.next()) + + def __iter__(self): + for line in self.fh: + yield self.fix(line) + + if delimiter==' ': + fh = FH(fh) + + reader = csv.reader(fh, delimiter=delimiter) def process_skiprows(reader): if skiprows: for i, row in enumerate(reader): @@ -1388,9 +1426,131 @@ rows.append([func(val) for func, val in zip(converters, row)]) fh.close() + if not len(rows): + return None r = npy.rec.fromrecords(rows, names=names) return r + +def rec2csv(r, fname, delimiter=','): + """ + Save the data from numpy record array r into a comma/space/tab + delimited file. The record array dtype names will be used for + column headers. + + + fname - can be a filename or a file handle. Support for gzipped + files is automatic, if the filename ends in .gz + """ + fh = cbook.to_filehandle(fname, 'w') + writer = csv.writer(fh, delimiter=delimiter) + header = r.dtype.names + writer.writerow(header) + for row in r: + writer.writerow(map(str, row)) + fh.close() + +# some record array helpers +def rec_append_field(rec, name, arr, dtype=None): + 'return a new record array with field name populated with data from array arr' + arr = npy.asarray(arr) + if dtype is None: + dtype = arr.dtype + newdtype = npy.dtype(rec.dtype.descr + [(name, dtype)]) + newrec = npy.empty(rec.shape, dtype=newdtype) + for field in rec.dtype.fields: + newrec[field] = rec[field] + newrec[name] = arr + return newrec.view(npy.recarray) + + +def rec_drop_fields(rec, names): + 'return a new numpy record array with fields in names dropped' + + names = set(names) + Nr = len(rec) + + newdtype = npy.dtype([(name, rec.dtype[name]) for name in rec.dtype.names + if name not in names]) + + newrec = npy.empty(Nr, dtype=newdtype) + for field in newdtype.names: + newrec[field] = rec[field] + + return newrec.view(npy.recarray) + + +def rec_join(key, r1, r2): + """ + join record arrays r1 and r2 on key; key is a tuple of field + names. if r1 and r2 have equal values on all the keys in the key + tuple, then their fields will be merged into a new record array + containing the union of the fields of r1 and r2 + """ + + for name in key: + if name not in r1.dtype.names: + raise ValueError('r1 does not have key field %s'%name) + if name not in r2.dtype.names: + raise ValueError('r2 does not have key field %s'%name) + + def makekey(row): + return tuple([row[name] for name in key]) + + + names = list(r1.dtype.names) + [name for name in r2.dtype.names if name not in set(r1.dtype.names)] + + + + r1d = dict([(makekey(row),i) for i,row in enumerate(r1)]) + r2d = dict([(makekey(row),i) for i,row in enumerate(r2)]) + + r1keys = set(r1d.keys()) + r2keys = set(r2d.keys()) + + keys = r1keys & r2keys + + r1ind = [r1d[k] for k in keys] + r2ind = [r2d[k] for k in keys] + + + r1 = r1[r1ind] + r2 = r2[r2ind] + + r2 = rec_drop_fields(r2, r1.dtype.names) + + + def key_desc(name): + 'if name is a string key, use the larger size of r1 or r2 before merging' + dt1 = r1.dtype[name] + if dt1.type != npy.string_: + return (name, dt1.descr[0][1]) + + dt2 = r1.dtype[name] + assert dt2==dt1 + if dt1.num>dt2.num: + return (name, dt1.descr[0][1]) + else: + return (name, dt2.descr[0][1]) + + + + keydesc = [key_desc(name) for name in key] + + newdtype = npy.dtype(keydesc + + [desc for desc in r1.dtype.descr if desc[0] not in key ] + + [desc for desc in r2.dtype.descr if desc[0] not in key ] ) + + + newrec = npy.empty(len(r1), dtype=newdtype) + for field in r1.dtype.names: + newrec[field] = r1[field] + + for field in r2.dtype.names: + newrec[field] = r2[field] + + return newrec.view(npy.recarray) + def slopes(x,y): """ SLOPES calculate the slope y'(x) Given data vectors X and Y SLOPES Modified: branches/transforms/lib/matplotlib/patches.py =================================================================== --- branches/transforms/lib/matplotlib/patches.py 2007-10-16 14:17:53 UTC (rev 3955) +++ branches/transforms/lib/matplotlib/patches.py 2007-10-16 14:35:12 UTC (rev 3956) @@ -771,6 +771,32 @@ """ A scale-free ellipse """ + offset = 4.0 * (npy.sqrt(2) - 1) / 3.0 + + circle = npy.array([ + [-1.0, 0.0], + + [-1.0, offset], + [-offset, 1.0], + [0.0, 1.0], + + [offset, 1.0], + [1.0, offset], + [1.0, 0.0], + + [1.0, -offset], + [offset, -1.0], + [0.0, -1.0], + + [-offset, -1.0], + [-1.0, -offset], + [-1.0, 0.0], + + [-1.0, 0.0] + ], + npy.float_) + + def __str__(self): return "Ellipse(%d,%d;%dx%d)"%(self.center[0],self.center[1],self.width,self.height) @@ -807,8 +833,8 @@ if ev.x is None or ev.y is None: return False,{} x, y = self.get_transform().inverted().transform_point((ev.x, ev.y)) return (x*x + y*y) <= 1.0, {} + - class Circle(Ellipse): """ A circle patch Modified: branches/transforms/lib/matplotlib/text.py =================================================================== --- branches/transforms/lib/matplotlib/text.py 2007-10-16 14:17:53 UTC (rev 3955) +++ branches/transforms/lib/matplotlib/text.py 2007-10-16 14:35:12 UTC (rev 3956) @@ -1041,6 +1041,8 @@ def _get_xy(self, x, y, s): if s=='data': trans = self.axes.transData + x = float(self.convert_xunits(x)) + y = float(self.convert_yunits(y)) return trans.transform_point((x, y)) elif s=='polar': theta, r = x, y Modified: branches/transforms/src/_backend_agg.cpp =================================================================== --- branches/transforms/src/_backend_agg.cpp 2007-10-16 14:17:53 UTC (rev 3955) +++ branches/transforms/src/_backend_agg.cpp 2007-10-16 14:35:12 UTC (rev 3956) @@ -653,7 +653,6 @@ } - /** * This is a custom span generator that converts spans in the * 8-bit inverted greyscale font buffer to rgba that agg can use. @@ -776,11 +775,16 @@ srcbuf, 0, interpolator, filter); span_gen_type output_span_generator(&image_span_generator, gc.color); renderer_type ri(*rendererBase, output_span_generator); - agg::rasterizer_scanline_aa<> rasterizer; - agg::scanline_p8 scanline; - rasterizer.add_path(rect2); - agg::render_scanlines(rasterizer, scanline, ri); + //agg::rasterizer_scanline_aa<> rasterizer; + //agg::scanline_p8 scanline; + //rasterizer.add_path(rect2); + //agg::render_scanlines(rasterizer, scanline, ri); + + theRasterizer->add_path(rect2); + agg::render_scanlines(*theRasterizer, *slineP8, ri); + + return Py::Object(); } Modified: branches/transforms/ttconv/ttutil.cpp =================================================================== --- branches/transforms/ttconv/ttutil.cpp 2007-10-16 14:17:53 UTC (rev 3955) +++ branches/transforms/ttconv/ttutil.cpp 2007-10-16 14:35:12 UTC (rev 3956) @@ -32,14 +32,14 @@ va_start(arg_list, format); char buffer[PRINTF_BUFFER_SIZE]; -#ifdef WIN32 +#if defined(WIN32) || defined(_MSC_VER) int size = _vsnprintf(buffer, PRINTF_BUFFER_SIZE, format, arg_list); #else int size = vsnprintf(buffer, PRINTF_BUFFER_SIZE, format, arg_list); #endif if (size >= PRINTF_BUFFER_SIZE) { char* buffer2 = (char*)malloc(size); -#ifdef WIN32 +#if defined(WIN32) || defined(_MSC_VER) _vsnprintf(buffer2, size, format, arg_list); #else vsnprintf(buffer2, size, format, arg_list); Modified: branches/transforms/unit/ellipse_compare.py =================================================================== --- branches/transforms/unit/ellipse_compare.py 2007-10-16 14:17:53 UTC (rev 3955) +++ branches/transforms/unit/ellipse_compare.py 2007-10-16 14:35:12 UTC (rev 3956) @@ -27,27 +27,22 @@ fig = figure() ax = fig.add_subplot(211, aspect='auto') -ax.fill(x, y, alpha=0.2, facecolor='yellow') +ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) e1 = patches.Ellipse((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False) + angle=angle, linewidth=2, fill=False, zorder=2) -ax.add_artist(e1) +ax.add_patch(e1) ax = fig.add_subplot(212, aspect='equal') -ax.fill(x, y, alpha=0.2, facecolor='yellow') +ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1) e2 = patches.Ellipse((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False) + angle=angle, linewidth=2, fill=False, zorder=2) -ax.add_artist(e2) -ax.autoscale_view() +ax.add_patch(e2) - -ax.set_xlim(0.2, .5) -ax.set_ylim(0.3, 0.7) - #fig.savefig('ellipse_compare.png') -#fig.savefig('ellipse_compare.ps') +fig.savefig('ellipse_compare') show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-10-16 14:17:56
|
Revision: 3955 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3955&view=rev Author: mdboom Date: 2007-10-16 07:17:53 -0700 (Tue, 16 Oct 2007) Log Message: ----------- First pass at PS backend updates. Modified Paths: -------------- branches/transforms/lib/matplotlib/backend_bases.py branches/transforms/lib/matplotlib/backends/backend_ps.py branches/transforms/lib/matplotlib/cbook.py branches/transforms/lib/matplotlib/collections.py branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/path.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/lib/matplotlib/backend_bases.py =================================================================== --- branches/transforms/lib/matplotlib/backend_bases.py 2007-10-16 13:45:59 UTC (rev 3954) +++ branches/transforms/lib/matplotlib/backend_bases.py 2007-10-16 14:17:53 UTC (rev 3955) @@ -49,7 +49,62 @@ trans is an affine transform applied to the path. """ raise NotImplementedError - + + def draw_path_collection(self, master_transform, cliprect, clippath, + clippath_trans, paths, all_transforms, offsets, + offsetTrans, facecolors, edgecolors, linewidths, + linestyles, antialiaseds): + """ + MGDTODO: Document me. Explain that often the backend will not + want to override this. + """ + Npaths = len(paths) + Noffsets = len(offsets) + N = max(Npaths, Noffsets) + Ntransforms = min(len(all_transforms), N) + Nfacecolors = len(facecolors) + Nedgecolors = len(edgecolors) + Nlinewidths = len(linewidths) + Nlinestyles = len(linestyles) + Naa = len(antialiaseds) + + if (Nfacecolors == 0 and Nedgecolors == 0) or N == 0: + return + + ttransforms = [] + for i in range(Ntransforms): + transform = all_transforms[i] + if transform is None: + transform = transforms.IdentityTransform() + ttransforms.append((transform + master_transform).frozen()) + + toffsets = offsetTrans.transform(offsets) + + gc = self.new_gc() + gc.set_clip_rectangle(cliprect) + if clippath is not None: + clippath = transforms.TransformedPath(clippath, clippath_trans) + gc.set_clippath(clippath) + + if Nfacecolors == 0: + rgbFace = None + + print linewidths, edgecolors + + for i in xrange(N): + path = paths[i % Npaths] + xo, yo = toffsets[i % Noffsets] + transform = ttransforms[i % Ntransforms].frozen().translate(xo, yo) + if Nfacecolors: + rgbFace = facecolors[i % Nfacecolors] + if Nedgecolors: + gc.set_foreground(edgecolors[i % Nedgecolors]) + gc.set_linewidth(linewidths[i % Nlinewidths]) + gc.set_dashes(*linestyles[i % Nlinestyles]) + gc.set_antialiased(antialiaseds[i % Naa]) + + self.draw_path(gc, path, transform, rgbFace) + def get_image_magnification(self): """ Get the factor by which to magnify images passed to draw_image. @@ -78,328 +133,6 @@ """ return False - ###################################################################### - ## OLD API IS BELOW - ## These functions no longer need to be implemented in the backends -- - ## they now perform all of their functions in terms of the new API. - -# def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2, -# rotation): -# """ -# Draw an arc using GraphicsContext instance gcEdge, centered at x,y, -# with width and height and angles from 0.0 to 360.0 -# 0 degrees is at 3-o'clock -# positive angles are anti-clockwise -# draw rotated 'rotation' degrees anti-clockwise about x,y - -# If the color rgbFace is not None, fill the arc with it. -# """ -# raise NotImplementedError - -# def draw_line_collection(self, segments, transform, clipbox, -# colors, linewidths, linestyle, antialiaseds, -# offsets, transOffset): -# """ -# This is a function for optimized line drawing. If you need to draw -# many line segments with similar properties, it is faster to avoid the -# overhead of all the object creation etc. The lack of total -# configurability is compensated for with efficiency. Hence we don't use -# a GC and many of the line props it supports. See -# matplotlib.collections for more details. - -# segments is a sequence of ( line0, line1, line2), where linen = -# is an Mx2 array with columns x, y. Each line can be a -# different length - -# transform is used to Transform the lines - -# clipbox is a xmin, ymin, width, height clip rect - -# colors is a tuple of RGBA tuples - -# linewidths is a tuple of linewidths -# *** really should be called 'dashes' not 'linestyle', since -# we call gc.set_dashes() not gc.set_linestyle() *** - -# linestyle is an (offset, onoffseq) tuple or None,None for solid - -# antialiseds is a tuple of ones or zeros indicating whether the -# segment should be aa or not - -# offsets, if not None, is an Nx2 array of x,y offsets to -# translate the lines by after transform is used to transform -# the offset coords - -# This function could be overridden in the backend to possibly implement -# faster drawing, but it is already much faster than using draw_lines() -# by itself. -# """ - -# newstyle = getattr(self, 'draw_markers', None) is not None -# identity = transforms.identity_transform() -# gc = self.new_gc() -# if clipbox is not None: -# gc.set_clip_rectangle(clipbox.get_bounds()) -# gc.set_dashes(*linestyle) - -# Nc = len(colors) -# Nlw = len(linewidths) -# Naa = len(antialiaseds) -# Nsegments = len(segments) - -# usingOffsets = offsets is not None -# Noffsets = 0 -# if usingOffsets: -# Noffsets = offsets.shape[0] -# offsets = transOffset.numerix_xy(offsets) - -# for i in xrange(max(Noffsets, Nsegments)): -# color = colors[i % Nc] -# rgb = color[0], color[1], color[2] -# alpha = color[-1] - -# gc.set_foreground(rgb, isRGB=True) -# gc.set_alpha( alpha ) -# gc.set_linewidth( linewidths[i % Nlw] ) -# gc.set_antialiased( antialiaseds[i % Naa] ) -# seg = segments[i % Nsegments] -# if not len(seg): continue -# xy = transform.numerix_xy(seg) -# if usingOffsets: -# xy = xy + offsets[i % Noffsets] - -# if newstyle: self.draw_lines(gc, xy[:,0], xy[:,1], identity) -# else: self.draw_lines(gc, xy[:,0], xy[:,1]) - -# def draw_line(self, gc, x1, y1, x2, y2): -# """ -# Draw a single line from x1,y1 to x2,y2 -# """ -# raise NotImplementedError - -# def draw_lines(self, gc, x, y, transform=None): -# """ -# x and y are equal length arrays, draw lines connecting each -# point in x, y -# """ -# raise NotImplementedError - -# def draw_point(self, gc, x, y): -# """ -# Draw a single point at x,y -# Where 'point' is a device-unit point (or pixel), not a matplotlib point -# """ -# raise NotImplementedError - -# def draw_quad_mesh(self, meshWidth, meshHeight, colors, -# xCoords, yCoords, clipbox, -# transform, offsets, transOffset, showedges): -# """ -# Draw a quadrilateral mesh -# See documentation in QuadMesh class in collections.py for details -# """ -# # print "draw_quad_mesh not found, using function in backend_bases" -# verts = npy.zeros(((meshWidth * meshHeight), 4, 2), npy.float32) -# indices = npy.arange((meshWidth + 1) * (meshHeight + 1)) -# indices = npy.compress((indices + 1) % (meshWidth + 1), indices) -# indices = indices[:(meshWidth * meshHeight)] -# verts[:, 0, 0] = npy.take(xCoords, indices) -# verts[:, 0, 1] = npy.take(yCoords, indices) -# verts[:, 1, 0] = npy.take(xCoords, (indices + 1)) -# verts[:, 1, 1] = npy.take(yCoords, (indices + 1)) -# verts[:, 2, 0] = npy.take(xCoords, (indices + meshWidth + 2)) -# verts[:, 2, 1] = npy.take(yCoords, (indices + meshWidth + 2)) -# verts[:, 3, 0] = npy.take(xCoords, (indices + meshWidth + 1)) -# verts[:, 3, 1] = npy.take(yCoords, (indices + meshWidth + 1)) -# if (showedges): -# edgecolors = colors -# else: -# edgecolors = (0, 0, 0, 0), -# self.draw_poly_collection(verts, transform, -# clipbox, colors, edgecolors, -# (0.25,), (0,), offsets, transOffset) - -# def draw_poly_collection( -# self, verts, transform, clipbox, facecolors, edgecolors, -# linewidths, antialiaseds, offsets, transOffset): -# """ -# Draw a polygon collection - -# verts are a sequence of polygon vectors, where each polygon -# vector is a sequence of x,y tuples of vertices - -# facecolors and edgecolors are a sequence of RGBA tuples -# linewidths are a sequence of linewidths -# antialiaseds are a sequence of 0,1 integers whether to use aa - -# If a linewidth is zero or an edgecolor alpha is zero, the -# line will be omitted; similarly, the fill will be omitted -# if the facecolor alpha is zero. -# """ -# ## line and/or fill OK -# Nface = len(facecolors) -# Nedge = len(edgecolors) -# Nlw = len(linewidths) -# Naa = len(antialiaseds) - -# usingOffsets = offsets is not None -# Noffsets = 0 -# Nverts = len(verts) -# if usingOffsets: -# Noffsets = len(offsets) - -# N = max(Noffsets, Nverts) - -# gc = self.new_gc() -# if clipbox is not None: -# gc.set_clip_rectangle(clipbox.get_bounds()) - - -# for i in xrange(N): -# polyverts = ma.filled(verts[i % Nverts], npy.nan) -# if npy.any(npy.isnan(polyverts)): -# continue -# linewidth = linewidths[i % Nlw] -# rf,gf,bf,af = facecolors[i % Nface] -# re,ge,be,ae = edgecolors[i % Nedge] -# if af==0: -# if ae==0 or linewidth == 0: -# continue -# rgbFace = None -# alpha = ae -# else: -# rgbFace = rf,gf,bf -# if ae==0: -# alpha = af -# gc.set_linewidth(0) -# else: -# # the draw_poly interface can't handle separate alphas for -# # edge and face so we'll just use the maximum -# alpha = max(af,ae) -# gc.set_foreground( (re,ge,be), isRGB=True) -# gc.set_linewidth( linewidths[i % Nlw] ) -# #print 'verts', zip(thisxverts, thisyverts) - -# gc.set_antialiased( antialiaseds[i % Naa] ) # Used for fill only? -# gc.set_alpha( alpha ) -# tverts = transform.seq_xy_tups(polyverts) -# if usingOffsets: -# xo,yo = transOffset.xy_tup(offsets[i % Noffsets]) -# tverts = [(x+xo,y+yo) for x,y in tverts] - -# self.draw_polygon(gc, rgbFace, tverts) - -# def draw_polygon(self, gc, rgbFace, points): -# """ -# Draw a polygon using the GraphicsContext instance gc. -# points is a len vertices tuple, each element -# giving the x,y coords a vertex - -# If the color rgbFace is not None, fill the polygon with it -# """ -# raise NotImplementedError - -# def draw_rectangle(self, gcEdge, rgbFace, x, y, width, height): -# """ -# Draw a non-filled rectangle using the GraphicsContext instance gcEdge, -# with lower left at x,y with width and height. - -# If rgbFace is not None, fill the rectangle with it. -# """ -# warnings.warn("draw_rectangle called", warnings.PendingDeprecationWarning) -# transform = transforms.Affine2D().scale(width, height).translate(x, y) -# self.draw_path(gcEdge, Path.unit_rectangle(), transform, rgbFace) - -# def draw_regpoly_collection( -# self, clipbox, offsets, transOffset, verts, sizes, -# facecolors, edgecolors, linewidths, antialiaseds): -# """ -# Draw a regular poly collection - -# offsets - is a sequence is x,y tuples -# transOffset - maps this to display coords - -# verts - are the vertices of the regular polygon at the origin - -# sizes are the area of the circle that circumscribes the -# polygon in points^2 - -# facecolors and edgecolors are a sequence of RGBA tuples -# linewidths are a sequence of linewidths -# antialiaseds are a sequence of 0,1 integers whether to use aa -# """ -# ## line and/or fill OK -# gc = self.new_gc() -# if clipbox is not None: -# gc.set_clip_rectangle(clipbox.get_bounds()) - -# xverts, yverts = zip(*verts) -# xverts = npy.asarray(xverts) -# yverts = npy.asarray(yverts) - -# Nface = len(facecolors) -# Nedge = len(edgecolors) -# Nlw = len(linewidths) -# Naa = len(antialiaseds) -# Nsizes = len(sizes) - -# for i, loc in enumerate(offsets): -# xo,yo = transOffset.xy_tup(loc) -# #print 'xo, yo', loc, (xo, yo) -# scale = sizes[i % Nsizes] - -# thisxverts = scale*xverts + xo -# thisyverts = scale*yverts + yo -# #print 'xverts', xverts - -# linewidth = linewidths[i % Nlw] -# rf,gf,bf,af = facecolors[i % Nface] -# re,ge,be,ae = edgecolors[i % Nedge] -# if af==0: -# if ae==0 or linewidth == 0: -# continue -# rgbFace = None -# alpha = ae -# else: -# rgbFace = rf,gf,bf -# if ae==0: -# alpha = af -# gc.set_linewidth(0) -# else: -# # the draw_poly interface can't handle separate alphas for -# # edge and face so we'll just use the maximum -# alpha = max(af,ae) -# gc.set_foreground( (re,ge,be), isRGB=True) -# gc.set_linewidth( linewidths[i % Nlw] ) -# #print 'verts', zip(thisxverts, thisyverts) - -# gc.set_antialiased( antialiaseds[i % Naa] ) # Used for fill only? -# gc.set_alpha( alpha ) -# #print 'verts', zip(thisxverts, thisyverts) -# self.draw_polygon(gc, rgbFace, zip(thisxverts, thisyverts)) - - -# def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!'): -# raise NotImplementedError - -# def draw_text(self, gc, x, y, s, prop, angle, ismath=False): -# """ -# Draw the text.Text instance s at x,y (display coords) with font -# properties instance prop at angle in degrees, using GraphicsContext gc - -# **backend implementers note** - -# When you are trying to determine if you have gotten your bounding box -# right (which is what enables the text layout/alignment to work -# properly), it helps to change the line in text.py - -# if 0: bbox_artist(self, renderer) - -# to if 1, and then the actual bounding box will be blotted along with -# your text. -# """ -# raise NotImplementedError - def flipy(self): """return true if y small numbers are top for renderer Is used for drawing text (text.py) and images (image.py) only @@ -416,12 +149,6 @@ self._texmanager = TexManager() return self._texmanager - def get_text_extent(self, text): # is not used, can be removed? - """ - Get the text extent in window coords - """ - return transforms.lbwh_to_bbox(0,0,1,1) # your values here - def get_text_width_height_descent(self, s, prop, ismath): """ get the width and height, and the offset from the bottom to the Modified: branches/transforms/lib/matplotlib/backends/backend_ps.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-10-16 13:45:59 UTC (rev 3954) +++ branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-10-16 14:17:53 UTC (rev 3955) @@ -24,9 +24,9 @@ from matplotlib.mathtext import MathTextParser from matplotlib._mathtext_data import uni2type1 from matplotlib.text import Text +from matplotlib.path import Path +from matplotlib.transforms import IdentityTransform -from matplotlib.transforms import get_vec6_scales - import numpy as npy import binascii import re @@ -141,7 +141,9 @@ self.fontsize = None self.hatch = None self.image_magnification = dpi/72.0 - + self._clip_paths = {} + self._path_collection_id = 0 + self.fontd = {} self.afmfontd = {} self.used_characters = {} @@ -247,7 +249,7 @@ hatchl cvi hatchgap idiv hatchgap mul hatchgap hatchr cvi hatchgap idiv hatchgap mul - {hatcht moveto 0 hatchb hatcht sub rlineto} + {hatcht m 0 hatchb hatcht sub r } for stroke grestore @@ -330,18 +332,6 @@ font.set_size(size, 72.0) return font - def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2, rotation): - """ - Draw an arc centered at x,y with width and height and angles - from 0.0 to 360.0 - - If gcFace is not None, fill the arc slice with it. gcEdge - is a GraphicsContext instance - """ - ps = '%f %f translate\n%f rotate\n%f %f translate\n%s ellipse' % \ - (x, y, rotation, -x, -y, _nums_to_str(angle1, angle2, 0.5*width, 0.5*height, x, y)) - self._draw_ps(ps, gc, rgbFace, "arc") - def _rgba(self, im): return im.as_rgba_str() @@ -428,14 +418,47 @@ # unflip im.flipud_out() - def draw_line(self, gc, x0, y0, x1, y1): + def _convert_path(self, path, transform): + path = transform.transform_path(path) + + ps = [] + for points, code in path.iter_segments(): + if code == Path.MOVETO: + ps.append("%g %g m" % tuple(points)) + elif code == Path.LINETO: + ps.append("%g %g l" % tuple(points)) + elif code == Path.CURVE3: + ps.append("%g %g %g %g %g %g c" % + (points[0], points[1], + points[0], points[1], + points[2], points[3])) + elif code == Path.CURVE4: + ps.append("%g %g %g %g %g %g c" % tuple(points)) + elif code == Path.CLOSEPOLY: + ps.append("cl") + ps = "\n".join(ps) + + return ps + + def _get_clip_path(self, clippath, clippath_transform): + id = self._clip_paths.get((clippath, clippath_transform)) + if id is None: + id = 'c%x' % len(self._clip_paths) + ps_cmd = ['/%s {' % id] + ps_cmd.append(self._convert_path(clippath, clippath_transform)) + ps_cmd.extend(['clip', 'newpath', '} bind def\n']) + self._pswriter.write('\n'.join(ps_cmd)) + self._clip_paths[(clippath, clippath_transform)] = id + return id + + def draw_path(self, gc, path, transform, rgbFace=None): """ - Draw a single line from x0,y0 to x1,y1 - """ - ps = '%1.4g %1.4g m %1.4g %1.4g l'%(x0, y0, x1, y1) - self._draw_ps(ps, gc, None, "line") + Draws a Path instance using the given affine transform. + """ + ps = self._convert_path(path, transform) + self._draw_ps(ps, gc, rgbFace) - def draw_markers(self, gc, path, rgbFace, x, y, transform): + def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None): """ Draw the markers defined by path at each of the positions in x and y. path coordinates are points, x and y coords will be @@ -452,216 +475,82 @@ ps_color = '%1.3f %1.3f %1.3f setrgbcolor' % rgbFace # construct the generic marker command: - ps_cmd = ['gsave'] # dont want the translate to be global - ps_cmd.append('newpath') - ps_cmd.append('translate') - while 1: - code, xp, yp = path.vertex() - if code == agg.path_cmd_stop: - ps_cmd.append('closepath') # Hack, path_cmd_end_poly not found - break - elif code == agg.path_cmd_move_to: - ps_cmd.append('%g %g m' % (xp,yp)) - elif code == agg.path_cmd_line_to: - ps_cmd.append('%g %g l' % (xp,yp)) - elif code == agg.path_cmd_curve3: - pass - elif code == agg.path_cmd_curve4: - pass - elif code == agg.path_cmd_end_poly: - pass - ps_cmd.append('closepath') - elif code == agg.path_cmd_mask: - pass - else: - pass - #print code + ps_cmd = ['/o {', 'gsave', 'newpath', 'translate'] # dont want the translate to be global + ps_cmd.append(self._convert_path(marker_path, marker_trans)) if rgbFace: - ps_cmd.append('gsave') - ps_cmd.append(ps_color) - ps_cmd.append('fill') - ps_cmd.append('grestore') + ps_cmd.extend(['gsave', ps_color, 'fill', 'grestore']) - ps_cmd.append('stroke') - ps_cmd.append('grestore') # undo translate() - ps_cmd = '\n'.join(ps_cmd) + ps_cmd.extend(['stroke', 'grestore', '} bind def']) + + tpath = trans.transform_path(path) + for x, y in tpath.vertices: + ps_cmd.append("%1.3g %1.3g o" % (x, y)) - self.push_gc(gc, store=1) + ps = '\n'.join(ps_cmd) + self._draw_ps(ps, gc, rgbFace, fill=False, stroke=False) - def drawone(x, y): - try: - xt, yt = transform.xy_tup((x, y)) - ret = '%g %g o' % (xt, yt) - except ValueError: - pass - else: - return ret - - step = 500 - start = 0 - end = step - - mask = npy.where(npy.isnan(x) + npy.isnan(y), 0, 1) - - cliprect = gc.get_clip_rectangle() - if cliprect: - write('gsave\n') - xc,yc,wc,hc=cliprect - write('%g %g %g %g clipbox\n' % (wc,hc,xc,yc)) - write(' '.join(['/o {', ps_cmd, '} bind def\n'])) - # Now evaluate the marker command at each marker location: - while start < len(x): - todraw = izip(x[start:end+1], y[start:end+1], mask[start:end+1]) - ps = [i for i in [drawone(xi,yi) for xi,yi,mi in todraw if mi] if i] - write('\n'.join(ps)+'\n') - start = end - end += step - if cliprect: write('grestore\n') - - def draw_path(self,gc,rgbFace,path,trans): - pass - - def draw_lines(self, gc, x, y, transform): - """ - x and y are npy.equal length arrays, draw lines connecting each - point in x, y - """ - if debugPS: self._pswriter.write('% draw_lines \n') - + def draw_path_collection(self, master_transform, cliprect, clippath, + clippath_trans, paths, all_transforms, offsets, + offsetTrans, facecolors, edgecolors, linewidths, + linestyles, antialiaseds): write = self._pswriter.write + + Npaths = len(paths) + Noffsets = len(offsets) + N = max(Npaths, Noffsets) + Ntransforms = min(len(all_transforms), N) + Ntpaths = max(Npaths, Ntransforms) + Nfacecolors = len(facecolors) + Nedgecolors = len(edgecolors) + Nlinewidths = len(linewidths) + Nlinestyles = len(linestyles) + Naa = len(antialiaseds) - def drawone(x, y, skip): - try: - if skip: raise(ValueError) - xt, yt = transform.xy_tup((x, y)) - ret = '%g %g %c' % (xt, yt, drawone.state) - except ValueError: - drawone.state = 'm' - else: - drawone.state = 'l' - return ret + if (Nfacecolors == 0 and Nedgecolors == 0) or N == 0: + return + + for i in range(Ntpaths): + path = paths[i % Npaths] + transform = all_transforms[i % Ntransforms] + if transform is None: + transform = IdentityTransform() + transform += master_transform - step = 100000 - start = 0 - end = step + ps_cmd = ['/p%x_%x {' % (self._path_collection_id, i), + 'newpath', 'translate'] + ps_cmd.append(self._convert_path(path, transform)) + ps_cmd.extend(['} bind def\n']) + write('\n'.join(ps_cmd)) + + toffsets = offsetTrans.transform(offsets) + + gc = self.new_gc() - skip = npy.where(npy.isnan(x) + npy.isnan(y), 1, 0) - points = zip(x,y,skip) + gc.set_clip_rectangle(cliprect) + if clippath is not None: + clippath = transforms.TransformedPath(clippath, clippath_trans) + gc.set_clippath(clippath) + + if Nfacecolors == 0: + rgbFace = None - self.push_gc(gc, store=1) - cliprect = gc.get_clip_rectangle() - if cliprect: - write('gsave\n') - xc,yc,wc,hc=cliprect - write('%g %g %g %g clipbox\n' % (wc,hc,xc,yc)) - while start < len(points): - drawone.state = 'm' - ps = [i for i in [drawone(x,y,s) for x,y,s in points[start:end+1]]\ - if i] - ps.append('stroke') - write('\n'.join(ps)+'\n') - start = end - end += step - if cliprect: write('grestore\n') + for i in xrange(N): + path_id = i % Ntpaths + xo, yo = toffsets[i % Noffsets] + if Nfacecolors: + rgbFace = facecolors[i % Nfacecolors] + if Nedgecolors: + gc.set_foreground(edgecolors[i % Nedgecolors]) + gc.set_linewidth(linewidths[i % Nlinewidths]) + gc.set_dashes(*linestyles[i % Nlinestyles]) + gc.set_antialiased(antialiaseds[i % Naa]) + ps = "%g %g p%x_%x" % (xo, yo, self._path_collection_id, path_id) + self._draw_ps(ps, gc, rgbFace) - def draw_lines_old(self, gc, x, y, transform=None): - """ - x and y are npy.equal length arrays, draw lines connecting each - point in x, y - """ - if debugPS: self._pswriter.write('% draw_lines \n') - - write = self._pswriter.write - - mask = npy.where(npy.isnan(x) + npy.isnan(y), 0, 1) - if transform: # this won't be called if draw_markers is hidden - if transform.need_nonlinear(): - x,y,mask = transform.nonlinear_only_numerix(x, y, returnMask=1) - - # a,b,c,d,tx,ty affine which transforms x and y into ps coordinates - a,b,c,d,tx,ty = transform.as_vec6_val() - - xo = a*x+c*y+tx - yo = b*x+d*y+ty - x,y = xo,yo - - self.push_gc(gc, store=1) - - cliprect = gc.get_clip_rectangle() - if cliprect: - write('gsave\n') - xc,yc,wc,hc=cliprect - write('%g %g %g %g clipbox\n' % (wc,hc,xc,yc)) - - steps = 50 - start = 0 - end = steps - points = zip(x,y) - - while start < len(x): - # npy.put moveto on all the bad data and on the first good - # point after the bad data - codes = [('m','l')[int(i)] for i in mask] - ind = npy.nonzero(mask[start:end+1]==0)+1 - if len(ind): - if ind[-1]>=len(codes): - ind = ind[:-1] - for i in ind: - codes[i] = 'm' - # npy.put a moveto on the first point, regardless - codes[0] = 'm' - - thisx = x[start:end+1] - thisy = y[start:end+1] - to_draw = izip(thisx, thisy, codes, mask) - if not to_draw: - break - - ps = ["%g %g %c" % (xp, yp, c) for xp, yp, c, m in to_draw if m] - if transform: - ps.append('stroke') - write('\n'.join(ps)+'\n') - else: - self._draw_ps("\n".join(ps)+'\n', gc, None) - start = end - end += steps - if transform: - if cliprect: write("grestore\n") - - def draw_point(self, gc, x, y): - """ - Draw a single point at x,y - """ - # TODO: is there a better way to draw points in postscript? - # (use a small circle?) - self.draw_line(gc, x, y, x+1, y+1) - - def draw_polygon(self, gc, rgbFace, points): - """ - Draw a polygon. points is a len vertices tuple, each element - giving the x,y coords a vertex - - If rgbFace is not None, fill the poly with it. gc - is a GraphicsContext instance - """ - ps = ["%s m\n" % _nums_to_str(*points[0])] - ps.extend([ "%s l\n" % _nums_to_str(x, y) for x,y in points[1:] ]) - ps.append("closepath") - self._draw_ps(''.join(ps), gc, rgbFace, "polygon") - - def draw_rectangle(self, gc, rgbFace, x, y, width, height): - """ - Draw a rectangle with lower left at x,y with width and height. - - If gcFace is not None, fill the rectangle with it. gcEdge - is a GraphicsContext instance - """ - # TODO: use rectstroke - ps = '%s box' % _nums_to_str(width, height, x, y) - self._draw_ps(ps, gc, rgbFace, "rectangle") - + self._path_collection_id += 1 + def draw_tex(self, gc, x, y, s, prop, angle, ismath='TeX!'): """ draw a Text instance @@ -853,7 +742,6 @@ """ % locals() self._pswriter.write(ps) - def draw_mathtext(self, gc, x, y, s, prop, angle): """ @@ -875,68 +763,57 @@ """ % locals() self._pswriter.write(ps) - def _draw_ps(self, ps, gc, rgbFace, command=None): + def _draw_ps(self, ps, gc, rgbFace, fill=True, stroke=True, command=None): """ Emit the PostScript sniplet 'ps' with all the attributes from 'gc' applied. 'ps' must consist of PostScript commands to construct a path. """ # local variable eliminates all repeated attribute lookups write = self._pswriter.write - write('gsave\n') + # write('gsave\n') if debugPS and command: write("% "+command+"\n") - cliprect = gc.get_clip_rectangle() - self.set_color(*gc.get_rgb()) self.set_linewidth(gc.get_linewidth()) jint = gc.get_joinstyle() self.set_linejoin(jint) cint = gc.get_capstyle() self.set_linecap(cint) self.set_linedash(*gc.get_dashes()) - + + cliprect = gc.get_clip_rectangle() if cliprect: - x,y,w,h=cliprect + x,y,w,h=cliprect.bounds write('gsave\n%1.4g %1.4g %1.4g %1.4g clipbox\n' % (w,h,x,y)) + clippath, clippath_trans = gc.get_clip_path() + if clippath: + id = self._get_clip_path(clippath, clippath_trans) + write('gsave\n%s\n' % id) + # Jochen, is the strip necessary? - this could be a honking big string write(ps.strip()) write("\n") - if rgbFace: + + if rgbFace is not None and fill: #print 'rgbface', rgbFace write("gsave\n") - self.set_color(store=0, *rgbFace) + self.set_color(store=0, *rgbFace[:3]) write("fill\ngrestore\n") hatch = gc.get_hatch() if (hatch): self.set_hatch(hatch) - if self.linewidth > 0: + if self.linewidth > 0 and stroke: + self.set_color(*gc.get_rgb()[:3]) write("stroke\n") + if clippath: + write("grestore\n") if cliprect: write("grestore\n") - write('grestore\n') - def push_gc(self, gc, store=1): - """ - Push the current onto stack, with the exception of the clip box, which - must be isolated in a gsave/grestore pair. - """ - # local variable eliminates all repeated attribute lookups - write = self._pswriter.write + #write('grestore\n') - self.set_color(store=store, *gc.get_rgb()) - self.set_linewidth(gc.get_linewidth(), store=store) - self.set_linejoin(gc.get_joinstyle(), store=store) - self.set_linecap(gc.get_capstyle(), store=store) - self.set_linedash(store=store, *gc.get_dashes()) - -## cliprect = gc.get_clip_rectangle() -## if cliprect: -## x,y,w,h=cliprect -## write('%1.3f %1.3f %1.3f %1.3f clipbox\n' % (w,h,x,y)) - -## write("\n") - + class GraphicsContextPS(GraphicsContextBase): def get_capstyle(self): return {'butt':0, @@ -1044,7 +921,7 @@ xo = 72*0.5*(paperWidth - width) yo = 72*0.5*(paperHeight - height) - l, b, w, h = self.figure.bbox.get_bounds() + l, b, w, h = self.figure.bbox.bounds llx = xo lly = yo urx = llx + w @@ -1521,33 +1398,6 @@ # http://www.mactech.com/articles/mactech/Vol.09/09.04/PostscriptTutorial/ # http://www.math.ubc.ca/people/faculty/cass/graphics/text/www/ # -# Some comments about the implementation: -# -# Drawing ellipses: -# -# ellipse adds a counter-clockwise segment of an elliptical arc to the -# current path. The ellipse procedure takes six operands: the x and y -# coordinates of the center of the ellipse (the center is defined as -# the point of intersection of the major and minor axes), the -# ``radius'' of the ellipse in the x direction, the ``radius'' of the -# ellipse in the y direction, the starting angle of the elliptical arc -# and the ending angle of the elliptical arc. -# -# The basic strategy used in drawing the ellipse is to translate to -# the center of the ellipse, scale the user coordinate system by the x -# and y radius values, and then add a circular arc, centered at the -# origin with a 1 unit radius to the current path. We will be -# transforming the user coordinate system with the translate and -# rotate operators to add the elliptical arc segment but we don't want -# these transformations to affect other parts of the program. In other -# words, we would like to localize the effect of the transformations. -# Usually the gsave and grestore operators would be ideal candidates -# for this task. Unfortunately gsave and grestore are inappropriate -# for this situation because we cannot save the arc segment that we -# have added to the path. Instead we will localize the effect of the -# transformations by saving the current transformation matrix and -# restoring it explicitly after we have added the elliptical arc to -# the path. # The usage comments use the notation of the operator summary # in the PostScript Language reference manual. @@ -1558,28 +1408,22 @@ "/l { lineto } bind def", # x y *r* - "/r { rlineto } bind def", + # x1 y1 x2 y2 x y *c* - + "/c { curveto } bind def", + # *closepath* - + "/cl { closepath } bind def", # w h x y *box* - """/box { m 1 index 0 r 0 exch r neg 0 r - closepath + cl } bind def""", # w h x y *clipbox* - """/clipbox { box clip newpath - } bind def""", - # angle1 angle2 rx ry x y *ellipse* - - """/ellipse { - newpath - matrix currentmatrix 7 1 roll - translate - scale - 0 0 1 5 3 roll arc - setmatrix - closepath } bind def""" ] Modified: branches/transforms/lib/matplotlib/cbook.py =================================================================== --- branches/transforms/lib/matplotlib/cbook.py 2007-10-16 13:45:59 UTC (rev 3954) +++ branches/transforms/lib/matplotlib/cbook.py 2007-10-16 14:17:53 UTC (rev 3955) @@ -174,6 +174,7 @@ def __str__(self): return '<a list of %d %s objects>' % (len(self), self.type) +# MGDTODO: This is very incomplete def strip_math(s): 'remove latex formatting from mathtext' remove = (r'\rm', '\cal', '\tt', '\it', '\\', '{', '}') Modified: branches/transforms/lib/matplotlib/collections.py =================================================================== --- branches/transforms/lib/matplotlib/collections.py 2007-10-16 13:45:59 UTC (rev 3954) +++ branches/transforms/lib/matplotlib/collections.py 2007-10-16 14:17:53 UTC (rev 3955) @@ -167,7 +167,9 @@ self.update_scalarmappable() clippath, clippath_trans = self.get_transformed_clip_path_and_affine() - + if clippath_trans is not None: + clippath_trans = clippath_trans.frozen() + # MGDTODO: This may benefit from using TransformedPath if not transform.is_affine: paths = [transform.transform_path_non_affine(path) for path in paths] @@ -175,9 +177,9 @@ if not transOffset.is_affine: offsets = transOffset.transform_non_affine(offsets) transOffset = transOffset.get_affine() - + renderer.draw_path_collection( - transform, self.clipbox, clippath, clippath_trans, + transform.frozen(), self.clipbox, clippath, clippath_trans, paths, self.get_transforms(), npy.asarray(offsets, npy.float_), transOffset, self._facecolors, self._edgecolors, self._linewidths, Modified: branches/transforms/lib/matplotlib/lines.py =================================================================== --- branches/transforms/lib/matplotlib/lines.py 2007-10-16 13:45:59 UTC (rev 3954) +++ branches/transforms/lib/matplotlib/lines.py 2007-10-16 14:17:53 UTC (rev 3955) @@ -458,7 +458,7 @@ if funcname != '_draw_nothing': tpath, affine = self._transformed_path.get_transformed_path_and_affine() lineFunc = getattr(self, funcname) - lineFunc(renderer, gc, tpath, affine) + lineFunc(renderer, gc, tpath, affine.frozen()) if self._marker is not None: gc = renderer.new_gc() @@ -470,7 +470,7 @@ if funcname != '_draw_nothing': tpath, affine = self._transformed_path.get_transformed_path_and_affine() markerFunc = getattr(self, funcname) - markerFunc(renderer, gc, tpath, affine) + markerFunc(renderer, gc, tpath, affine.frozen()) renderer.close_group('line2d') Modified: branches/transforms/lib/matplotlib/path.py =================================================================== --- branches/transforms/lib/matplotlib/path.py 2007-10-16 13:45:59 UTC (rev 3954) +++ branches/transforms/lib/matplotlib/path.py 2007-10-16 14:17:53 UTC (rev 3955) @@ -142,7 +142,7 @@ return self._vertices vertices = property(_get_vertices) - def iter_endpoints(self): + def iter_segments(self): """ Iterates over all of the endpoints in the path. Unlike iterating directly over the vertices array, curve control @@ -151,15 +151,20 @@ i = 0 NUM_VERTICES = self.NUM_VERTICES vertices = self.vertices - for code in self.codes: + codes = self.codes + + while i < len(vertices): + code = codes[i] if code == self.CLOSEPOLY: + yield [], code i += 1 + elif code == self.STOP: + return else: num_vertices = NUM_VERTICES[code] - i += num_vertices - 1 - yield vertices[i] - i += 1 - + yield vertices[i:i+num_vertices].flatten(), code + i += num_vertices + def transformed(self, transform): """ Return a transformed copy of the path. Modified: branches/transforms/lib/matplotlib/transforms.py =================================================================== --- branches/transforms/lib/matplotlib/transforms.py 2007-10-16 13:45:59 UTC (rev 3954) +++ branches/transforms/lib/matplotlib/transforms.py 2007-10-16 14:17:53 UTC (rev 3955) @@ -822,6 +822,12 @@ raise TypeError( "Can not add Transform to object of type '%s'" % type(other)) + def __array__(self): + """ + Used by C/C++ -based backends to get at the array matrix data. + """ + return self.frozen().__array__() + def transform(self, values): """ Performs the transformation on the given array of values. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2007-10-16 13:46:01
|
Revision: 3954 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3954&view=rev Author: jdh2358 Date: 2007-10-16 06:45:59 -0700 (Tue, 16 Oct 2007) Log Message: ----------- restored unit support for ellipses -- and added examples/units/ellipse_with_units.py Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/patches.py Added Paths: ----------- trunk/matplotlib/examples/units/ellipse_with_units.py Added: trunk/matplotlib/examples/units/ellipse_with_units.py =================================================================== --- trunk/matplotlib/examples/units/ellipse_with_units.py (rev 0) +++ trunk/matplotlib/examples/units/ellipse_with_units.py 2007-10-16 13:45:59 UTC (rev 3954) @@ -0,0 +1,49 @@ +""" +Compare the ellipse generated with arcs versus a polygonal approximation +""" +from basic_units import cm +import numpy as npy +from matplotlib import patches +from pylab import figure, show + +xcenter, ycenter = 0.38*cm, 0.52*cm +#xcenter, ycenter = 0., 0. +width, height = 1e-1*cm, 3e-1*cm +angle = -30 + +theta = npy.arange(0.0, 360.0, 1.0)*npy.pi/180.0 +x = 0.5 * width * npy.cos(theta) +y = 0.5 * height * npy.sin(theta) + +rtheta = angle*npy.pi/180. +R = npy.array([ + [npy.cos(rtheta), -npy.sin(rtheta)], + [npy.sin(rtheta), npy.cos(rtheta)], + ]) + + +x, y = npy.dot(R, npy.array([x, y])) +x += xcenter +y += ycenter + +fig = figure() +ax = fig.add_subplot(211, aspect='auto') +ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) + +e1 = patches.Ellipse((xcenter, ycenter), width, height, + angle=angle, linewidth=2, fill=False, zorder=2) + +ax.add_patch(e1) + +ax = fig.add_subplot(212, aspect='equal') +ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1) +e2 = patches.Ellipse((xcenter, ycenter), width, height, + angle=angle, linewidth=2, fill=False, zorder=2) + + +ax.add_patch(e2) + +#fig.savefig('ellipse_compare.png') +fig.savefig('ellipse_compare') + +show() Modified: trunk/matplotlib/lib/matplotlib/patches.py =================================================================== --- trunk/matplotlib/lib/matplotlib/patches.py 2007-10-16 12:28:49 UTC (rev 3953) +++ trunk/matplotlib/lib/matplotlib/patches.py 2007-10-16 13:45:59 UTC (rev 3954) @@ -820,6 +820,8 @@ [npy.sin(rtheta), npy.cos(rtheta)], ]) + x = self.convert_xunits(x) + y = self.convert_yunits(y) x, y = npy.dot(R, npy.array([x, y])) x += xcenter @@ -845,10 +847,7 @@ if self._hatch: gc.set_hatch(self._hatch ) - offset = self.offset - - if not hasattr(renderer, 'draw_path'): verbose.report('patches.Ellipse renderer does not support path drawing; falling back on vertex approximation for nonlinear transformation') renderer.draw_polygon(gc, rgbFace, self.get_verts()) @@ -856,15 +855,23 @@ x, y = self.center + x = self.convert_xunits(x) + y = self.convert_yunits(y) + theta = self.angle * npy.pi/180. T = npy.array([ [1, 0, x], [0, 1, y], [0, 0, 1]]) + w, h = self.width/2, self.height/2. + w = self.convert_xunits(w) + h = self.convert_yunits(h) + + S = npy.array([ - [self.width/2., 0, 0], - [0, self.height/2., 0], + [w, 0, 0], + [0, h, 0], [0, 0, 1]]) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-10-16 12:45:15
|
Revision: 3953 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3953&view=rev Author: mdboom Date: 2007-10-16 05:28:49 -0700 (Tue, 16 Oct 2007) Log Message: ----------- Fix build on Windows with MSVC .NET 2003 Modified Paths: -------------- trunk/matplotlib/ttconv/ttutil.cpp Modified: trunk/matplotlib/ttconv/ttutil.cpp =================================================================== --- trunk/matplotlib/ttconv/ttutil.cpp 2007-10-15 21:22:03 UTC (rev 3952) +++ trunk/matplotlib/ttconv/ttutil.cpp 2007-10-16 12:28:49 UTC (rev 3953) @@ -32,14 +32,14 @@ va_start(arg_list, format); char buffer[PRINTF_BUFFER_SIZE]; -#ifdef WIN32 +#if defined(WIN32) || defined(_MSC_VER) int size = _vsnprintf(buffer, PRINTF_BUFFER_SIZE, format, arg_list); #else int size = vsnprintf(buffer, PRINTF_BUFFER_SIZE, format, arg_list); #endif if (size >= PRINTF_BUFFER_SIZE) { char* buffer2 = (char*)malloc(size); -#ifdef WIN32 +#if defined(WIN32) || defined(_MSC_VER) _vsnprintf(buffer2, size, format, arg_list); #else vsnprintf(buffer2, size, format, arg_list); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2007-10-15 21:22:07
|
Revision: 3952 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3952&view=rev Author: jdh2358 Date: 2007-10-15 14:22:03 -0700 (Mon, 15 Oct 2007) Log Message: ----------- fixed a unit problem with annotations Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/text.py Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2007-10-15 21:08:35 UTC (rev 3951) +++ trunk/matplotlib/lib/matplotlib/text.py 2007-10-15 21:22:03 UTC (rev 3952) @@ -1077,6 +1077,8 @@ def _get_xy(self, x, y, s): if s=='data': trans = self.axes.transData + x = float(self.convert_xunits(x)) + y = float(self.convert_yunits(y)) return trans.xy_tup((x,y)) elif s=='polar': theta, r = x, y This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2007-10-15 21:08:39
|
Revision: 3951 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3951&view=rev Author: jdh2358 Date: 2007-10-15 14:08:35 -0700 (Mon, 15 Oct 2007) Log Message: ----------- Fixed an annotation unit bug Added Paths: ----------- trunk/matplotlib/examples/units/annotate_with_units.py Added: trunk/matplotlib/examples/units/annotate_with_units.py =================================================================== --- trunk/matplotlib/examples/units/annotate_with_units.py (rev 0) +++ trunk/matplotlib/examples/units/annotate_with_units.py 2007-10-15 21:08:35 UTC (rev 3951) @@ -0,0 +1,27 @@ + +import pylab +from basic_units import cm + +fig = pylab.figure() +ax = fig.add_subplot(111) + + +ax.annotate( "Note 01", [0.5*cm, 0.5*cm] ) + +# xy and text both unitized +ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data', + xytext=(0.8*cm, 0.95*cm), textcoords='data', + arrowprops=dict(facecolor='black', shrink=0.05), + horizontalalignment='right', verticalalignment='top') + +# mixing units w/ nonunits +ax.annotate('local max', xy=(3*cm, 1*cm), xycoords='data', + xytext=(0.8, 0.95), textcoords='axes fraction', + arrowprops=dict(facecolor='black', shrink=0.05), + horizontalalignment='right', verticalalignment='top') + + +ax.set_xlim(0*cm, 4*cm) +ax.set_ylim(0*cm, 4*cm) +pylab.show() + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2007-10-15 20:52:34
|
Revision: 3950 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3950&view=rev Author: jdh2358 Date: 2007-10-15 13:52:32 -0700 (Mon, 15 Oct 2007) Log Message: ----------- Fixed a texst clipping bug in backend agg Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2007-10-15 20:00:54 UTC (rev 3949) +++ trunk/matplotlib/src/_backend_agg.cpp 2007-10-15 20:52:32 UTC (rev 3950) @@ -2202,11 +2202,16 @@ srcbuf, 0, interpolator, filter); span_gen_type output_span_generator(&image_span_generator, gc.color); renderer_type ri(*rendererBase, output_span_generator); - agg::rasterizer_scanline_aa<> rasterizer; - agg::scanline_p8 scanline; - rasterizer.add_path(rect2); - agg::render_scanlines(rasterizer, scanline, ri); + //agg::rasterizer_scanline_aa<> rasterizer; + //agg::scanline_p8 scanline; + //rasterizer.add_path(rect2); + //agg::render_scanlines(rasterizer, scanline, ri); + + theRasterizer->add_path(rect2); + agg::render_scanlines(*theRasterizer, *slineP8, ri); + + return Py::Object(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2007-10-15 20:00:56
|
Revision: 3949 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3949&view=rev Author: jdh2358 Date: 2007-10-15 13:00:54 -0700 (Mon, 15 Oct 2007) Log Message: ----------- fixed an aspect=auto problem with bezier ellipse approx Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/boilerplate.py trunk/matplotlib/lib/matplotlib/backends/backend_ps.py trunk/matplotlib/lib/matplotlib/cbook.py trunk/matplotlib/lib/matplotlib/mlab.py trunk/matplotlib/lib/matplotlib/patches.py trunk/matplotlib/src/_backend_agg.cpp trunk/matplotlib/src/_transforms.cpp trunk/matplotlib/unit/ellipse_compare.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2007-10-15 14:03:19 UTC (rev 3948) +++ trunk/matplotlib/CHANGELOG 2007-10-15 20:00:54 UTC (rev 3949) @@ -1,3 +1,12 @@ +2007-10-15 Fixed a bug in patches.Ellipse that was broken for + aspect='auto'. Scale free ellipses now work properly for + equal and auto on Agg and PS, and they fall back on a + polygonal approximation for nonlinear transformations until + we convince oursleves that the spline approximation holds + for nonlinear transformations. Added + unit/ellipse_compare.py to compare spline with vertex + approx for both aspects. JDH + 2007-10-05 remove generator expressions from texmanager and mpltraits. generator expressions are not supported by python-2.3 - DSD Modified: trunk/matplotlib/boilerplate.py =================================================================== --- trunk/matplotlib/boilerplate.py 2007-10-15 14:03:19 UTC (rev 3948) +++ trunk/matplotlib/boilerplate.py 2007-10-15 20:00:54 UTC (rev 3949) @@ -2,10 +2,9 @@ # file is pasted into pylab.py. We did try to do this the smart way, # with callable functions and new.function, but could never get the # docstrings right for python2.2. See -# http://groups-beta.google.com/group/comp.lang.python/messages/1b14640f3a4ad3dc,b3d7453af21e5f82,17739e70ac6f710c,9d5291fce29cbbb1,c5b578e4ffc6af28,056ff270daa2f414?thread_id=dcd63ec13096a0f6&mode=thread +# http://groups.google.com/group/comp.lang.python/browse_frm/thread/dcd63ec13096a0f6/1b14640f3a4ad3dc?#1b14640f3a4ad3dc - # note we check for __doc__ is not None since py2exe optimize removes # the docstrings Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007-10-15 14:03:19 UTC (rev 3948) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007-10-15 20:00:54 UTC (rev 3949) @@ -329,7 +329,7 @@ size = prop.get_size_in_points() font.set_size(size, 72.0) return font - + def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2, rotation): """ Draw an arc centered at x,y with width and height and angles @@ -340,7 +340,7 @@ """ ps = '%f %f translate\n%f rotate\n%f %f translate\n%s ellipse' % \ (x, y, rotation, -x, -y, _nums_to_str(angle1, angle2, 0.5*width, 0.5*height, x, y)) - self._draw_ps(ps, gc, rgbFace, "arc") + self._draw_ps(ps, gc, None, "arc") def _rgba(self, im): return im.as_rgba_str() @@ -519,9 +519,42 @@ end += step if cliprect: write('grestore\n') - def draw_path(self,gc,rgbFace,path,trans): - pass + def draw_path(self, gc, rgbFace, path): + ps_cmd = [] + ps_cmd.append('newpath') + + while 1: + code, xp, yp = path.vertex() + + #print code, xp, yp + + if code == agg.path_cmd_stop: + ps_cmd.append('closepath') # Hack, path_cmd_end_poly not found + break + elif code == agg.path_cmd_move_to: + ps_cmd.append('%g %g m' % (xp,yp)) + elif code == agg.path_cmd_line_to: + ps_cmd.append('%g %g l' % (xp,yp)) + elif code == agg.path_cmd_curve3: + pass + elif code == agg.path_cmd_curve4: + verts = [xp, yp] + verts.extend(path.vertex()[1:]) + verts.extend(path.vertex()[1:]) + ps_cmd.append('%g %g %g %g %g %g curveto'%tuple(verts)) + elif code == agg.path_cmd_end_poly: + ps_cmd.append('closepath') + elif code == agg.path_cmd_mask: + pass + else: + pass + #print code + + ps = '\n'.join(ps_cmd) + + self._draw_ps(ps, gc, rgbFace, "custom_path") + def draw_lines(self, gc, x, y, transform): """ x and y are npy.equal length arrays, draw lines connecting each @@ -883,6 +916,7 @@ # local variable eliminates all repeated attribute lookups write = self._pswriter.write write('gsave\n') + if debugPS and command: write("% "+command+"\n") @@ -916,6 +950,7 @@ if cliprect: write("grestore\n") write('grestore\n') + def push_gc(self, gc, store=1): """ Push the current onto stack, with the exception of the clip box, which @@ -1581,5 +1616,15 @@ 0 0 1 5 3 roll arc setmatrix closepath - } bind def""" + } bind def""", + """/unitcircle { + newpath +-1. 0. moveto +-1.0 0.552284749831 -0.552284749831 1.0 0.0 1.0 curveto +0.552284749831 1.0 1.0 0.552284749831 1.0 0.0 curveto +1.0 -0.552284749831 0.552284749831 -1.0 0.0 -1.0 curveto +-0.552284749831 -1.0 -1.0 -0.552284749831 -1.0 0.0 curveto +closepath + } bind def""", + ] Modified: trunk/matplotlib/lib/matplotlib/cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cbook.py 2007-10-15 14:03:19 UTC (rev 3948) +++ trunk/matplotlib/lib/matplotlib/cbook.py 2007-10-15 20:00:54 UTC (rev 3949) @@ -230,17 +230,18 @@ except TypeError: return False else: return True -def to_filehandle(fname): +def to_filehandle(fname, flag='r'): """ fname can be a filename or a file handle. Support for gzipped - files is automatic, if the filename ends in .gz + files is automatic, if the filename ends in .gz. flag is a + read/write flag for file """ if is_string_like(fname): if fname.endswith('.gz'): import gzip - fh = gzip.open(fname) + fh = gzip.open(fname, flag) else: - fh = file(fname) + fh = file(fname, flag) elif hasattr(fname, 'seek'): fh = fname else: Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2007-10-15 14:03:19 UTC (rev 3948) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2007-10-15 20:00:54 UTC (rev 3949) @@ -809,6 +809,8 @@ If p is a scalar, the largest value of x less than or equal to the p percentage point in the sequence is returned. """ + + x = npy.ravel(x) x.sort() Nx = len(x) @@ -1282,7 +1284,10 @@ converterd, if not None, is a dictionary mapping column number or munged column name to a converter function - See examples/loadrec.py + names, if not None, is a list of header names. In this case, no + header will be read from the file + + if no rows are found, None is returned See examples/loadrec.py """ if converterd is None: @@ -1291,9 +1296,42 @@ import dateutil.parser parsedate = dateutil.parser.parse + fh = cbook.to_filehandle(fname) - reader = csv.reader(fh, delimiter=delimiter) + + class FH: + """ + for space delimited files, we want different behavior than + comma or tab. Generally, we want multiple spaces to be + treated as a single separator, whereas with comma and tab we + want multiple commas to return multiple (empty) fields. The + join/strip trick below effects this + """ + def __init__(self, fh): + self.fh = fh + + def close(self): + self.fh.close() + + def seek(self, arg): + self.fh.seek(arg) + + def fix(self, s): + return ' '.join(s.split()) + + + def next(self): + return self.fix(self.fh.next()) + + def __iter__(self): + for line in self.fh: + yield self.fix(line) + + if delimiter==' ': + fh = FH(fh) + + reader = csv.reader(fh, delimiter=delimiter) def process_skiprows(reader): if skiprows: for i, row in enumerate(reader): @@ -1388,9 +1426,131 @@ rows.append([func(val) for func, val in zip(converters, row)]) fh.close() + if not len(rows): + return None r = npy.rec.fromrecords(rows, names=names) return r + +def rec2csv(r, fname, delimiter=','): + """ + Save the data from numpy record array r into a comma/space/tab + delimited file. The record array dtype names will be used for + column headers. + + + fname - can be a filename or a file handle. Support for gzipped + files is automatic, if the filename ends in .gz + """ + fh = cbook.to_filehandle(fname, 'w') + writer = csv.writer(fh, delimiter=delimiter) + header = r.dtype.names + writer.writerow(header) + for row in r: + writer.writerow(map(str, row)) + fh.close() + +# some record array helpers +def rec_append_field(rec, name, arr, dtype=None): + 'return a new record array with field name populated with data from array arr' + arr = npy.asarray(arr) + if dtype is None: + dtype = arr.dtype + newdtype = npy.dtype(rec.dtype.descr + [(name, dtype)]) + newrec = npy.empty(rec.shape, dtype=newdtype) + for field in rec.dtype.fields: + newrec[field] = rec[field] + newrec[name] = arr + return newrec.view(npy.recarray) + + +def rec_drop_fields(rec, names): + 'return a new numpy record array with fields in names dropped' + + names = set(names) + Nr = len(rec) + + newdtype = npy.dtype([(name, rec.dtype[name]) for name in rec.dtype.names + if name not in names]) + + newrec = npy.empty(Nr, dtype=newdtype) + for field in newdtype.names: + newrec[field] = rec[field] + + return newrec.view(npy.recarray) + + +def rec_join(key, r1, r2): + """ + join record arrays r1 and r2 on key; key is a tuple of field + names. if r1 and r2 have equal values on all the keys in the key + tuple, then their fields will be merged into a new record array + containing the union of the fields of r1 and r2 + """ + + for name in key: + if name not in r1.dtype.names: + raise ValueError('r1 does not have key field %s'%name) + if name not in r2.dtype.names: + raise ValueError('r2 does not have key field %s'%name) + + def makekey(row): + return tuple([row[name] for name in key]) + + + names = list(r1.dtype.names) + [name for name in r2.dtype.names if name not in set(r1.dtype.names)] + + + + r1d = dict([(makekey(row),i) for i,row in enumerate(r1)]) + r2d = dict([(makekey(row),i) for i,row in enumerate(r2)]) + + r1keys = set(r1d.keys()) + r2keys = set(r2d.keys()) + + keys = r1keys & r2keys + + r1ind = [r1d[k] for k in keys] + r2ind = [r2d[k] for k in keys] + + + r1 = r1[r1ind] + r2 = r2[r2ind] + + r2 = rec_drop_fields(r2, r1.dtype.names) + + + def key_desc(name): + 'if name is a string key, use the larger size of r1 or r2 before merging' + dt1 = r1.dtype[name] + if dt1.type != npy.string_: + return (name, dt1.descr[0][1]) + + dt2 = r1.dtype[name] + assert dt2==dt1 + if dt1.num>dt2.num: + return (name, dt1.descr[0][1]) + else: + return (name, dt2.descr[0][1]) + + + + keydesc = [key_desc(name) for name in key] + + newdtype = npy.dtype(keydesc + + [desc for desc in r1.dtype.descr if desc[0] not in key ] + + [desc for desc in r2.dtype.descr if desc[0] not in key ] ) + + + newrec = npy.empty(len(r1), dtype=newdtype) + for field in r1.dtype.names: + newrec[field] = r1[field] + + for field in r2.dtype.names: + newrec[field] = r2[field] + + return newrec.view(npy.recarray) + def slopes(x,y): """ SLOPES calculate the slope y'(x) Given data vectors X and Y SLOPES Modified: trunk/matplotlib/lib/matplotlib/patches.py =================================================================== --- trunk/matplotlib/lib/matplotlib/patches.py 2007-10-15 14:03:19 UTC (rev 3948) +++ trunk/matplotlib/lib/matplotlib/patches.py 2007-10-15 20:00:54 UTC (rev 3949) @@ -11,8 +11,9 @@ import matplotlib.nxutils as nxutils import matplotlib.mlab as mlab import matplotlib.artist as artist +from matplotlib import transforms as mtrans +import agg - # these are not available for the object inspector until after the # class is build so we define an initial set here for the init # function and they will be overridden after object defn @@ -749,6 +750,32 @@ """ A scale-free ellipse """ + offset = 4.0 * (npy.sqrt(2) - 1) / 3.0 + + circle = npy.array([ + [-1.0, 0.0], + + [-1.0, offset], + [-offset, 1.0], + [0.0, 1.0], + + [offset, 1.0], + [1.0, offset], + [1.0, 0.0], + + [1.0, -offset], + [offset, -1.0], + [0.0, -1.0], + + [-offset, -1.0], + [-1.0, -offset], + [-1.0, 0.0], + + [-1.0, 0.0] + ], + npy.float_) + + def __str__(self): return "Ellipse(%d,%d;%dx%d)"%(self.center[0],self.center[1],self.width,self.height) @@ -777,14 +804,29 @@ return inside,{} def get_verts(self): - x,y = self.center - l,r = x-self.width/2.0, x+self.width/2.0 - b,t = y-self.height/2.0, y+self.height/2.0 - x,l,r = self.convert_xunits((x,l,r)) - y,b,t = self.convert_yunits((y,b,t)) - verts = ((x,y), (l,y), (x,t), (r,y), (x,b)) - return npy.array(verts, npy.float) + xcenter, ycenter = self.center + + width, height = self.width, self.height + angle = self.angle + + theta = npy.arange(0.0, 360.0, 1.0)*npy.pi/180.0 + x = width/2. * npy.cos(theta) + y = height/2. * npy.sin(theta) + + rtheta = angle*npy.pi/180. + R = npy.array([ + [npy.cos(rtheta), -npy.sin(rtheta)], + [npy.sin(rtheta), npy.cos(rtheta)], + ]) + + + x, y = npy.dot(R, npy.array([x, y])) + x += xcenter + y += ycenter + + return zip(x, y) + def draw(self, renderer): if not self.get_visible(): return #renderer.open_group('patch') @@ -803,35 +845,72 @@ if self._hatch: gc.set_hatch(self._hatch ) - tverts = self.get_transform().seq_xy_tups(self.get_verts()) - # center is first vert - # take the abs since we do not want a negative width or height as this - # will cause the renderer to misbehave. - width = abs(tverts[3,0] - tverts[1,0]) - height = abs(tverts[2,1] - tverts[4,1]) + offset = self.offset - # we also have to transform the angle, do this using polar coordinates - # convert to radians - angle = self.angle * math.pi / 180.0 + - # convert the angle to polar coordinates (Assume r = 1.0) - anglex = math.cos(angle) - angley = math.sin(angle) + if not hasattr(renderer, 'draw_path'): + verbose.report('patches.Ellipse renderer does not support path drawing; falling back on vertex approximation for nonlinear transformation') + renderer.draw_polygon(gc, rgbFace, self.get_verts()) + return + - # transform the angle vertex and the origin - angle_verts = npy.array(((anglex, angley), (0.0, 0.0)), npy.float) - angle_verts = self.get_transform().seq_xy_tups(angle_verts) + x, y = self.center + theta = self.angle * npy.pi/180. + T = npy.array([ + [1, 0, x], + [0, 1, y], + [0, 0, 1]]) - # get the new x and y coords (from the origin) - anglex = angle_verts[0, 0] - angle_verts[1, 0] - angley = angle_verts[0, 1] - angle_verts[1, 1] + S = npy.array([ + [self.width/2., 0, 0], + [0, self.height/2., 0], + [0, 0, 1]]) - # convert back to an angle (in degrees) - angle = math.atan2(angley, anglex) * 180.0 / math.pi - renderer.draw_arc(gc, rgbFace, tverts[0,0], tverts[0,1], - width, height, 0.0, 360.0, angle) + + # rotate by theta + R = npy.array([ + [npy.cos(theta), -npy.sin(theta), 0], + [npy.sin(theta), npy.cos(theta), 0], + [0, 0, 1]]) + # transform unit circle into ellipse + E = npy.dot(T, npy.dot(R, S)) + + + # Apply the display affine + sx, b, c, sy, tx, ty = self.get_transform().as_vec6_val() + + # display coords + D = npy.array([ + [sx, b, tx], + [c, sy, ty], + [0, 0, 1]], npy.float_) + + M = npy.dot(D,E) + + C = npy.ones((3, len(self.circle))) + C[0:2,:] = self.circle.T + + ellipse = npy.dot(M, C).T[:,:2] + + path = agg.path_storage() + path.move_to(*ellipse[0]) + verts = ellipse[1:4].flat + path.curve4(*verts) + verts = ellipse[4:7].flat + path.curve4(*verts) + verts = ellipse[7:10].flat + path.curve4(*verts) + verts = ellipse[10:13].flat + path.curve4(*verts) + path.close_polygon() + + renderer.draw_path(gc, rgbFace, path) + + + class Circle(Ellipse): """ A circle patch Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2007-10-15 14:03:19 UTC (rev 3948) +++ trunk/matplotlib/src/_backend_agg.cpp 2007-10-15 20:00:54 UTC (rev 3949) @@ -2052,7 +2052,7 @@ theRasterizer->reset_clipping(); _VERBOSE("RendererAgg::draw_path"); - args.verify_length(4); + args.verify_length(3); GCAgg gc = GCAgg(args[0], dpi); facepair_t face = _get_rgba_face(args[1], gc.alpha); @@ -2064,43 +2064,20 @@ throw Py::TypeError("Could not convert path_storage"); - Transformation* mpltransform = static_cast<Transformation*>(args[3].ptr()); - double a, b, c, d, tx, ty; - try { - mpltransform->affine_params_api(&a, &b, &c, &d, &tx, &ty); - } - catch(...) { - throw Py::ValueError("Domain error on affine_params_api in RendererAgg::draw_path"); - } - - agg::trans_affine xytrans = agg::trans_affine(a,b,c,d,tx,ty); - double heightd = double(height); - agg::path_storage tpath; // the mpl transformed path - bool needNonlinear = mpltransform->need_nonlinear_api(); + agg::path_storage tpath; // the flipped path size_t Nx = path->total_vertices(); double x, y; unsigned cmd; bool curvy = false; for (size_t i=0; i<Nx; i++) { + + if (cmd==agg::path_cmd_curve3 || cmd==agg::path_cmd_curve4) curvy=true; cmd = path->vertex(i, &x, &y); - if (cmd==agg::path_cmd_curve3 || cmd==agg::path_cmd_curve4) curvy=true; - if (needNonlinear) - try { - mpltransform->nonlinear_only_api(&x, &y); - } - catch (...) { - throw Py::ValueError("Domain error on nonlinear_only_api in RendererAgg::draw_path"); - - } - - //use agg's transformer? - xytrans.transform(&x, &y); - y = heightd - y; //flipy - tpath.add_vertex(x,y,cmd); + tpath.add_vertex(x, heightd-y, cmd); } - + set_clipbox_rasterizer(gc.cliprect); _fill_and_stroke(tpath, gc, face, curvy); return Py::Object(); Modified: trunk/matplotlib/src/_transforms.cpp =================================================================== --- trunk/matplotlib/src/_transforms.cpp 2007-10-15 14:03:19 UTC (rev 3948) +++ trunk/matplotlib/src/_transforms.cpp 2007-10-15 20:00:54 UTC (rev 3949) @@ -1974,6 +1974,7 @@ *ty = _ty->val(); } + Py::Object Affine::as_vec6(const Py::Tuple &args) { _VERBOSE("Affine::as_vec6"); Modified: trunk/matplotlib/unit/ellipse_compare.py =================================================================== --- trunk/matplotlib/unit/ellipse_compare.py 2007-10-15 14:03:19 UTC (rev 3948) +++ trunk/matplotlib/unit/ellipse_compare.py 2007-10-15 20:00:54 UTC (rev 3949) @@ -27,27 +27,22 @@ fig = figure() ax = fig.add_subplot(211, aspect='auto') -ax.fill(x, y, alpha=0.2, facecolor='yellow') +ax.fill(x, y, alpha=0.2, facecolor='yellow', edgecolor='yellow', linewidth=1, zorder=1) e1 = patches.Ellipse((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False) + angle=angle, linewidth=2, fill=False, zorder=2) -ax.add_artist(e1) +ax.add_patch(e1) ax = fig.add_subplot(212, aspect='equal') -ax.fill(x, y, alpha=0.2, facecolor='yellow') +ax.fill(x, y, alpha=0.2, facecolor='green', edgecolor='green', zorder=1) e2 = patches.Ellipse((xcenter, ycenter), width, height, - angle=angle, linewidth=2, fill=False) + angle=angle, linewidth=2, fill=False, zorder=2) -ax.add_artist(e2) -ax.autoscale_view() +ax.add_patch(e2) - -ax.set_xlim(0.2, .5) -ax.set_ylim(0.3, 0.7) - #fig.savefig('ellipse_compare.png') -#fig.savefig('ellipse_compare.ps') +fig.savefig('ellipse_compare') show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-10-15 14:03:49
|
Revision: 3948 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3948&view=rev Author: mdboom Date: 2007-10-15 07:03:19 -0700 (Mon, 15 Oct 2007) Log Message: ----------- Merged revisions 3933-3947 via svnmerge from http://matplotlib.svn.sf.net/svnroot/matplotlib/trunk/matplotlib ........ r3935 | mdboom | 2007-10-11 13:03:50 -0400 (Thu, 11 Oct 2007) | 1 line Fixed minor import bug ........ r3941 | jdh2358 | 2007-10-14 15:00:50 -0400 (Sun, 14 Oct 2007) | 1 line added ellipse compare script ........ Modified Paths: -------------- branches/transforms/lib/matplotlib/backends/backend_agg.py branches/transforms/lib/matplotlib/backends/backend_ps.py Added Paths: ----------- branches/transforms/unit/ellipse_compare.py Modified: branches/transforms/lib/matplotlib/backends/backend_agg.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-10-15 13:49:25 UTC (rev 3947) +++ branches/transforms/lib/matplotlib/backends/backend_agg.py 2007-10-15 14:03:19 UTC (rev 3948) @@ -109,8 +109,9 @@ debug=False) if __debug__: verbose.report('RendererAgg.__init__ _RendererAgg done', 'debug-annoying') - #self.draw_path = self._renderer.draw_path - #self.draw_markers = self._renderer.draw_markers + self.draw_path = self._renderer.draw_path + self.draw_markers = self._renderer.draw_markers + self.draw_path_collection = self._renderer.draw_path_collection self.draw_image = self._renderer.draw_image self.copy_from_bbox = self._renderer.copy_from_bbox self.restore_region = self._renderer.restore_region @@ -121,26 +122,6 @@ if __debug__: verbose.report('RendererAgg.__init__ done', 'debug-annoying') - def draw_path(self, gc, path, trans, rgbFace=None): - assert trans.is_affine - self._renderer.draw_path(gc, path, trans.frozen(), rgbFace) - - def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None): - assert marker_trans.is_affine - assert trans.is_affine - self._renderer.draw_markers(gc, marker_path, marker_trans.frozen(), path, trans.frozen(), rgbFace) - - def draw_path_collection(self, master_transform, clipbox, clippath, clippath_trans, - paths, transforms, offsets, transOffset, facecolors, edgecolors, - linewidths, linestyles, antialiaseds): - assert master_transform.is_affine - if transOffset is not None: - transOffset = transOffset.frozen() - self._renderer.draw_path_collection( - master_transform.frozen(), clipbox, clippath, clippath_trans, - paths, transforms, offsets, transOffset, facecolors, edgecolors, linewidths, - linestyles, antialiaseds) - def draw_mathtext(self, gc, x, y, s, prop, angle): """ Draw the math text using matplotlib.mathtext @@ -153,11 +134,6 @@ x = int(x) + ox y = int(y) - oy self._renderer.draw_text_image(font_image, x, y + 1, angle, gc) - if 0: - self._renderer.draw_rectangle(gc, None, - int(x), - self.height-int(y), - width, height) def draw_text(self, gc, x, y, s, prop, angle, ismath): """ @@ -173,13 +149,13 @@ if len(s) == 1 and ord(s) > 127: font.load_char(ord(s), flags=LOAD_DEFAULT) else: + # We pass '0' for angle here, since it will be rotated (in raster + # space) in the following call to draw_text_image). font.set_text(s, 0, flags=LOAD_DEFAULT) font.draw_glyphs_to_bitmap() #print x, y, int(x), int(y) - # We pass '0' for angle here, since is has already been rotated - # (in vector space) in the above call to font.set_text. self._renderer.draw_text_image(font.get_image(), int(x), int(y) + 1, angle, gc) def get_text_width_height_descent(self, s, prop, ismath, rgb=(0,0,0)): Modified: branches/transforms/lib/matplotlib/backends/backend_ps.py =================================================================== --- branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-10-15 13:49:25 UTC (rev 3947) +++ branches/transforms/lib/matplotlib/backends/backend_ps.py 2007-10-15 14:03:19 UTC (rev 3948) @@ -882,7 +882,7 @@ """ # local variable eliminates all repeated attribute lookups write = self._pswriter.write - + write('gsave\n') if debugPS and command: write("% "+command+"\n") @@ -915,7 +915,7 @@ write("stroke\n") if cliprect: write("grestore\n") - + write('grestore\n') def push_gc(self, gc, store=1): """ Push the current onto stack, with the exception of the clip box, which Copied: branches/transforms/unit/ellipse_compare.py (from rev 3941, trunk/matplotlib/unit/ellipse_compare.py) =================================================================== --- branches/transforms/unit/ellipse_compare.py (rev 0) +++ branches/transforms/unit/ellipse_compare.py 2007-10-15 14:03:19 UTC (rev 3948) @@ -0,0 +1,53 @@ +""" +Compare the ellipse generated with arcs versus a polygonal approximation +""" +import numpy as npy +from matplotlib import patches +from pylab import figure, show + +xcenter, ycenter = 0.38, 0.52 +#xcenter, ycenter = 0., 0. +width, height = 1e-1, 3e-1 +angle = -30 + +theta = npy.arange(0.0, 360.0, 1.0)*npy.pi/180.0 +x = width/2. * npy.cos(theta) +y = height/2. * npy.sin(theta) + +rtheta = angle*npy.pi/180. +R = npy.array([ + [npy.cos(rtheta), -npy.sin(rtheta)], + [npy.sin(rtheta), npy.cos(rtheta)], + ]) + + +x, y = npy.dot(R, npy.array([x, y])) +x += xcenter +y += ycenter + +fig = figure() +ax = fig.add_subplot(211, aspect='auto') +ax.fill(x, y, alpha=0.2, facecolor='yellow') + +e1 = patches.Ellipse((xcenter, ycenter), width, height, + angle=angle, linewidth=2, fill=False) + +ax.add_artist(e1) + +ax = fig.add_subplot(212, aspect='equal') +ax.fill(x, y, alpha=0.2, facecolor='yellow') +e2 = patches.Ellipse((xcenter, ycenter), width, height, + angle=angle, linewidth=2, fill=False) + + +ax.add_artist(e2) +ax.autoscale_view() + + +ax.set_xlim(0.2, .5) +ax.set_ylim(0.3, 0.7) + +#fig.savefig('ellipse_compare.png') +#fig.savefig('ellipse_compare.ps') + +show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-10-15 13:49:52
|
Revision: 3947 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3947&view=rev Author: mdboom Date: 2007-10-15 06:49:25 -0700 (Mon, 15 Oct 2007) Log Message: ----------- Significant speed improvement in text layout. Reverted to fix bug in ticklabels. Lots of other minor things. Modified Paths: -------------- branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/axis.py branches/transforms/lib/matplotlib/collections.py branches/transforms/lib/matplotlib/lines.py branches/transforms/lib/matplotlib/path.py branches/transforms/lib/matplotlib/text.py branches/transforms/lib/matplotlib/transforms.py Modified: branches/transforms/lib/matplotlib/axes.py =================================================================== --- branches/transforms/lib/matplotlib/axes.py 2007-10-14 21:14:18 UTC (rev 3946) +++ branches/transforms/lib/matplotlib/axes.py 2007-10-15 13:49:25 UTC (rev 3947) @@ -1037,6 +1037,7 @@ a.set_axes(self) self.artists.append(a) self._set_artist_props(a) + a.set_clip_path(self.axesPatch) a._remove_method = lambda h: self.artists.remove(h) def add_collection(self, collection, autolim=False): @@ -1091,6 +1092,7 @@ 'Add a table instance to the list of axes tables' self._set_artist_props(tab) self.tables.append(tab) + tab.set_clip_path(self.axesPatch) tab._remove_method = lambda h: self.tables.remove(h) def relim(self): Modified: branches/transforms/lib/matplotlib/axis.py =================================================================== --- branches/transforms/lib/matplotlib/axis.py 2007-10-14 21:14:18 UTC (rev 3946) +++ branches/transforms/lib/matplotlib/axis.py 2007-10-15 13:49:25 UTC (rev 3947) @@ -91,7 +91,6 @@ self._size = size self._padPixels = self.figure.dpi * self._pad * (1/72.0) - self._locTransform = Affine2D() self.tick1line = self._get_tick1line() self.tick2line = self._get_tick2line() @@ -286,7 +285,7 @@ markersize=self._size, ) - l.set_transform(self._locTransform + self.axes.get_xaxis_transform()) + l.set_transform(self.axes.get_xaxis_transform()) self._set_artist_props(l) return l @@ -298,16 +297,20 @@ linestyle=rcParams['grid.linestyle'], linewidth=rcParams['grid.linewidth'], ) - l.set_transform(self._locTransform + self.axes.get_xaxis_transform()) + l.set_transform(self.axes.get_xaxis_transform()) self._set_artist_props(l) return l def update_position(self, loc): 'Set the location of tick in data coords with scalar loc' - self._locTransform.clear().translate(loc, 0.0) - self.label1.set_x(loc) - self.label2.set_x(loc) + x = loc + + self.tick1line.set_xdata((x,)) + self.tick2line.set_xdata((x,)) + self.gridline.set_xdata((x, )) + self.label1.set_x(x) + self.label2.set_x(x) self._loc = loc def get_view_interval(self): @@ -385,7 +388,7 @@ linestyle = 'None', markersize=self._size, ) - l.set_transform(self._locTransform + self.axes.get_yaxis_transform()) + l.set_transform(self.axes.get_yaxis_transform()) self._set_artist_props(l) return l @@ -398,7 +401,7 @@ markersize=self._size, ) - l.set_transform(self._locTransform + self.axes.get_yaxis_transform()) + l.set_transform(self.axes.get_yaxis_transform()) self._set_artist_props(l) return l @@ -411,19 +414,24 @@ linewidth=rcParams['grid.linewidth'], ) - l.set_transform(self._locTransform + self.axes.get_yaxis_transform()) + l.set_transform(self.axes.get_yaxis_transform()) self._set_artist_props(l) return l def update_position(self, loc): 'Set the location of tick in data coords with scalar loc' - self._locTransform.clear().translate(0.0, loc) - self.label1.set_y(loc) - self.label2.set_y(loc) + y = loc + self.tick1line.set_ydata((y,)) + self.tick2line.set_ydata((y,)) + self.gridline.set_ydata((y, )) + + self.label1.set_y( y ) + self.label2.set_y( y ) + self._loc = loc - + def get_view_interval(self): 'return the Interval instance for this axis view limits' return self.axes.viewLim.intervaly @@ -751,7 +759,7 @@ if len(self.minorTicks) < numticks: # update the new tick label properties from the old for i in range(numticks - len(self.minorTicks)): - tick = self._get_tick(minor=True) + tick = self._get_tick(major=False) self.minorTicks.append(tick) if self._lastNumMinorTicks < numticks: Modified: branches/transforms/lib/matplotlib/collections.py =================================================================== --- branches/transforms/lib/matplotlib/collections.py 2007-10-14 21:14:18 UTC (rev 3946) +++ branches/transforms/lib/matplotlib/collections.py 2007-10-15 13:49:25 UTC (rev 3947) @@ -43,7 +43,7 @@ linewidths=None, antialiaseds = None, offsets = None, - transOffset = transforms.identity_transform(), + transOffset = transforms.IdentityTransform(), norm = None, # optional for cm.ScalarMappable cmap = None, # ditto @@ -376,7 +376,7 @@ linewidths=None, antialiaseds = None, offsets = None, - transOffset = transforms.identity_transform(), + transOffset = transforms.IdentityTransform(), norm = None, # optional for cm.ScalarMappable cmap = None, # ditto Modified: branches/transforms/lib/matplotlib/lines.py =================================================================== --- branches/transforms/lib/matplotlib/lines.py 2007-10-14 21:14:18 UTC (rev 3946) +++ branches/transforms/lib/matplotlib/lines.py 2007-10-15 13:49:25 UTC (rev 3947) @@ -455,8 +455,10 @@ gc.set_capstyle(cap) funcname = self._lineStyles.get(self._linestyle, '_draw_nothing') - lineFunc = getattr(self, funcname) - lineFunc(renderer, gc, *self._transformed_path.get_transformed_path_and_affine()) + if funcname != '_draw_nothing': + tpath, affine = self._transformed_path.get_transformed_path_and_affine() + lineFunc = getattr(self, funcname) + lineFunc(renderer, gc, tpath, affine) if self._marker is not None: gc = renderer.new_gc() @@ -465,8 +467,10 @@ gc.set_linewidth(self._markeredgewidth) gc.set_alpha(self._alpha) funcname = self._markers.get(self._marker, '_draw_nothing') - markerFunc = getattr(self, funcname) - markerFunc(renderer, gc, *self._transformed_path.get_transformed_path_and_affine()) + if funcname != '_draw_nothing': + tpath, affine = self._transformed_path.get_transformed_path_and_affine() + markerFunc = getattr(self, funcname) + markerFunc(renderer, gc, tpath, affine) renderer.close_group('line2d') @@ -621,11 +625,9 @@ ACCEPTS: npy.array """ - try: del self._xsorted - except AttributeError: pass + self._xorig = x + self.recache() - self.set_data(x, self.get_ydata()) - def set_ydata(self, y): """ Set the data npy.array for y @@ -633,9 +635,9 @@ ACCEPTS: npy.array """ - self.set_data(self.get_xdata(), y) + self._yorig = y + self.recache() - def set_dashes(self, seq): """ Set the dash sequence, sequence of dashes with on off ink in Modified: branches/transforms/lib/matplotlib/path.py =================================================================== --- branches/transforms/lib/matplotlib/path.py 2007-10-14 21:14:18 UTC (rev 3946) +++ branches/transforms/lib/matplotlib/path.py 2007-10-15 13:49:25 UTC (rev 3947) @@ -84,7 +84,8 @@ resulting path will be compressed, with MOVETO codes inserted in the correct places to jump over the masked regions. """ - vertices = ma.asarray(vertices, npy.float_) + if not ma.isMaskedArray(vertices): + vertices = ma.asarray(vertices, npy.float_) if codes is None: if len(vertices) == 0: Modified: branches/transforms/lib/matplotlib/text.py =================================================================== --- branches/transforms/lib/matplotlib/text.py 2007-10-14 21:14:18 UTC (rev 3946) +++ branches/transforms/lib/matplotlib/text.py 2007-10-15 13:49:25 UTC (rev 3947) @@ -172,24 +172,18 @@ self._linespacing = other._linespacing def _get_layout(self, renderer): - # layout the xylocs in display coords as if angle = zero and - # then rotate them around self._x, self._y - #return _unit_box key = self.get_prop_tup() if self.cached.has_key(key): return self.cached[key] + horizLayout = [] - transform = self.get_transform() - x, y = self.get_position() - thisx, thisy = transform.transform_point((x, y)) - tx, ty = thisx, thisy - width = 0 - height = 0 - - xmin, ymin = thisx, thisy + thisx, thisy = 0.0, 0.0 + xmin, ymin = 0.0, 0.0 + width, height = 0.0, 0.0 lines = self._text.split('\n') - whs = [] + whs = npy.zeros((len(lines), 2)) + horizLayout = npy.zeros((len(lines), 4)) # Find full vertical extent of font, # including ascenders and descenders: tmp, heightt, bl = renderer.get_text_width_height_descent( @@ -197,43 +191,39 @@ offsety = heightt * self._linespacing baseline = None - for line in lines: + for i, line in enumerate(lines): w, h, d = renderer.get_text_width_height_descent( line, self._fontproperties, ismath=self.is_math_text(line)) if baseline is None: baseline = h - d - whs.append( (w,h) ) - horizLayout.append((line, thisx, thisy, w, h)) + whs[i] = w, h + horizLayout[i] = thisx, thisy, w, h thisy -= offsety width = max(width, w) - ymin = horizLayout[-1][2] - ymax = horizLayout[0][2] + horizLayout[0][-1] + ymin = horizLayout[-1][1] + ymax = horizLayout[0][1] + horizLayout[0][3] height = ymax-ymin - xmax = xmin + width + # get the rotation matrix - M = self.get_rotation_matrix(xmin, ymin) + M = Affine2D().rotate_deg(self.get_rotation()) - # the corners of the unrotated bounding box - cornersHoriz = npy.array( - [(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)], - npy.float_) offsetLayout = npy.zeros((len(lines), 2)) + offsetLayout[:] = horizLayout[:, 0:2] # now offset the individual text lines within the box if len(lines)>1: # do the multiline aligment malign = self._get_multialignment() - for i, (line, thisx, thisy, w, h) in enumerate(horizLayout): - if malign=='center': offsetx = width/2.0-w/2.0 - elif malign=='right': offsetx = width-w - else: offsetx = 0 - thisx += offsetx - offsetLayout[i] = (thisx, thisy) - else: # no additional layout needed - offsetLayout[0] = horizLayout[0][1:3] + if malign == 'center': + offsetLayout[:, 0] += width/2.0 - horizLayout[:, 2] / 2.0 + elif malign == 'right': + offsetLayout[:, 0] += width - horizLayout[:, 2] + # the corners of the unrotated bounding box + cornersHoriz = npy.array( + [(xmin, ymin), (xmin, ymax), (xmax, ymax), (xmax, ymin)], + npy.float_) # now rotate the bbox - cornersRotated = M.transform(cornersHoriz) txs = cornersRotated[:, 0] @@ -251,37 +241,30 @@ # compute the text location in display coords and the offsets # necessary to align the bbox with that location - tx, ty = self._get_xy_display() + if halign=='center': offsetx = (xmin + width/2.0) + elif halign=='right': offsetx = (xmin + width) + else: offsetx = xmin - if halign=='center': offsetx = tx - (xmin + width/2.0) - elif halign=='right': offsetx = tx - (xmin + width) - else: offsetx = tx - xmin + if valign=='center': offsety = (ymin + height/2.0) + elif valign=='top': offsety = (ymin + height) + elif valign=='baseline': offsety = (ymin + height) + baseline + else: offsety = ymin - if valign=='center': offsety = ty - (ymin + height/2.0) - elif valign=='top': offsety = ty - (ymin + height) - elif valign=='baseline': offsety = ty - (ymin + height) + baseline - else: offsety = ty - ymin + xmin -= offsetx + ymin -= offsety - xmin += offsetx - ymin += offsety - bbox = Bbox.from_lbwh(xmin, ymin, width, height) # now rotate the positions around the first x,y position xys = M.transform(offsetLayout) - xys += (offsetx, offsety) + xys -= (offsetx, offsety) - # now inverse transform back to data coords - inverse_transform = transform.inverted() - xys = inverse_transform.transform(xys) - xs, ys = xys[:, 0], xys[:, 1] ret = bbox, zip(lines, whs, xs, ys) self.cached[key] = ret return ret - def set_bbox(self, rectprops): """ Draw a bounding box around self. rect props are any settable @@ -307,18 +290,20 @@ if self.get_clip_on(): gc.set_clip_rectangle(self.clipbox) - - if self._bbox: bbox_artist(self, renderer, self._bbox) angle = self.get_rotation() bbox, info = self._get_layout(renderer) trans = self.get_transform() + posx, posy = self.get_position() + posx, posy = trans.transform_point((posx, posy)) + canvasw, canvash = renderer.get_canvas_width_height() + if rcParams['text.usetex']: - canvasw, canvash = renderer.get_canvas_width_height() for line, wh, x, y in info: - x, y = trans.transform_point((x, y)) + x = x + posx + y = y + posy if renderer.flipy(): y = canvash-y @@ -326,9 +311,9 @@ self._fontproperties, angle) return - canvasw, canvash = renderer.get_canvas_width_height() for line, wh, x, y in info: - x, y = trans.transform_point((x, y)) + x = x + posx + y = y + posy if renderer.flipy(): y = canvash-y @@ -402,8 +387,7 @@ x, y = self.get_position() return (x, y, self._text, self._color, self._verticalalignment, self._horizontalalignment, - hash(self._fontproperties), self._rotation, - self.get_transform().id + hash(self._fontproperties), self._rotation ) def get_text(self): @@ -432,11 +416,11 @@ angle = self.get_rotation() bbox, info = self._get_layout(self._renderer) + x, y = self.get_position() + x, y = self.get_transform().transform_point((x, y)) + bbox = bbox.translated(x, y) return bbox - def get_rotation_matrix(self, x0, y0): - return Affine2D().rotate_deg_around(x0, y0, self.get_rotation()) - def set_backgroundcolor(self, color): """ Set the background color of the text by updating the bbox (see set_bbox for more info) Modified: branches/transforms/lib/matplotlib/transforms.py =================================================================== --- branches/transforms/lib/matplotlib/transforms.py 2007-10-14 21:14:18 UTC (rev 3946) +++ branches/transforms/lib/matplotlib/transforms.py 2007-10-15 13:49:25 UTC (rev 3947) @@ -34,8 +34,6 @@ DEBUG = False -# MGDTODO: Cache get_affine??? - class TransformNode(object): """ TransformNode is the base class for anything that participates in @@ -51,7 +49,7 @@ # INVALID_AFFINE_ONLY INVALID_NON_AFFINE = 1 INVALID_AFFINE = 2 - INVALID = INVALID_NON_AFFINE & INVALID_AFFINE + INVALID = INVALID_NON_AFFINE | INVALID_AFFINE # Some metadata about the transform, used to determine whether an # invalidation is affine-only @@ -71,11 +69,6 @@ # them alive. self._parents = WeakKeyDictionary() - # id is an arbitrary integer that is updated every time the node - # is invalidated. - self.id = TransformNode._gid - TransformNode._gid += 1 - # TransformNodes start out as invalid until their values are # computed for the first time. self._invalid = 1 @@ -105,15 +98,14 @@ value = ((self.is_affine or self.is_bbox) and self.INVALID_AFFINE or self.INVALID) - + # Invalidate all ancestors of self using pseudo-recursion. + parent = None stack = [self] while len(stack): root = stack.pop() # Stop at subtrees that have already been invalidated if root._invalid == 0 or root.pass_through: - root.id = TransformNode._gid - TransformNode._gid += 1 root._invalid = value stack.extend(root._parents.keys()) @@ -466,8 +458,7 @@ count = 0 for bbox in bboxes: - # bx1, by1, bx2, by2 = bbox._get_lbrt() - # The above, inlined... + # bx1, by1, bx2, by2 = bbox._get_lbrt() ... inlined... bx1, by1, bx2, by2 = bbox.get_points().flatten() if bx2 < bx1: bx2, bx1 = bx1, bx2 @@ -497,6 +488,26 @@ """ return Bbox(self._points + (tx, ty)) + def corners(self): + """ + Return an array of points which are the four corners of this + rectangle. + """ + l, b, r, t = self.get_points().flatten() + return npy.array([[l, b], [l, t], [r, b], [r, t]]) + + def rotated(self, radians): + """ + Return a new bounding box that bounds a rotated version of this + bounding box. The new bounding box is still aligned with the + axes, of course. + """ + corners = self.corners() + corners_rotated = Affine2D().rotate(radians).transform(corners) + bbox = Bbox.unit() + bbox.update_from_data(corners_rotated, ignore=True) + return bbox + #@staticmethod def union(bboxes): """ @@ -965,7 +976,6 @@ self.transform_path_non_affine = child.transform_path_non_affine self.get_affine = child.get_affine self.inverted = child.inverted - # self.get_matrix = child.get_matrix def set(self, child): """ @@ -1609,7 +1619,8 @@ self._x = x_transform self._y = y_transform self.set_children(x_transform, y_transform) - + self._affine = None + def _get_is_affine(self): return self._x.is_affine and self._y.is_affine is_affine = property(_get_is_affine) @@ -1648,9 +1659,7 @@ transform.__doc__ = Transform.transform.__doc__ def transform_affine(self, points): - if self._x.is_affine and self._y.is_affine: - return self.transform(points) - return points + return self.get_affine().transform(points) transform_affine.__doc__ = Transform.transform_affine.__doc__ def transform_non_affine(self, points): @@ -1664,18 +1673,22 @@ inverted.__doc__ = Transform.inverted.__doc__ def get_affine(self): - if self._x.is_affine and self._y.is_affine: - if self._x == self._y: - return self._x.get_affine() + if self._invalid or self._affine is None: + if self._x.is_affine and self._y.is_affine: + if self._x == self._y: + self._affine = self._x.get_affine() + else: + x_mtx = self._x.get_affine().get_matrix() + y_mtx = self._y.get_affine().get_matrix() + # This works because we already know the transforms are + # separable, though normally one would want to set b and + # c to zero. + mtx = npy.vstack((x_mtx[0], y_mtx[1], [0.0, 0.0, 1.0])) + self._affine = Affine2D(mtx) else: - x_mtx = self._x.get_affine().get_matrix() - y_mtx = self._y.get_affine().get_matrix() - # This works because we already know the transforms are - # separable, though normally one would want to set b and - # c to zero. - mtx = npy.vstack((x_mtx[0], y_mtx[1], [0.0, 0.0, 1.0])) - return Affine2D(mtx) - return IdentityTransform() + self._affine = IdentityTransform() + self._invalid = 0 + return self._affine get_affine.__doc__ = Transform.get_affine.__doc__ @@ -1830,6 +1843,7 @@ self._b = b self.set_children(a, b) self._mtx = None + self._affine = None def frozen(self): self._invalid = 0 @@ -1857,8 +1871,7 @@ transform.__doc__ = Transform.transform.__doc__ def transform_affine(self, points): - return self._b.transform_affine( - self._a.transform(points)) + return self.get_affine().transform(points) transform_affine.__doc__ = Transform.transform_affine.__doc__ def transform_non_affine(self, points): @@ -1886,10 +1899,14 @@ transform_path_non_affine.__doc__ = Transform.transform_path_non_affine.__doc__ def get_affine(self): - if self._a.is_affine and self._b.is_affine: - return Affine2D(npy.dot(self._b.get_affine().get_matrix(), - self._a.get_affine().get_matrix())) - return self._b.get_affine() + if self._invalid or self._affine is None: + if self._a.is_affine and self._b.is_affine: + self._affine = Affine2D(npy.dot(self._b.get_affine().get_matrix(), + self._a.get_affine().get_matrix())) + else: + self._affine = self._b.get_affine() + self._invalid = 0 + return self._affine get_affine.__doc__ = Transform.get_affine.__doc__ def inverted(self): @@ -2023,6 +2040,7 @@ self._transform = transform self.set_children(transform) self._transformed_path = None + self.get_affine = self._transform.get_affine def get_transformed_path_and_affine(self): """ @@ -2035,7 +2053,7 @@ self._transformed_path = \ self._transform.transform_path_non_affine(self._path) self._invalid = 0 - return self._transformed_path, self._transform.get_affine() + return self._transformed_path, self.get_affine() def get_fully_transformed_path(self): """ @@ -2047,12 +2065,6 @@ self._transform.transform_path_non_affine(self._path) self._invalid = 0 return self._transform.transform_path_affine(self._transformed_path) - - def get_affine(self): - """ - Get the affine part of the child transform. - """ - return self._transform.get_affine() def nonsingular(vmin, vmax, expander=0.001, tiny=1e-15, increasing=True): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fer...@us...> - 2007-10-14 21:14:22
|
Revision: 3946 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3946&view=rev Author: fer_perez Date: 2007-10-14 14:14:18 -0700 (Sun, 14 Oct 2007) Log Message: ----------- Directory reorg Added Paths: ----------- trunk/py4science/tools/course_checklist.py trunk/py4science/tools/course_checklist_umich.py Removed Paths: ------------- trunk/py4science/course_checklist.py trunk/py4science/course_checklist_umich.py Deleted: trunk/py4science/course_checklist.py =================================================================== --- trunk/py4science/course_checklist.py 2007-10-14 21:13:52 UTC (rev 3945) +++ trunk/py4science/course_checklist.py 2007-10-14 21:14:18 UTC (rev 3946) @@ -1,15 +0,0 @@ -#!/usr/bin/env python -"""Minimal test script to check for modules needed in python course""" - -modules = ['numpy','scipy','matplotlib','IPython','mayavi','pyvtk','Image', - 'visual'] - -for mname in modules: - try: - exec "import %s" % mname - except ImportError: - print '*** ERROR: module %s could not be imported.' % mname - else: - print '%s: OK' % mname - -print 'Also remember to check that SPE is installed.' Deleted: trunk/py4science/course_checklist_umich.py =================================================================== --- trunk/py4science/course_checklist_umich.py 2007-10-14 21:13:52 UTC (rev 3945) +++ trunk/py4science/course_checklist_umich.py 2007-10-14 21:14:18 UTC (rev 3946) @@ -1,15 +0,0 @@ -#!/usr/bin/env python -"""Minimal test script to check for modules needed in python course""" - -modules = ['numpy','scipy','matplotlib','IPython'] - - -for mname in modules: - try: - exec "import %s" % mname - except ImportError: - print '*** ERROR: module %s could not be imported.' % mname - else: - print '%s: OK' % mname - -print 'Also remember to check that SPE is installed.' Copied: trunk/py4science/tools/course_checklist.py (from rev 3944, trunk/py4science/course_checklist.py) =================================================================== --- trunk/py4science/tools/course_checklist.py (rev 0) +++ trunk/py4science/tools/course_checklist.py 2007-10-14 21:14:18 UTC (rev 3946) @@ -0,0 +1,15 @@ +#!/usr/bin/env python +"""Minimal test script to check for modules needed in python course""" + +modules = ['numpy','scipy','matplotlib','IPython','mayavi','pyvtk','Image', + 'visual'] + +for mname in modules: + try: + exec "import %s" % mname + except ImportError: + print '*** ERROR: module %s could not be imported.' % mname + else: + print '%s: OK' % mname + +print 'Also remember to check that SPE is installed.' Copied: trunk/py4science/tools/course_checklist_umich.py (from rev 3944, trunk/py4science/course_checklist_umich.py) =================================================================== --- trunk/py4science/tools/course_checklist_umich.py (rev 0) +++ trunk/py4science/tools/course_checklist_umich.py 2007-10-14 21:14:18 UTC (rev 3946) @@ -0,0 +1,15 @@ +#!/usr/bin/env python +"""Minimal test script to check for modules needed in python course""" + +modules = ['numpy','scipy','matplotlib','IPython'] + + +for mname in modules: + try: + exec "import %s" % mname + except ImportError: + print '*** ERROR: module %s could not be imported.' % mname + else: + print '%s: OK' % mname + +print 'Also remember to check that SPE is installed.' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fer...@us...> - 2007-10-14 21:13:57
|
Revision: 3945 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3945&view=rev Author: fer_perez Date: 2007-10-14 14:13:52 -0700 (Sun, 14 Oct 2007) Log Message: ----------- Add generic tools directory for useful scripts Added Paths: ----------- trunk/py4science/tools/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fer...@us...> - 2007-10-14 21:13:00
|
Revision: 3944 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3944&view=rev Author: fer_perez Date: 2007-10-14 14:12:58 -0700 (Sun, 14 Oct 2007) Log Message: ----------- Remove unnecessary web.tap file Removed Paths: ------------- trunk/py4science/web.tap Deleted: trunk/py4science/web.tap =================================================================== --- trunk/py4science/web.tap 2007-10-14 20:44:08 UTC (rev 3943) +++ trunk/py4science/web.tap 2007-10-14 21:12:58 UTC (rev 3944) @@ -1,38 +0,0 @@ -(ctwisted.python.components -Componentized -qoq}q(U:twisted.python.components.Componentized.persistenceVersionqKU -_adapterCacheq}q(U.twisted.application.service.IServiceCollectionq(ctwisted.application.service -MultiService -qoq }q -(Uservicesq]q(hoq -}q(h]q(ctwisted.application.internet -TCPServer -qoq}q(Uargsq(M\x90(ctwisted.web.server -Site -qoq}q(UlogPathqNUresourceq(ctwisted.web.static -File -qoq}q(UignoredExtsq]qU -processorsq}q(U.phpq ctwisted.web.twcgi -PHPScript -q!U.epyq"ctwisted.web.script -PythonScript -q#U.trpq$ctwisted.web.trp -ResourceUnpickler -q%U.php3q&ctwisted.web.twcgi -PHP3Script -q'U.rpyq(ctwisted.web.script -ResourceScript -q)U.cgiq*ctwisted.web.twcgi -CGIScript -q+uU*twisted.web.static.File.persistenceVersionq,KUpathq-U&/home/fperez/prof/teach/py4science/pubq.UdefaultTypeq/U text/htmlq0Uchildrenq1}q2Uregistryq3(ctwisted.web.static -Registry -q4oq5}q6(U.twisted.web.static.Registry.persistenceVersionq7KU:twisted.python.components.Componentized.persistenceVersionq8KU -_pathCacheq9}q:h}q;U.twisted.internet.interfaces.IServiceCollectionq<h -sububUtimeOutq=M\xC0\xA8UdisplayTracebacksq>I01 -Usessionsq?}q@ubtqAUparentqBh -UkwargsqC}qD(U interfaceqEU |
From: <fer...@us...> - 2007-10-14 20:44:09
|
Revision: 3943 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3943&view=rev Author: fer_perez Date: 2007-10-14 13:44:08 -0700 (Sun, 14 Oct 2007) Log Message: ----------- Fix typo in a formula. Modified Paths: -------------- trunk/py4science/workbook/trapezoid.lyx trunk/py4science/workbook/trapezoid.tex Modified: trunk/py4science/workbook/trapezoid.lyx =================================================================== --- trunk/py4science/workbook/trapezoid.lyx 2007-10-14 19:11:32 UTC (rev 3942) +++ trunk/py4science/workbook/trapezoid.lyx 2007-10-14 20:44:08 UTC (rev 3943) @@ -120,7 +120,7 @@ ) becomes \begin_inset Formula \begin{equation} -\int_{a}^{b}f(x)dx\approx\frac{1}{2}\sum_{i=1}^{n}\left(x_{i}-x_{i-1}\right)\left(y_{i}+y_{i+1}\right).\label{eq:trapz}\end{equation} +\int_{a}^{b}f(x)dx\approx\frac{1}{2}\sum_{i=1}^{n}\left(x_{i}-x_{i-1}\right)\left(y_{i}+y_{i-1}\right).\label{eq:trapz}\end{equation} \end_inset Modified: trunk/py4science/workbook/trapezoid.tex =================================================================== --- trunk/py4science/workbook/trapezoid.tex 2007-10-14 19:11:32 UTC (rev 3942) +++ trunk/py4science/workbook/trapezoid.tex 2007-10-14 20:44:08 UTC (rev 3943) @@ -23,7 +23,7 @@ \int_{a}^{b}f(x)dx\approx\frac{h}{2}\sum_{i=1}^{n}\left(f(x_{i})+f(x_{i+1})\right).\label{eq:trapzf2}\end{equation} One frequently receives the function values already precomputed, $y_{i}=f(x_{i}),$ so equation~(\ref{eq:trapzf}) becomes \begin{equation} -\int_{a}^{b}f(x)dx\approx\frac{1}{2}\sum_{i=1}^{n}\left(x_{i}-x_{i-1}\right)\left(y_{i}+y_{i+1}\right).\label{eq:trapz}\end{equation} +\int_{a}^{b}f(x)dx\approx\frac{1}{2}\sum_{i=1}^{n}\left(x_{i}-x_{i-1}\right)\left(y_{i}+y_{i-1}\right).\label{eq:trapz}\end{equation} % This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <fer...@us...> - 2007-10-14 19:12:03
|
Revision: 3942 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3942&view=rev Author: fer_perez Date: 2007-10-14 12:11:32 -0700 (Sun, 14 Oct 2007) Log Message: ----------- - Fixes to main book so it compiles to PDF directly from LyX, without having to use the kludgy lyxport script at all. - Update some of the examples with minor fixes. - Add new workbook directory. For now, I added the .tex files as well, though they are generated from LyX, so John can use the system without LyX while I'm gone. Once I'm back, we can decide how to best do this in the long run. Modified Paths: -------------- trunk/py4science/book/fig/hothead.eps trunk/py4science/book/fig/load_ascii.eps trunk/py4science/book/main.lyx trunk/py4science/examples/quad_newton.py trunk/py4science/examples/schrodinger/schrod_fdtd.py trunk/py4science/examples/skel/quad_newton_skel.py trunk/py4science/examples/skel/trapezoid_skel.py trunk/py4science/examples/skel/wordfreqs_skel.py trunk/py4science/examples/trapezoid.py trunk/py4science/examples/wallis_pi.py Added Paths: ----------- trunk/py4science/workbook/ trunk/py4science/workbook/fig/ trunk/py4science/workbook/fig/Composite_trapezoidal_rule_illustration.png trunk/py4science/workbook/fig/wallis_pi_convergence.eps trunk/py4science/workbook/fig/wallis_pi_convergence.pdf trunk/py4science/workbook/intro.lyx trunk/py4science/workbook/intro.tex trunk/py4science/workbook/main.lyx trunk/py4science/workbook/main.tex trunk/py4science/workbook/preamble.tex trunk/py4science/workbook/qsort.lyx trunk/py4science/workbook/qsort.tex trunk/py4science/workbook/quad_newton.lyx trunk/py4science/workbook/quad_newton.tex trunk/py4science/workbook/skel trunk/py4science/workbook/trapezoid.lyx trunk/py4science/workbook/trapezoid.tex trunk/py4science/workbook/wallis_pi.lyx trunk/py4science/workbook/wallis_pi.tex trunk/py4science/workbook/wordfreqs.lyx trunk/py4science/workbook/wordfreqs.tex Modified: trunk/py4science/book/fig/hothead.eps =================================================================== --- trunk/py4science/book/fig/hothead.eps 2007-10-14 19:00:50 UTC (rev 3941) +++ trunk/py4science/book/fig/hothead.eps 2007-10-14 19:11:32 UTC (rev 3942) @@ -1,385 +1,9190 @@ %!PS-Adobe-3.0 EPSF-3.0 -%%Title: /home/jdhunter/cyber/cyberpy/roadshow/fig/hothead.eps -%%Creator: matplotlib version 0.81, http://matplotlib.sourceforge.net/ -%%CreationDate: Tue Jun 7 15:25:48 2005 -%%BoundingBox: 18 180 594 612 +%%Creator: (ImageMagick) +%%Title: (/tmp/lyx_tmpdir9363Ed1GeG/lyx_tmpbuf0/2_home_fperez_teach_py4science_book_fig_hothead.eps) +%%CreationDate: (Sat Oct 13 14:29:25 2007) +%%BoundingBox: 0 0 1200 900 +%%HiResBoundingBox: 0 0 1200 900 +%%DocumentData: Clean7Bit +%%LanguageLevel: 1 +%%Pages: 1 %%EndComments + +%%BeginDefaults +%%EndDefaults + %%BeginProlog -/mpldict 7 dict def -mpldict begin -/m { moveto } bind def -/l { lineto } bind def -/r { rlineto } bind def -/box { -m -1 index 0 r -0 exch r -neg 0 r -closepath +% +% Display a color image. The image is displayed in color on +% Postscript viewers or printers that support color, otherwise +% it is displayed as grayscale. +% +/DirectClassPacket +{ + % + % Get a DirectClass packet. + % + % Parameters: + % red. + % green. + % blue. + % length: number of pixels minus one of this color (optional). + % + currentfile color_packet readhexstring pop pop + compression 0 eq + { + /number_pixels 3 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add 3 mul def + } ifelse + 0 3 number_pixels 1 sub + { + pixels exch color_packet putinterval + } for + pixels 0 number_pixels getinterval } bind def -/clipbox { -box -clip -newpath + +/DirectClassImage +{ + % + % Display a DirectClass image. + % + systemdict /colorimage known + { + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { DirectClassPacket } false 3 colorimage + } + { + % + % No colorimage operator; convert to grayscale. + % + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { GrayDirectClassPacket } image + } ifelse } bind def -/ellipse { -newpath -matrix currentmatrix 7 1 roll -translate -scale -0 0 1 5 3 roll arc -setmatrix -closepath + +/GrayDirectClassPacket +{ + % + % Get a DirectClass packet; convert to grayscale. + % + % Parameters: + % red + % green + % blue + % length: number of pixels minus one of this color (optional). + % + currentfile color_packet readhexstring pop pop + color_packet 0 get 0.299 mul + color_packet 1 get 0.587 mul add + color_packet 2 get 0.114 mul add + cvi + /gray_packet exch def + compression 0 eq + { + /number_pixels 1 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add def + } ifelse + 0 1 number_pixels 1 sub + { + pixels exch gray_packet put + } for + pixels 0 number_pixels getinterval } bind def -%%BeginFont: Verdana -%!PS-TrueType-1.0-1.0 -8 dict begin -/FontName /Verdana def -/FontMatrix [1 0 0 1 0 0] def -/FontType 42 def -/Encoding StandardEncoding def -/FontBBox [-102 -423 2963 2049] def -/PaintType 0 def -/FontInfo 7 dict dup begin -/Notice (Typeface and data \xA9 1996 Microsoft Corporation. All Rights Reserved) def -/FamilyName (Verdana) def -/FullName (Verdana) def -/version (Version 2.35) def -/isFixedPitch false def -/UnderlinePosition -180 def -/UnderlineThickness 120 def -end readonly def -/sfnts [ -<00010000001301000004003044534947CD5006A400020D64000014144C5453485694D82F -00001530000003814F532F32477590C3000001B80000005656444D5874F17C6D000018B4 -000005E0636D6170E84D8B8B000007A80000068C637674204CA740E3000022AC00000198 -6670676DEE371553000021740000013867617370001700090000021000000010676C7966 -01F195F700009EC000013BB668646D7809490ECD0000323800006C8868656164C748722C -0000013C0000003668686561133B09D00000017400000024686D7478C905723E00002444 -00000DF46B65726E75BF7E53000200CC00000C966C6F63616784B57700000E34000006FC -6D617870086A023E00000198000000206E616D65A93B95720000022000000587706F7374 -C58F55450001DA7800002651707265701240C02F00001E94000002E00001000000010000 -16FBFC3A5F0F3CF5001B080000000000AA7E442900000000B26DE2ABFF9AFE590B930801 -00000009000200000000000000010000080BFE5200000C2CFF9AFBD40B93000100000000 -00000000000000000000037D00010000037D00620007006B000500020010002F00380000 -0495013F0003000100010411019000050000059A053300000125059A0533000003A00078 -02A70800020B0604030504040204000002870000000000000000000000004D5320200040 -0020FB02061EFE5900CA080B01AE2000019F000000000000000000030008000200100001 -FFFF00030000002801E60001000000000000004300000001000000000001000700430001 -0000000000020007004A0001000000000003002F00510001000000000004000700800001 -000000000005000C00870001000000000006000700930001000000000007002F009A0003 -000104030002000C00C90003000104050002001000D50003000104060002000C00E50003 -000104070002001000F10003000104080002001001010003000104090000008601110003 -000104090001000E01970003000104090002000E01A50003000104090003005E01B30003 -000104090004000E021100030001040900050018021F0003000104090006000E02370003 -000104090007005E024500030001040A0002000C02A300030001040B0002001002AF0003 -0001040C0002000C02BF00030001040E0002000C02CB0003000104100002000E02D70003 -000104130002001202E50003000104140002000C02F70003000104150002001003030003 -000104160002000C03130003000104190002000E031F00030001041B00020010032D0003 -0001041D0002000C033D00030001041F0002000C03490003000104240002000E03550003 -0001042D0002000E036300030001080A0002000C03710003000108160002000C037D0003 -00010C0A0002000C0389000300010C0C0002000C0395547970656661636520616E642064 -61746120A92031393936204D6963726F736F667420436F72706F726174696F6E2E20416C -6C2052696768747320526573657276656456657264616E61526567756C61724D6963726F -736F66743A56657264616E6120526567756C61723A56657273696F6E203120284D696372 -6F736F66742956657264616E6156657273696F6E20322E333556657264616E6156657264 -616E6120697320612074726164656D61726B206F66204D6963726F736F667420436F7270 -6F726174696F6E004E006F0072006D0061006C006F00620079010D0065006A006E00E900 -6E006F0072006D0061006C005300740061006E0064006100720064039A03B103BD03BF03 -BD03B903BA03AC0054007900700065006600610063006500200061006E00640020006400 -6100740061002000A9002000310039003900360020004D006900630072006F0073006F00 -66007400200043006F00720070006F0072006100740069006F006E002E00200041006C00 -6C0020005200690067006800740073002000520065007300650072007600650064005600 -65007200640061006E00610052006500670075006C00610072004D006900630072006F00 -73006F00660074003A00560065007200640061006E006100200052006500670075006C00 -610072003A00560065007200730069006F006E0020003100200028004D00690063007200 -6F0073006F00660074002900560065007200640061006E00610056006500720073006900 -6F006E00200032002E0033003500560065007200640061006E0061005600650072006400 -61006E006100200069007300200061002000740072006100640065006D00610072006B00 -20006F00660020004D006900630072006F0073006F0066007400200043006F0072007000 -6F0072006100740069006F006E004E006F0072006D0061006C004E006F0072006D006100 -61006C0069004E006F0072006D0061006C004E006F0072006D00E1006C004E006F007200 -6D0061006C0065005300740061006E00640061006100720064004E006F0072006D006100 -6C004E006F0072006D0061006C006E0079004E006F0072006D0061006C041E0431044B04 -47043D044B0439004E006F0072006D00E1006C006E0065004E006F0072006D0061006C00 -4E006F0072006D0061006C004E0061007600610064006E006F0041007200720075006E00 -740061004E006F0072006D0061006C004E006F0072006D0061006C004E006F0072006D00 -61006C004E006F0072006D0061006C00000000020001000000000014000300010000011A -000001060000010000000000000001020000000200000000000000000000000000000001 -0000030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F2021222324 -25262728292A2B2C2D2E2F303132333435363738393A3B3C3D3E3F404142434445464748 -494A4B4C4D4E4F505152535455565758595A5B5C5D5E5F60610062636465666768696A6B -6C6D6E6F707172737475767778797A7B7C7D7E7F808182838485868788898A8B8C8D8E8F -909192939495969798999A9B9C9D9E9FA0A1A2A3A4A5A6A7A8A9AAAB03ACADAEAFB0B1B2 -B3B4B5B6B7B8B9BABBBCBDBEBFC0C1C2C3C4C5C6C7C8C9CACBCCCDCECFD000D1D2D3D4D5 -D6D7D8D9DADBDCDDDEDF0004057200000084008000060004007E017F019201A101B001FF -02C702C902DD0301030303090323037E038A038C03A103CE040C044F045C045F04911E85 -1EF92015201E2022202620302033203A203C203E2044207F20A420A720AC210521132116 -21222126212E215E22022206220F22122215221A221E222B22482260226525A125AB25CA -25CF25E6F002F00DFB02FFFF0000002000A0019201A001AF01FA02C602C902D803000303 -03090323037E0384038C038E03A30401040E0451045E04901E801EA02013201720202026 -203020322039203C203E2044207F20A320A720AB21052113211621222126212E215B2202 -2206220F221122152219221E222B22482260226425A125AA25CA25CF25E6F001F004FB01 -FFFFFFE30000FF1400A60099FF8A0000FE0F0000FF4C0078FF41FF28FCA00000FE170000 -0000FDD9FDD8FDD7FDD6FDA6E30B0000000000000000E085E095E109E084E0F9E156E077 -E0B70000E0900000E038E02BE123DF6ADF79E068E03CDE96DEA2DE8B0000DEA60000DE74 -DE71DE5FDE2FDE30DB9EDB96DAEEDB73DB5D10BE000005BE000100000082000000000000 -000002380000023800000000000000000000023800000242026800000000000000000000 -000002B203640368037600000000000000000000000000000000036A0000036A00000000 -000000000000000000000000000000000358000003580000000000000000000000000000 -0000000000000000034400000000000300A300840085037C009600E60086008E008B009D -00A900A40010008A01000083009300F000F1008D00970088010100DC00EF009E00AA00F3 -00F200F400A200AC00C800C600AD006200630090006400CA006500C700C900CE00CB00CC -00CD00E7006600D100CF00D000AE006700EE009100D400D200D3006800E900EB0089006A -0069006B006D006C006E00A0006F0071007000720073007500740076007700E80078007A -0079007B007D007C00B700A1007F007E0080008100EA00EC00B901440145010201030104 -010500FB00FC014601470148014900FD00FE01060107010800FF014A014B014C014D014E -014F0109010A010B010C0150015100F600F701520153015401550156015701580159015A -015B015C015D015E015F0160016100F800D50138013901620163016401650166010D010E -01670168010F01100111011200E000E1011301140169016A01150116013A016B016C016D -016E016F01700117011800AF00B00119011A01710172011B011C011D011E0173017400F9 -00FA00E200E3011F01200121012201750176017701780179017A017B017C012301240125 -0126017D017E017F01800181018200BA012701280129012A00E400E5018300D600DF00D9 -00DA00DB00DE00D700DD019D019E019F018A01A001A101A201A401A501A601A701A8012B -01A901AA01AB01AC012C01AD01AE01AF01B001B101B201B301B401B501B601B701B8012D -01B901BA01BB01BC01BD01BE01BF01C001C101C2012E01C301C4012F013001C501C601C7 -01C801C901CA01CB01CC01CD01CE023A01CF01D00131013201D1013301D201D301D401D5 -01D601D701D801D9025D025E025F0260026102620263026402650266026702680269026A -026B026C026D026E026F0270027102720273027402750276027702780279027A027B027C -027D027E027F028002810282028302840285028602870288034C034D034E034F03500351 -03520353035403550356035703580359035A035B035C035D035E035F0360036103620363 -036403650366036703680369036A036B036C036D036E036F037003710191019203740375 -037603770378037900B100B20238013400B500B600C3019300B300B400C4008200C10087 -00F50195037A00BC009900ED00C200A5019B019C023B023C023D023E023F024002410242 -0000001F001F001F001F00470070010401C0025F033C035503A203F10461049604C004DE -04F50520057F05B9063806DB072D07A70830086B090B099309B509F10A350A640AAA0B13 -0BF80C600CDC0D4F0DA00DD60E060E7A0EAE0EDB0F180F860FA61000104C10B8111711AE -122012B812DF132C13881407148814DF15221544156F159015C815DE15FE168916E71747 -17A01803184F18D11912193D198C19E51A001A761AB61B011B5D1BB81BF51C8B1CDB1D1B -1D741DD91E641EC21F041F631F7E1FDC203B205520FE21AA21BD21D021E9220222142226 -2238225322652278230A231C232E234023562369237C23B423EE2400241224242436244C -245E24702482249424AB24E62520259A260826EB270B274327C928832929297B299C29C2 -2A2D2A912B412BCD2C0D2C5A2CA82D0C2D4C2DCB2E3D2E722E9F2EE92F5E2F9F301130E7 -316D31D831FF3223326032DF336433A233F33443346D3480349334A6350E35AD35C735DD -361C365B368036A736E33728373F37593777382D3858388438E139313986399E39C43A03 -3AD73AEA3AFD3B103B243B373B4A3B5D3B773B8A3B9D3BB03BC33BD63BE93BFC3C173C47 -3C8E3CA63CEC3D003D493D7D3DB53DEA3E1B3E5B3E923EA53EB73ECA3EDC3F043F6B3FFF -40124024408840E441014135416941BB4239425A427E42AA42F643024314432743F044AF -44C244D444E744F9456F4586459E45B145C3465F47144727479D47A54806489348A648B8 -48CB48F0492B4961499249BC49CF49E149F44A064A1A4A2D4A404A534A664A794A8C4A9E -4AEE4B6C4B7F4BEC4C354C484C5C4C6F4C824C954CA84CBA4CDA4D584DDD4E3C4EC24F58 -4FB24FE1505D5081509D50E951DF51EF52085268528B52CA538353FD5425543F54665491 -54EA54FC550D551F55345546555B556D557E559055A455B655C755D955EE5600561556B8 -575B576D578757DE583458A458FC593F596C59C05A035A595AB15AC85B225B335B495BA2 -5BEB5C305C465C5C5CD25D2E5D405D515D635D745D855DEA5DFC5E105E4E5EBA5ECC5EDD -5EEF5F005F125F235FA2600E6020603260446055608561656246625C626E6285629A62B1 -62C362D562E762F963166332634963606388639E6422648E64AA64D76504653065556589 -65A265DD65F36611662F664F666E668E66B16700670867106752675A6762676A6772677A -67C367CB67D36812681A6840684868DA68E268EA68F2695D69DC69F66A106A216A376A48 -6A5B6A6F6AFD6B4A6BBD6BFF6C866C8E6D226D7A6DC16DC96E726E7A6ECF6F3B6F7A6FEA -705A70F370FB7112712371347146715A71C571DD7255725D7265727F7287731C738773DE -73F3749074C174C97521752975497594759C765676F2773A77AE783B7892789A78A278AA -78D078D878E078E8795979DE79E67A167A5D7A907ACD7B297B907BE47C5F7CCD7D367D3E -7DCA7E4C7E6C7EBC7EC47F7D8015804D80B18126817B81D38203820B82308238829A82C9 -82D1836C837483AC83EF8425846784C3852B858085F4865386BD86D38757876887D587DD -87E587ED87F5888B88F9894F896489EE8A258A4E8A7B8A918B238B488B6C8BBD8C398C73 -8CD88D0C8D8E8D8E8D8E8D8E8D8E8E208E8D8EF48F598F9F8FB58FBD8FC59006904590BD -9126916491A19209927292C09334938093D1944E94D395479558956C9586959B95B195C7 -95DD95F3960B96219633964996659683969596AA96BC96D196E396F8970A971F973E9759 -976A977B979697AE97C497D597ED97FF98179829983F985598679879989898B198C998DB -98ED98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF -98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF -98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF -98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF -98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF -98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF -98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF -98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF -98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF -98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF -98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF98FF9911 -9922994099549970998999A199B399CB99E499FC9A159A359A4E9A659A769A909AA59ABB -9ACC9AE29AF99B0B9B1C9B2D9B3E9B549B659B7C9B949BAF9BC79BDD9BEE9C009C119C22 -9C339C4E9C649C759C8B9CA49CB89CCE9CDF9D639D6B9DDB0000037D01011C1C300E0E0B -0E010A01010E0E010F01010B0B0B0B0B0B0B0B0B0B01010E0E0E0B0C320E101923150E0F -740A0E2D240E0D0D0D0E322C1D322E1C111C0101010101010D0D0E0D0D1C0D0BB4010EB4 -110B100D0D2A11110B0A100F0A11010E0101323210230E0D1D0D0D0D0D0D0D0E0D0D0D0D -B4B4B4B40B10101010100B0B0B0B0B010B0B01010B0101010101010E330D010E0E0E0B10 -010101010B0101010E100B300E010B010127270132320D011C0B01010101010E010A1101 -01010101010B010101013223322323747474740D0D0D1D1D1DB401010101010101010101 -0AD732111C110E1001110A0D0D0E01010101010101010E0D743211100E100E0D0101320D -320D190D10230D230D2DB42D322D010E0B0E0B0D100E2A0E2A32112C112C111D0B1D0B1C -111C11100D130D2612181110010D010A0A110E01240A121901011901320D100E100E230D -230D230D0E0D0E0D0E0D0F0B0F0B74B474B474B474B40A010E0E0E2DB40E0B0E0B0D100D -100E2A32112C111D0B1D0B1D491D182E10110A01320D330E0D10012E102E102E10110A01 -010B01010101012E010101320E1C10160C27B4320E01231C0F740E0A240E300D0F0D1E2C -111C111474110D120BB40B0B0F0D0B0DB40D0A130A011010010B0C1010B40B100B10230A -100D3274740A0C0E010E1111320E0E10012311010E0E0E12240F0D0F0D102C11131C2D22 -11111F2D0E0D01100D240A010D0D301210100B011D1010100D0F110A170F270D11320C11 -0C0E0D0A0D0B010E11B4B4010A0E0B0B0A10100A01011001010101010101010101012D10 -282001010101010101010101010101010101010101320D320D320D320D320D320D320D32 -0D320D320D320D320D230D230D230D230D230D230D230D230D74B474B401010101010101 -010101010101010101010101010101010101010101010101010101010101010101010101 -010101010101010101010101010101010101010101010101010101010101010101010101 -010101010101010101010101010101010101010101010101010101010101010101010101 -010101010101010101010101010101010101010101010101010101010101010101010101 -010101010101010101010101010101010101010101010101010101010101010101010101 -01010101010101010D100D100D100D100D100D100D102D102D102D102D102D101D0B1D0B -28202820282028202820110A110A110A110A0D010B00000000000001000101010101000C -00F808FF00080008FFFE0009000AFFFE000A000AFFFE000B000BFFFE000C000CFFFE000D -000DFFFD000E000EFFFD000F000FFFFD0010000FFFFD00110011FFFD00120012FFFC0013 -0013FFFC00140015FFFC00150015FFFC00160016FFFC00170017FFFB00180018FFFB0019 -001AFFFB001A001BFFFB001B001BFFFB001C001CFFFA001D001DFFFA001E001EFFFA001F -0020FFFA00200020FFFA00210021FFF900220022FFF900230023FFF900240025FFF90025 -0026FFF900260026FFF800270027FFF800280028FFF800290029FFF8002A002BFFF8002B -002BFFF7002C002CFFF7002D002DFFF7002E002EFFF7002F0030FFF700300031FFF60031 -0031FFF600320032FFF600330033FFF600340034FFF600350036FFF500360036FFF50037 -0037FFF500380038FFF500390039FFF5003A003BFFF4003B003CFFF4003C003DFFF4003D -003DFFF4003E003EFFF4003F003FFFF300400041FFF300410041FFF300420042FFF30043 -0043FFF300440044FFF200450046FFF200460047FFF200470047FFF200480048FFF20049 -0049FFF1004A004AFFF1004B004CFFF1004C004DFFF1004D004DFFF1004E004EFFF0004F -004FFFF000500051FFF000510052FFF000520052FFEF00530053FFEF00540054FFEF0055 -0055FFEF00560057FFEF00570058FFEE00580058FFEE00590059FFEE005A005AFFEE005B -005CFFEE005C005DFFEC005D005DFFEC005E005EFFEC005F005FFFEC00600060FFEC0061 -0062FFEB00620062FFEB00630063FFEB00640064FFEB00650065FFEB00660067FFEA0067 -0068FFEA00680068FFEA00690069FFEA006A006AFFEA006B006BFFE9006C006DFFE9006D -006DFFE9006E006EFFE9006F006FFFE900700070FFE800710072FFE800720072FFE80073 -0073FFE800740074FFE800750075FFE700760076FFE700770078FFE700780078FFE70079 -0079FFE7007A007AFFE6007B007BFFE6007C007DFFE6007D007DFFE6007E007EFFE6007F -007FFFE500800080FFE500810082FFE500820083FFE500830083FFE500840084FFE40085 -0085FFE400860086FFE400870088FFE400880088FFE400890089FFE3008A008AFFE3008B -008BFFE3008C008DFFE3008D008EFFE3008E008EFFE2008F008FFFE200900090FFE20091 -0091FFE200920093FFE200930093FFE100940094FFE100950095FFE100960096FFE10097 -0098FFE100980099FFE000990099FFE0009A009BFFE0009B009BFFE0009C009CFFE0009D -009EFFDF009E009EFFDF009F00A0FFDF00A000A0FFDF00A100A1FFDF00A200A3FFDE00A3 -00A4FFDE00A400A4FFDE00A500A6FFDE00A600A6FFDE00A700A7FFDD00A800A9FFDD00A9 -00A9FFDD00AA00ABFFDD00AB00ABFFDD00AC00ACFFDC00AD00AEFFDC00AE00AFFFDC00AF -00B0FFDC00B000B0FFDC00B100B1FFDB00B200B2FFDB00B300B4FFDB00B400B5FFDB00B5 -00B6FFDB00B600B6FFDA00B700B7FFDA00B800B9FFDA00B900BAFFDA00BA00BBFFDA00BB -00BBFFD900BC00BCFFD900BD00BDFFD900BE00BFFFD900BF00C0FFD900C000C1FFD800C1 -00C1FFD800C200C2FFD800C300C4FFD800C400C5FFD800C500C5FFD700C600C6FFD700C7 -00C7FFD700C800C8FFD700C900CAFFD700CA00CBFFD600CB00CCFFD600CC00CCFFD600CD -00CDFFD600CE00CFFFD600CF00D0FFD500D000D0FFD500D100D1FFD500D200D2FFD500D3 -00D3FFD500D400D5FFD400D500D5FFD400D600D7FFD400D700D7FFD400D800D8FFD400D9 -00DAFFD300DA00DBFFD300DB00DCFFD300DC00DCFFD300DD00DDFFD300DE00DEFFD200DF -00E0FFD200E000E0FFD200E100E2FFD200E200E2FFD200E300E3FFD100E400E5FFD100E5 -00E6FFD100E600E7FFD100E700E7FFD100E800E8FFD000E900E9FFD000EA00EBFFD000EB -00EBFFD000EC00ECFFD000ED00EDFFCF00EE00EEFFCF00EF00F0FFCF00F000F1FFCF00F1 -00F2FFCF00F200F2FFCE00F300F3FFCE00F400F4FFCE00F500F6FFCE00F600F7FFCE00F7 -00F7FFCD00F800F8FFCD00F900F9FFCD00FA00FBFFCD00FB00FCFFCC00FC00FDFFCC00FD -00FEFFCC00FE00FEFFCC00FF00FFFFCCB8FFC0401EB229323610B220B240B250B270B280 -B2A0B2B0B2D0B2E0B20AC0B2F0B202B8FFC04070B51718361F44010F561F56024F555F55 -026F54019F54AF54025153170452531604535215044A4952044649370447493204484932 -04493539043C3F32043D3F3D043E3F2104433F1D04423F5204413F5204403F52043F3532 -0432336404333534043534540434351E04D034E034F03403B8FFEEB3B4254836B8FFE0B3 -B4102336B8FFEE400DB4090F36B41A480476B386B302B8FFF0B3B3254836B8FFFA40FFB3 -092436B314480489881304706C7078020F9CDF9E02409D161936409C161B364097171936 -4096171B368685131F0F840F850F8E0F8F0F901F841F8E1F8F2F8E808580888F91908590 -8790880F40820910360F721F72024071090C360F6D0120C80120C7013FC6EFC60220C540 -C50200620100621062024061A061020F5B012D1411042C1425042B1439042A1413042914 -15041F141E042120430420143C04C91A45041A1B47041B1A3C041A143204151439041314 -480412141A0411141A0470140140144143360F0E2A1F0006010DC34B1F0CC24B1F0AC04B -1F09C04B1F05BC4B1F04BD4B1F03B94B1F02BA4B1F01B64B1F00B74B1FC3C22A1FC0BF2A -1FBD4056BC211FBAB9211FB7B6211FC2C3C40DBFC0C10DBCBDBE0CB9BABB0CB6B7B80C10 -BC80BC0240B980B9020FB63FB64FB67FB6040FB62FB63FB66FB67FB6BFB6CFB6FFB6080A -0937040C0D02050402030202010002500501B801FF858D8D1DB0964B5258B0801D59B808 -004B5458B001B0018E59B0084B5358B001B0018E59002B2B2B2B2B737473732B2B2B2B2B -2B2B2B2B2B2B2B2B2B2B2B2B2B2B2BB00345B006456861B006234473B00345B00E456861 -B00E2344B00E45B00F456861B00F23442B01B0144568B01423442B732B2B2B2B2B2B2B2B -2B2B2B2B2B2B2B2B7373737373737373732B732B732B2B2B2B2B73732B2B2B2B732B2B2B -2B00752B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B2B73747373742B73742B400C3736 -26251F13120D0C0504022C20B003254523452361688A204568208A234460442D2C4B5258 -45441B2121592D2C202045684420B001602045B0467668188A4560442D2CB0122BB00225 -45B00225456AB0408B60B0022523442121212D2CB0132BB0022545B00225456AB8FFC08C -60B0022523442121212D2CB100032545685458B0032545B0032545606820B004252344B0 -042523441BB00325204568208A2344B00325456860B003252344592D2CB0032520456820 -8A2344B00325456860B0032523442D2C4B525845441B2121592D2C462346608A8A462320 -468A608A61B8FF8062232010238AB14B4B8A70456020B0005058B00161B8FFBA8B1BB046 -8C59B0106068013A2D2C2045B003254652583F1B2111592D2C4B53234B515A5820458A60 -441B2121592D2C4B53234B515A58381B2121592D061E061405F005D1047C045D03DD0010 -0000FFE7FFE1FE78FE64FE590394001FFFFF009600AA00B900C600CEFFFFFFFFFFFFFFFF -00BC00C2FFFFFFFF007600B200C000CBFFFFFFFFFFFFFFFFFFFFFFFF0081009400A600CC -00DA00EFFFFFFFFFFFFFFFFF0098009E00AB00B0FFFFFFFFFFFFFFFFFFFFFFFF00900098 -009E00A400A900AE00B300BA00C3FFFF00880091009800A500ACFFFFFFFFFFFFFFFFFFFF -006F0087008F009B00A000D3011DFFFFFFFFFFFF00C3021401C2FFFFFFFF00E9000C02D1 -0173018E001A002C0044005C0073007E008600B200C8014C001A003D00440050005C0072 -0078009200B200B900C8FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF003D0056005D006A -006E00B100B900C1FFFFFFFF002A003D00540064006A00B100B9FFFFFFFFFFFF0071007A -008900A100A700BB006F007A00870091009AFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF -008102210221007400E500B900CA019502C600AC00A700850614000A000005D1001F0000 -045D001F00000000FFE10000FE64FFF50000036202F402A2029100AF026A004C08000100 -0000000002D0000002D000000326012303AC00A8068C00C30516009B089C009505D00073 -022600A403A200B503A20093051600A7068C00D202E9009303A2009902E900FD03A2FFE2 -0516008905160116051600A1051600A70516004D051600BB051600890516009A0516007A -0516007103A2015A03A200E6068C00FE068C00F5068C010C045D00A0080000B00578001A -057C00C805960073062A00C8050F00C8049900C806340073060300C8035E008903A3002C -058B00CD047400C806BE00C805FC00C8064C007304D300C8064C0073059000C805780086 -04EE000005DB00B20578001A07E9005C057B004404EC0006057B007E03A200EF03A20046 -03A200AB068C00BA0516FFFC0516015404CE006804FC00B9042B006904FC006C04C4006A -02D0004404FC006C051000B9023200AF02C1FFC204BC00C1023200BB07C800B9051000B9 -04DB006A04FC00B904FC006C036A00B9042B006E0327003E051000B104BC003D068C0056 -04BC003C04BC003D0434005D051400AD03A2017A051400BB068C00BB0578001A0578001A -05960073050F00C805FC00C8064C007005DB00B204CE006804CE006804CE006804CE0068 -04CE006804CE0068042B006904C4006A04C4006A04C4006A04C4006A023200A00232FFEB -0232FFF502320005051000B904DB006A04DB006A04DB006A04DB006A04DB006A051000B1 -051000B1051000B1051000B1051600BB0456009A0516009F05160089051600AC045D00B9 -0516008904F600B90800009F0800009F07D000AA0516021D0516015A068C00F507E0000E -064C0073080000A1068C00D7068C00FE068C010C0516006C052200BE0516009505D100BB -068C009005A900710516008A045D0097045D0079068C006B07A4006804DB005D045D0071 -03260123068C00D2068C00860516FFDC068C00F305D10032052800A6052800AE068C00B2 -0578001A0578001A064C0073088F007807DA006A051600990800009903ACFFED03AC0096 -0226FFED022600A0068C00D2068C00AC04BC003D04EC000602E4FF9A0516000003A200BA -03A200C20500004405020044051600BB02E900FD0226FFF603ACFFF60C2C00950578001A -050F00C80578001A050F00C8050F00C8035E0089035E005D035E007E035E0089064C0073 -064C0073064C007305DB00B205DB00B205DB00B2023200BB05160136051600ED05160118 -05160113051602210516012D05160161051601560516019F05160132047E001802460018 -05780086042B006E057B007E0434005D03A2017A0634000E04E5006A04EC000604BC003D -04D800C804FC00B9068C00DC068C012304560123045600CF045600CF080000AB080000AB -0800008C0516003C0634007304FC006C035E008905780086042B006E05960073042B0069 -05960073042B006904FC006C0516FFFC02E900FD0578001A04CE00680578001A04CE0068 -062A00C8052E006C0634000E050F00C804C4006A050F00C804C4006A047400C8023200AB -047400C8025E00BB047400C803AB00BB05FC00C8051000B905FC00C8051000B9064C0073 -04DB006A059000C8036A00B9059000C8036A009205780086042B006E04EE00000327003E -04EE00000327003E05DB00B2051000B105DB00B2051000B1057B007E0434005D057B007E -0434005D048800C8064C0073068D006904FC006C04DD006A041A006D050B006A03F8000A -065200680516FFFC04FF0123045D009A094F00C806F7008904E900AF05D8000002E400D5 -047500D5089C00950296000F04D5009202D6008302D6008304D500B102D600700578001A -04CE006805960073042B006905960073042B0069050F00C804C4006A050F00C804C4006A -050F00C804C4006A0634007304FC006C0634007304FC006C0634007304FC006C060300C8 -051000B90603002005100013035E002C0232FFF2035E005F0232FFFC035E008002320001 -035E00890232008E03A3002C02C1FFC2058B00CD04BC00C104BC00C1047400C802320005 -05FC00C8051000B905FC00C8051000B9064C007304DB006A064C007304DB006A059000C8 -036A001B05780086042B006E04EE00000327003E05DB00B2051000B105DB00B2051000B1 -05DB00B2050B00B105DB00B2050B00B107E9005C068C005604EC000604BC003D026700B9 -0578001A04CE006807E0000E07A40068064C007304DB005D03A2015A07E9005C068C0056 -07E9005C068C005607E9005C068C005604EC000604BC003D0226FFED0516FFD005160089 -05BE00B1080000AB0800008C0800008A0800009901B00061051601610516021205160100 -057800070602000006F6000004510000070C000006070000074300000232FFCB0578001A -057C00C805A0001A050F00C8057B007E060300C8035E0089058B00CD057C001A06BE00C8 -05FC00C805310072064C0073060300C804D300C80561007604EE000004EC0006057B0044 -06F700B3068C006C035E007E04EC000604FC006C041A006D051000B9023200A0050D00B1 -04F600B904BC003D03A9006C051000B904FE0089023200BB04BC00C104BC003D051E00B9 -04BC003D0406006804DB006A050000B904100069050D00B104B80030069300B006820071 -02320005050D00B104DB006A050D00B106820071050F00C80657FFFF048800C8059B0073 -05780086035E0089035E007E03A3002C08F2001208D300C8068BFFFF058B00CD04EC0006 -060300C80578001A057C00C8057C00C8048800C805F7000A050F00C807C9002004ED0051 -060100C8060100C8058B00CD05E0001206BE00C8060300C8064C0073060300C804D300C8 -0596007304EE000004EC0006068D0069057B0044061700C805B2008E083E00C8085C00C8 -06440000075D00C8057200C8059C0061084600C805A6002C04CE006804EA007404C200B9 -03C500B904F9000904C4006A0662003404320041051F00B9051F00B904BC00C104F7001D -059200B9051900B904DB006A051900B904FC00B90446006A03F8000A04BC003D06BA006F -04BC003C052800B904D8008E070200B9071A00B90520000A065B00B9049100B904600053 -06B600B904CC004304C4006A0510001303C500B90460006A042B006E023200AF02320005 -02C1FFC20750001D075000B90510001304BC00C104BC003D051900B9048800C803C500B9 -080000CB096000C8051900B904560119045600EF045600E6045600B3045600E6045600F3 -045600C5000000000000000000000000000000000674007304DB006A060D00B2054700B1 -0000020900000221000001540000021D0516013605160003051601360516012505160142 -051601420516014205160125051602090516013605160142051601420516014205160142 -051601360578001A04CE00680578001A04CE00680578001A04CE00680578001A04CEFFE3 -0578001A04CE00680578001A04CE00680578001A04CE00680578001A04CE00680578001A -04CE00680578001A04CE00680578001A04CE00680578001A04CE0068050F00C804C4006A -050F00C804C4006A050F00C804C4006A050F00C804C4006A050F002904C4FFFC050F00C8 -04C4006A050F00C804C4006A050F00C804C4006A035E008902320096035E0089023200AF + +/GrayPseudoClassPacket +{ + % + % Get a PseudoClass packet; convert to grayscale. + % + % Parameters: + % index: index into the colormap. + % length: number of pixels minus one of this color (optional). + % + currentfile byte readhexstring pop 0 get + /offset exch 3 mul def + /color_packet colormap offset 3 getinterval def + color_packet 0 get 0.299 mul + color_packet 1 get 0.587 mul add + color_packet 2 get 0.114 mul add + cvi + /gray_packet exch def + compression 0 eq + { + /number_pixels 1 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add def + } ifelse + 0 1 number_pixels 1 sub + { + pixels exch gray_packet put + } for + pixels 0 number_pixels getinterval +} bind def + +/PseudoClassPacket +{ + % + % Get a PseudoClass packet. + % + % Parameters: + % index: index into the colormap. + % length: number of pixels minus one of this color (optional). + % + currentfile byte readhexstring pop 0 get + /offset exch 3 mul def + /color_packet colormap offset 3 getinterval def + compression 0 eq + { + /number_pixels 3 def + } + { + currentfile byte readhexstring pop 0 get + /number_pixels exch 1 add 3 mul def + } ifelse + 0 3 number_pixels 1 sub + { + pixels exch color_packet putinterval + } for + pixels 0 number_pixels getinterval +} bind def + +/PseudoClassImage +{ + % + % Display a PseudoClass image. + % + % Parameters: + % class: 0-PseudoClass or 1-Grayscale. + % + currentfile buffer readline pop + token pop /class exch def pop + class 0 gt + { + currentfile buffer readline pop + token pop /depth exch def pop + /grays columns 8 add depth sub depth mul 8 idiv string def + columns rows depth + [ + columns 0 0 + rows neg 0 rows + ] + { currentfile grays readhexstring pop } image + } + { + % + % Parameters: + % colors: number of colors in the colormap. + % colormap: red, green, blue color packets. + % + currentfile buffer readline pop + token pop /colors exch def pop + /colors colors 3 mul def + /colormap colors string def + currentfile colormap readhexstring pop pop + systemdict /colorimage known + { + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { PseudoClassPacket } false 3 colorimage + } + { + % + % No colorimage operator; convert to grayscale. + % + columns rows 8 + [ + columns 0 0 + rows neg 0 rows + ] + { GrayPseudoClassPacket } image + } ifelse + } ifelse +} bind def + +/DisplayImage +{ + % + % Display a DirectClass or PseudoClass image. + % + % Parameters: + % x & y translation. + % x & y scale. + % label pointsize. + % image label. + % image columns & rows. + % class: 0-DirectClass or 1-PseudoClass. + % compression: 0-none or 1-RunlengthEncoded. + % hex color packets. + % + gsave + /buffer 512 string def + /byte 1 string def + /color_packet 3 string def + /pixels 768 string def + + currentfile buffer readline pop + token pop /x exch def + token pop /y exch def pop + x y translate + currentfile buffer readline pop + token pop /x exch def + token pop /y exch def pop + currentfile buffer readline pop + token pop /pointsize exch def pop + /Times-Roman findfont pointsize scalefont setfont + x y scale + currentfile buffer readline pop + token pop /columns exch def + token pop /rows exch def pop + currentfile buffer readline pop + token pop /class exch def pop + currentfile buffer readline pop + token pop /compression exch def pop + class 0 gt { PseudoClassImage } { DirectClassImage } ifelse + grestore +} bind def +%%EndProlog +%%Page: 1 1 +%%PageBoundingBox: 0 0 1200 900 +userdict begin +DisplayImage +0 0 +1200 900 +12.000000 +1200 900 +0 +0 +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF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FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF +FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF... [truncated message content] |
From: <jd...@us...> - 2007-10-14 19:00:52
|
Revision: 3941 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3941&view=rev Author: jdh2358 Date: 2007-10-14 12:00:50 -0700 (Sun, 14 Oct 2007) Log Message: ----------- added ellipse compare script Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py trunk/matplotlib/lib/matplotlib/backends/backend_ps.py Added Paths: ----------- trunk/matplotlib/unit/ellipse_compare.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-10-14 14:16:48 UTC (rev 3940) +++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2007-10-14 19:00:50 UTC (rev 3941) @@ -143,7 +143,7 @@ """ if __debug__: verbose.report('RendererAgg.draw_arc', 'debug-annoying') self._renderer.draw_ellipse( - gcEdge, rgbFace, x, y, width/2, height/2, rotation) # ellipse takes radius + gcEdge, rgbFace, x, y, width/2., height/2., rotation) # ellipse takes radius def draw_line(self, gc, x1, y1, x2, y2): Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007-10-14 14:16:48 UTC (rev 3940) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2007-10-14 19:00:50 UTC (rev 3941) @@ -882,7 +882,7 @@ """ # local variable eliminates all repeated attribute lookups write = self._pswriter.write - + write('gsave\n') if debugPS and command: write("% "+command+"\n") @@ -915,7 +915,7 @@ write("stroke\n") if cliprect: write("grestore\n") - + write('grestore\n') def push_gc(self, gc, store=1): """ Push the current onto stack, with the exception of the clip box, which Added: trunk/matplotlib/unit/ellipse_compare.py =================================================================== --- trunk/matplotlib/unit/ellipse_compare.py (rev 0) +++ trunk/matplotlib/unit/ellipse_compare.py 2007-10-14 19:00:50 UTC (rev 3941) @@ -0,0 +1,53 @@ +""" +Compare the ellipse generated with arcs versus a polygonal approximation +""" +import numpy as npy +from matplotlib import patches +from pylab import figure, show + +xcenter, ycenter = 0.38, 0.52 +#xcenter, ycenter = 0., 0. +width, height = 1e-1, 3e-1 +angle = -30 + +theta = npy.arange(0.0, 360.0, 1.0)*npy.pi/180.0 +x = width/2. * npy.cos(theta) +y = height/2. * npy.sin(theta) + +rtheta = angle*npy.pi/180. +R = npy.array([ + [npy.cos(rtheta), -npy.sin(rtheta)], + [npy.sin(rtheta), npy.cos(rtheta)], + ]) + + +x, y = npy.dot(R, npy.array([x, y])) +x += xcenter +y += ycenter + +fig = figure() +ax = fig.add_subplot(211, aspect='auto') +ax.fill(x, y, alpha=0.2, facecolor='yellow') + +e1 = patches.Ellipse((xcenter, ycenter), width, height, + angle=angle, linewidth=2, fill=False) + +ax.add_artist(e1) + +ax = fig.add_subplot(212, aspect='equal') +ax.fill(x, y, alpha=0.2, facecolor='yellow') +e2 = patches.Ellipse((xcenter, ycenter), width, height, + angle=angle, linewidth=2, fill=False) + + +ax.add_artist(e2) +ax.autoscale_view() + + +ax.set_xlim(0.2, .5) +ax.set_ylim(0.3, 0.7) + +#fig.savefig('ellipse_compare.png') +#fig.savefig('ellipse_compare.ps') + +show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <js...@us...> - 2007-10-14 14:16:55
|
Revision: 3940 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3940&view=rev Author: jswhit Date: 2007-10-14 07:16:48 -0700 (Sun, 14 Oct 2007) Log Message: ----------- regenerated with cython 0.9.6.7 Modified Paths: -------------- trunk/toolkits/basemap/src/_geod.c trunk/toolkits/basemap/src/_proj.c Modified: trunk/toolkits/basemap/src/_geod.c =================================================================== --- trunk/toolkits/basemap/src/_geod.c 2007-10-12 17:30:17 UTC (rev 3939) +++ trunk/toolkits/basemap/src/_geod.c 2007-10-14 14:16:48 UTC (rev 3940) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.9.6.6 on Wed Sep 12 12:20:59 2007 */ +/* Generated by Cython 0.9.6.7 on Sun Oct 14 08:16:22 2007 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -37,7 +37,7 @@ typedef struct {const char *s; const void **p;} __Pyx_CApiTabEntry; /*proto*/ typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/ -typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/ +typedef struct {PyObject **p; char *s; long n; int is_unicode;} __Pyx_StringTabEntry; /*proto*/ #define __pyx_PyIndex_AsSsize_t(b) PyInt_AsSsize_t(PyNumber_Index(b)) @@ -110,6 +110,11 @@ static PyObject *__pyx_n__rad2dg; static PyObject *__pyx_n__doublesize; static PyObject *__pyx_n___version__; +static PyObject *__pyx_n___new__; +static PyObject *__pyx_n___reduce__; +static PyObject *__pyx_n__fwd; +static PyObject *__pyx_n__inv; +static PyObject *__pyx_n__npts; static PyObject *__pyx_n_radians; static PyObject *__pyx_n_degrees; @@ -132,8 +137,8 @@ static char (__pyx_k8[]) = " "; static char (__pyx_k9[]) = ""; -static int __pyx_f_5_geod_4Geod___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_f_5_geod_4Geod___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_f_py_5_geod_4Geod___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_f_py_5_geod_4Geod___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_geodparams = 0; GEODESIC_T __pyx_v_GEOD_T; PyObject *__pyx_v_geodargs; @@ -155,7 +160,7 @@ __pyx_v_key = Py_None; Py_INCREF(Py_None); __pyx_v_value = Py_None; Py_INCREF(Py_None); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":13 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":13 * def __new__(self, geodparams): * cdef GEODESIC_T GEOD_T * self.geodparams = geodparams # <<<<<<<<<<<<<< @@ -166,7 +171,7 @@ Py_DECREF(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodparams); ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodparams = __pyx_v_geodparams; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":15 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":15 * self.geodparams = geodparams * # setup proj initialization string. * geodargs = [] # <<<<<<<<<<<<<< @@ -178,7 +183,7 @@ __pyx_v_geodargs = __pyx_1; __pyx_1 = 0; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":16 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":16 * # setup proj initialization string. * geodargs = [] * for key,value in geodparams.iteritems(): # <<<<<<<<<<<<<< @@ -227,7 +232,7 @@ Py_DECREF(__pyx_4); __pyx_4 = 0; } - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":17 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":17 * geodargs = [] * for key,value in geodparams.iteritems(): * geodargs.append('+'+key+"="+str(value)+' ') # <<<<<<<<<<<<<< @@ -258,7 +263,7 @@ } Py_DECREF(__pyx_1); __pyx_1 = 0; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":18 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":18 * for key,value in geodparams.iteritems(): * geodargs.append('+'+key+"="+str(value)+' ') * self.geodinitstring = PyString_AsString(''.join(geodargs)) # <<<<<<<<<<<<<< @@ -275,7 +280,7 @@ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodinitstring = PyString_AsString(__pyx_6); Py_DECREF(__pyx_6); __pyx_6 = 0; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":20 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":20 * self.geodinitstring = PyString_AsString(''.join(geodargs)) * # initialize projection * self.geodesic_t = GEOD_init_plus(self.geodinitstring, &GEOD_T)[0] # <<<<<<<<<<<<<< @@ -284,7 +289,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t = (GEOD_init_plus(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodinitstring,(&__pyx_v_GEOD_T))[0]); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":21 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":21 * # initialize projection * self.geodesic_t = GEOD_init_plus(self.geodinitstring, &GEOD_T)[0] * if pj_errno != 0: # <<<<<<<<<<<<<< @@ -294,7 +299,7 @@ __pyx_7 = (pj_errno != 0); if (__pyx_7) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":22 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":22 * self.geodesic_t = GEOD_init_plus(self.geodinitstring, &GEOD_T)[0] * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<< @@ -314,7 +319,7 @@ } __pyx_L4:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":23 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":23 * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) * self.proj_version = PJ_VERSION/100. # <<<<<<<<<<<<<< @@ -347,16 +352,16 @@ static PyObject *__pyx_n___class__; -static PyObject *__pyx_f_5_geod_4Geod___reduce__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ +static PyObject *__pyx_f_py_5_geod_4Geod___reduce__(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static char __pyx_doc_5_geod_4Geod___reduce__[] = "special method that allows pyproj.Geod instance to be pickled"; -static PyObject *__pyx_f_5_geod_4Geod___reduce__(PyObject *__pyx_v_self, PyObject *unused) { +static PyObject *__pyx_f_py_5_geod_4Geod___reduce__(PyObject *__pyx_v_self, PyObject *unused) { PyObject *__pyx_r; PyObject *__pyx_1 = 0; PyObject *__pyx_2 = 0; PyObject *__pyx_3 = 0; Py_INCREF(__pyx_v_self); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":27 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":27 * def __reduce__(self): * """special method that allows pyproj.Geod instance to be pickled""" * return (self.__class__,(self.geodparams,)) # <<<<<<<<<<<<<< @@ -399,9 +404,9 @@ static char (__pyx_k10[]) = "Buffer lengths not the same"; static char (__pyx_k11[]) = "undefined forward geodesic (may be an equatorial arc)"; -static PyObject *__pyx_f_5_geod_4Geod__fwd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_py_5_geod_4Geod__fwd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_5_geod_4Geod__fwd[] = "\n forward transformation - determine longitude, latitude and back azimuth \n of a terminus point given an initial point longitude and latitude, plus\n forward azimuth and distance.\n if radians=True, lons/lats are radians instead of degrees.\n "; -static PyObject *__pyx_f_5_geod_4Geod__fwd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_f_py_5_geod_4Geod__fwd(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_lons = 0; PyObject *__pyx_v_lats = 0; PyObject *__pyx_v_az = 0; @@ -440,7 +445,7 @@ Py_INCREF(__pyx_v_dist); Py_INCREF(__pyx_v_radians); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":40 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":40 * cdef void *londata, *latdata, *azdat, *distdat * # if buffer api is supported, get pointer to data buffers. * if PyObject_AsWriteBuffer(lons, &londata, &buflenlons) <> 0: # <<<<<<<<<<<<<< @@ -450,7 +455,7 @@ __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_lons,(&__pyx_v_londata),(&__pyx_v_buflenlons)) != 0); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":41 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":41 * # if buffer api is supported, get pointer to data buffers. * if PyObject_AsWriteBuffer(lons, &londata, &buflenlons) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -463,7 +468,7 @@ } __pyx_L2:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":42 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":42 * if PyObject_AsWriteBuffer(lons, &londata, &buflenlons) <> 0: * raise RuntimeError * if PyObject_AsWriteBuffer(lats, &latdata, &buflenlats) <> 0: # <<<<<<<<<<<<<< @@ -473,7 +478,7 @@ __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_lats,(&__pyx_v_latdata),(&__pyx_v_buflenlats)) != 0); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":43 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":43 * raise RuntimeError * if PyObject_AsWriteBuffer(lats, &latdata, &buflenlats) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -486,7 +491,7 @@ } __pyx_L3:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":44 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":44 * if PyObject_AsWriteBuffer(lats, &latdata, &buflenlats) <> 0: * raise RuntimeError * if PyObject_AsWriteBuffer(az, &azdat, &buflenaz) <> 0: # <<<<<<<<<<<<<< @@ -496,7 +501,7 @@ __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_az,(&__pyx_v_azdat),(&__pyx_v_buflenaz)) != 0); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":45 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":45 * raise RuntimeError * if PyObject_AsWriteBuffer(az, &azdat, &buflenaz) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -509,7 +514,7 @@ } __pyx_L4:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":46 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":46 * if PyObject_AsWriteBuffer(az, &azdat, &buflenaz) <> 0: * raise RuntimeError * if PyObject_AsWriteBuffer(dist, &distdat, &buflend) <> 0: # <<<<<<<<<<<<<< @@ -519,7 +524,7 @@ __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_dist,(&__pyx_v_distdat),(&__pyx_v_buflend)) != 0); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":47 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":47 * raise RuntimeError * if PyObject_AsWriteBuffer(dist, &distdat, &buflend) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -532,24 +537,24 @@ } __pyx_L5:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":49 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":49 * raise RuntimeError * # process data in buffer * if not buflenlons == buflenlats == buflenaz == buflend: # <<<<<<<<<<<<<< * raise RuntimeError("Buffer lengths not the same") * ndim = buflenlons/_doublesize */ - __pyx_1 = __pyx_v_buflenlons == __pyx_v_buflenlats; + __pyx_1 = (__pyx_v_buflenlons == __pyx_v_buflenlats); if (__pyx_1) { - __pyx_1 = __pyx_v_buflenlats == __pyx_v_buflenaz; + __pyx_1 = (__pyx_v_buflenlats == __pyx_v_buflenaz); if (__pyx_1) { - __pyx_1 = __pyx_v_buflenaz == __pyx_v_buflend; + __pyx_1 = (__pyx_v_buflenaz == __pyx_v_buflend); } } __pyx_2 = (!__pyx_1); if (__pyx_2) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":50 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":50 * # process data in buffer * if not buflenlons == buflenlats == buflenaz == buflend: * raise RuntimeError("Buffer lengths not the same") # <<<<<<<<<<<<<< @@ -568,7 +573,7 @@ } __pyx_L6:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":51 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":51 * if not buflenlons == buflenlats == buflenaz == buflend: * raise RuntimeError("Buffer lengths not the same") * ndim = buflenlons/_doublesize # <<<<<<<<<<<<<< @@ -584,7 +589,7 @@ Py_DECREF(__pyx_5); __pyx_5 = 0; __pyx_v_ndim = __pyx_6; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":52 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":52 * raise RuntimeError("Buffer lengths not the same") * ndim = buflenlons/_doublesize * lonsdata = <double *>londata # <<<<<<<<<<<<<< @@ -593,7 +598,7 @@ */ __pyx_v_lonsdata = ((double (*))__pyx_v_londata); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":53 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":53 * ndim = buflenlons/_doublesize * lonsdata = <double *>londata * latsdata = <double *>latdata # <<<<<<<<<<<<<< @@ -602,7 +607,7 @@ */ __pyx_v_latsdata = ((double (*))__pyx_v_latdata); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":54 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":54 * lonsdata = <double *>londata * latsdata = <double *>latdata * azdata = <double *>azdat # <<<<<<<<<<<<<< @@ -611,7 +616,7 @@ */ __pyx_v_azdata = ((double (*))__pyx_v_azdat); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":55 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":55 * latsdata = <double *>latdata * azdata = <double *>azdat * distdata = <double *>distdat # <<<<<<<<<<<<<< @@ -620,7 +625,7 @@ */ __pyx_v_distdata = ((double (*))__pyx_v_distdat); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":56 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":56 * azdata = <double *>azdat * distdata = <double *>distdat * for i from 0 <= i < ndim: # <<<<<<<<<<<<<< @@ -629,17 +634,17 @@ */ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i++) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":57 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":57 * distdata = <double *>distdat * for i from 0 <= i < ndim: * if radians: # <<<<<<<<<<<<<< * self.geodesic_t.p1.v = lonsdata[i] * self.geodesic_t.p1.u = latsdata[i] */ - __pyx_1 = PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;} + __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;} if (__pyx_1) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":58 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":58 * for i from 0 <= i < ndim: * if radians: * self.geodesic_t.p1.v = lonsdata[i] # <<<<<<<<<<<<<< @@ -648,7 +653,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.v = (__pyx_v_lonsdata[__pyx_v_i]); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":59 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":59 * if radians: * self.geodesic_t.p1.v = lonsdata[i] * self.geodesic_t.p1.u = latsdata[i] # <<<<<<<<<<<<<< @@ -657,7 +662,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.u = (__pyx_v_latsdata[__pyx_v_i]); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":60 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":60 * self.geodesic_t.p1.v = lonsdata[i] * self.geodesic_t.p1.u = latsdata[i] * self.geodesic_t.ALPHA12 = azdata[i] # <<<<<<<<<<<<<< @@ -666,7 +671,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.ALPHA12 = (__pyx_v_azdata[__pyx_v_i]); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":61 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":61 * self.geodesic_t.p1.u = latsdata[i] * self.geodesic_t.ALPHA12 = azdata[i] * self.geodesic_t.DIST = distdata[i] # <<<<<<<<<<<<<< @@ -678,7 +683,7 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":63 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":63 * self.geodesic_t.DIST = distdata[i] * else: * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] # <<<<<<<<<<<<<< @@ -694,7 +699,7 @@ Py_DECREF(__pyx_5); __pyx_5 = 0; ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.v = __pyx_7; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":64 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":64 * else: * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] * self.geodesic_t.p1.u = _dg2rad*latsdata[i] # <<<<<<<<<<<<<< @@ -710,7 +715,7 @@ Py_DECREF(__pyx_5); __pyx_5 = 0; ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.u = __pyx_7; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":65 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":65 * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] * self.geodesic_t.p1.u = _dg2rad*latsdata[i] * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] # <<<<<<<<<<<<<< @@ -726,7 +731,7 @@ Py_DECREF(__pyx_5); __pyx_5 = 0; ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.ALPHA12 = __pyx_7; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":66 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":66 * self.geodesic_t.p1.u = _dg2rad*latsdata[i] * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] * self.geodesic_t.DIST = distdata[i] # <<<<<<<<<<<<<< @@ -737,7 +742,7 @@ } __pyx_L9:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":67 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":67 * self.geodesic_t.ALPHA12 = _dg2rad*azdata[i] * self.geodesic_t.DIST = distdata[i] * geod_pre(&self.geodesic_t) # <<<<<<<<<<<<<< @@ -746,7 +751,7 @@ */ geod_pre((&((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t)); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":68 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":68 * self.geodesic_t.DIST = distdata[i] * geod_pre(&self.geodesic_t) * if pj_errno != 0: # <<<<<<<<<<<<<< @@ -756,7 +761,7 @@ __pyx_2 = (pj_errno != 0); if (__pyx_2) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":69 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":69 * geod_pre(&self.geodesic_t) * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<< @@ -776,7 +781,7 @@ } __pyx_L10:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":70 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":70 * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) * geod_for(&self.geodesic_t) # <<<<<<<<<<<<<< @@ -785,7 +790,7 @@ */ geod_for((&((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t)); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":71 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":71 * raise RuntimeError(pj_strerrno(pj_errno)) * geod_for(&self.geodesic_t) * if pj_errno != 0: # <<<<<<<<<<<<<< @@ -795,7 +800,7 @@ __pyx_1 = (pj_errno != 0); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":72 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":72 * geod_for(&self.geodesic_t) * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<< @@ -815,7 +820,7 @@ } __pyx_L11:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":73 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":73 * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) * if isnan(self.geodesic_t.ALPHA21): # <<<<<<<<<<<<<< @@ -825,7 +830,7 @@ __pyx_8 = isnan(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.ALPHA21); if (__pyx_8) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":74 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":74 * raise RuntimeError(pj_strerrno(pj_errno)) * if isnan(self.geodesic_t.ALPHA21): * raise ValueError('undefined forward geodesic (may be an equatorial arc)') # <<<<<<<<<<<<<< @@ -844,17 +849,17 @@ } __pyx_L12:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":75 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":75 * if isnan(self.geodesic_t.ALPHA21): * raise ValueError('undefined forward geodesic (may be an equatorial arc)') * if radians: # <<<<<<<<<<<<<< * lonsdata[i] = self.geodesic_t.p2.v * latsdata[i] = self.geodesic_t.p2.u */ - __pyx_2 = PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;} + __pyx_2 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;} if (__pyx_2) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":76 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":76 * raise ValueError('undefined forward geodesic (may be an equatorial arc)') * if radians: * lonsdata[i] = self.geodesic_t.p2.v # <<<<<<<<<<<<<< @@ -863,7 +868,7 @@ */ (__pyx_v_lonsdata[__pyx_v_i]) = ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p2.v; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":77 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":77 * if radians: * lonsdata[i] = self.geodesic_t.p2.v * latsdata[i] = self.geodesic_t.p2.u # <<<<<<<<<<<<<< @@ -872,7 +877,7 @@ */ (__pyx_v_latsdata[__pyx_v_i]) = ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p2.u; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":78 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":78 * lonsdata[i] = self.geodesic_t.p2.v * latsdata[i] = self.geodesic_t.p2.u * azdata[i] = self.geodesic_t.ALPHA21 # <<<<<<<<<<<<<< @@ -884,7 +889,7 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":80 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":80 * azdata[i] = self.geodesic_t.ALPHA21 * else: * lonsdata[i] = _rad2dg*self.geodesic_t.p2.v # <<<<<<<<<<<<<< @@ -900,7 +905,7 @@ Py_DECREF(__pyx_4); __pyx_4 = 0; (__pyx_v_lonsdata[__pyx_v_i]) = __pyx_7; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":81 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":81 * else: * lonsdata[i] = _rad2dg*self.geodesic_t.p2.v * latsdata[i] = _rad2dg*self.geodesic_t.p2.u # <<<<<<<<<<<<<< @@ -916,7 +921,7 @@ Py_DECREF(__pyx_4); __pyx_4 = 0; (__pyx_v_latsdata[__pyx_v_i]) = __pyx_7; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":82 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":82 * lonsdata[i] = _rad2dg*self.geodesic_t.p2.v * latsdata[i] = _rad2dg*self.geodesic_t.p2.u * azdata[i] = _rad2dg*self.geodesic_t.ALPHA21 # <<<<<<<<<<<<<< @@ -959,9 +964,9 @@ static char (__pyx_k12[]) = "Buffer lengths not the same"; static char (__pyx_k13[]) = "undefined inverse geodesic (may be an antipodal point)"; -static PyObject *__pyx_f_5_geod_4Geod__inv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_py_5_geod_4Geod__inv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_5_geod_4Geod__inv[] = "\n inverse transformation - return forward and back azimuths, plus distance\n between an initial and terminus lat/lon pair.\n if radians=True, lons/lats are radians instead of degrees.\n "; -static PyObject *__pyx_f_5_geod_4Geod__inv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_f_py_5_geod_4Geod__inv(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_lons1 = 0; PyObject *__pyx_v_lats1 = 0; PyObject *__pyx_v_lons2 = 0; @@ -1000,7 +1005,7 @@ Py_INCREF(__pyx_v_lats2); Py_INCREF(__pyx_v_radians); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":94 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":94 * cdef void *londata, *latdata, *azdat, *distdat * # if buffer api is supported, get pointer to data buffers. * if PyObject_AsWriteBuffer(lons1, &londata, &buflenlons) <> 0: # <<<<<<<<<<<<<< @@ -1010,7 +1015,7 @@ __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_lons1,(&__pyx_v_londata),(&__pyx_v_buflenlons)) != 0); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":95 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":95 * # if buffer api is supported, get pointer to data buffers. * if PyObject_AsWriteBuffer(lons1, &londata, &buflenlons) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -1023,7 +1028,7 @@ } __pyx_L2:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":96 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":96 * if PyObject_AsWriteBuffer(lons1, &londata, &buflenlons) <> 0: * raise RuntimeError * if PyObject_AsWriteBuffer(lats1, &latdata, &buflenlats) <> 0: # <<<<<<<<<<<<<< @@ -1033,7 +1038,7 @@ __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_lats1,(&__pyx_v_latdata),(&__pyx_v_buflenlats)) != 0); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":97 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":97 * raise RuntimeError * if PyObject_AsWriteBuffer(lats1, &latdata, &buflenlats) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -1046,7 +1051,7 @@ } __pyx_L3:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":98 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":98 * if PyObject_AsWriteBuffer(lats1, &latdata, &buflenlats) <> 0: * raise RuntimeError * if PyObject_AsWriteBuffer(lons2, &azdat, &buflenaz) <> 0: # <<<<<<<<<<<<<< @@ -1056,7 +1061,7 @@ __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_lons2,(&__pyx_v_azdat),(&__pyx_v_buflenaz)) != 0); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":99 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":99 * raise RuntimeError * if PyObject_AsWriteBuffer(lons2, &azdat, &buflenaz) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -1069,7 +1074,7 @@ } __pyx_L4:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":100 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":100 * if PyObject_AsWriteBuffer(lons2, &azdat, &buflenaz) <> 0: * raise RuntimeError * if PyObject_AsWriteBuffer(lats2, &distdat, &buflend) <> 0: # <<<<<<<<<<<<<< @@ -1079,7 +1084,7 @@ __pyx_1 = (PyObject_AsWriteBuffer(__pyx_v_lats2,(&__pyx_v_distdat),(&__pyx_v_buflend)) != 0); if (__pyx_1) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":101 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":101 * raise RuntimeError * if PyObject_AsWriteBuffer(lats2, &distdat, &buflend) <> 0: * raise RuntimeError # <<<<<<<<<<<<<< @@ -1092,24 +1097,24 @@ } __pyx_L5:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":103 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":103 * raise RuntimeError * # process data in buffer * if not buflenlons == buflenlats == buflenaz == buflend: # <<<<<<<<<<<<<< * raise RuntimeError("Buffer lengths not the same") * ndim = buflenlons/_doublesize */ - __pyx_1 = __pyx_v_buflenlons == __pyx_v_buflenlats; + __pyx_1 = (__pyx_v_buflenlons == __pyx_v_buflenlats); if (__pyx_1) { - __pyx_1 = __pyx_v_buflenlats == __pyx_v_buflenaz; + __pyx_1 = (__pyx_v_buflenlats == __pyx_v_buflenaz); if (__pyx_1) { - __pyx_1 = __pyx_v_buflenaz == __pyx_v_buflend; + __pyx_1 = (__pyx_v_buflenaz == __pyx_v_buflend); } } __pyx_2 = (!__pyx_1); if (__pyx_2) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":104 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":104 * # process data in buffer * if not buflenlons == buflenlats == buflenaz == buflend: * raise RuntimeError("Buffer lengths not the same") # <<<<<<<<<<<<<< @@ -1128,7 +1133,7 @@ } __pyx_L6:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":105 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":105 * if not buflenlons == buflenlats == buflenaz == buflend: * raise RuntimeError("Buffer lengths not the same") * ndim = buflenlons/_doublesize # <<<<<<<<<<<<<< @@ -1144,7 +1149,7 @@ Py_DECREF(__pyx_5); __pyx_5 = 0; __pyx_v_ndim = __pyx_6; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":106 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":106 * raise RuntimeError("Buffer lengths not the same") * ndim = buflenlons/_doublesize * lonsdata = <double *>londata # <<<<<<<<<<<<<< @@ -1153,7 +1158,7 @@ */ __pyx_v_lonsdata = ((double (*))__pyx_v_londata); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":107 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":107 * ndim = buflenlons/_doublesize * lonsdata = <double *>londata * latsdata = <double *>latdata # <<<<<<<<<<<<<< @@ -1162,7 +1167,7 @@ */ __pyx_v_latsdata = ((double (*))__pyx_v_latdata); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":108 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":108 * lonsdata = <double *>londata * latsdata = <double *>latdata * azdata = <double *>azdat # <<<<<<<<<<<<<< @@ -1171,7 +1176,7 @@ */ __pyx_v_azdata = ((double (*))__pyx_v_azdat); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":109 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":109 * latsdata = <double *>latdata * azdata = <double *>azdat * distdata = <double *>distdat # <<<<<<<<<<<<<< @@ -1180,7 +1185,7 @@ */ __pyx_v_distdata = ((double (*))__pyx_v_distdat); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":110 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":110 * azdata = <double *>azdat * distdata = <double *>distdat * for i from 0 <= i < ndim: # <<<<<<<<<<<<<< @@ -1189,17 +1194,17 @@ */ for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i++) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":111 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":111 * distdata = <double *>distdat * for i from 0 <= i < ndim: * if radians: # <<<<<<<<<<<<<< * self.geodesic_t.p1.v = lonsdata[i] * self.geodesic_t.p1.u = latsdata[i] */ - __pyx_1 = PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;} + __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;} if (__pyx_1) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":112 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":112 * for i from 0 <= i < ndim: * if radians: * self.geodesic_t.p1.v = lonsdata[i] # <<<<<<<<<<<<<< @@ -1208,7 +1213,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.v = (__pyx_v_lonsdata[__pyx_v_i]); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":113 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":113 * if radians: * self.geodesic_t.p1.v = lonsdata[i] * self.geodesic_t.p1.u = latsdata[i] # <<<<<<<<<<<<<< @@ -1217,7 +1222,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.u = (__pyx_v_latsdata[__pyx_v_i]); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":114 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":114 * self.geodesic_t.p1.v = lonsdata[i] * self.geodesic_t.p1.u = latsdata[i] * self.geodesic_t.p2.v = azdata[i] # <<<<<<<<<<<<<< @@ -1226,7 +1231,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p2.v = (__pyx_v_azdata[__pyx_v_i]); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":115 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":115 * self.geodesic_t.p1.u = latsdata[i] * self.geodesic_t.p2.v = azdata[i] * self.geodesic_t.p2.u = distdata[i] # <<<<<<<<<<<<<< @@ -1238,7 +1243,7 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":117 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":117 * self.geodesic_t.p2.u = distdata[i] * else: * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] # <<<<<<<<<<<<<< @@ -1254,7 +1259,7 @@ Py_DECREF(__pyx_5); __pyx_5 = 0; ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.v = __pyx_7; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":118 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":118 * else: * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] * self.geodesic_t.p1.u = _dg2rad*latsdata[i] # <<<<<<<<<<<<<< @@ -1270,7 +1275,7 @@ Py_DECREF(__pyx_5); __pyx_5 = 0; ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.u = __pyx_7; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":119 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":119 * self.geodesic_t.p1.v = _dg2rad*lonsdata[i] * self.geodesic_t.p1.u = _dg2rad*latsdata[i] * self.geodesic_t.p2.v = _dg2rad*azdata[i] # <<<<<<<<<<<<<< @@ -1286,7 +1291,7 @@ Py_DECREF(__pyx_5); __pyx_5 = 0; ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p2.v = __pyx_7; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":120 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":120 * self.geodesic_t.p1.u = _dg2rad*latsdata[i] * self.geodesic_t.p2.v = _dg2rad*azdata[i] * self.geodesic_t.p2.u = _dg2rad*distdata[i] # <<<<<<<<<<<<<< @@ -1304,7 +1309,7 @@ } __pyx_L9:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":121 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":121 * self.geodesic_t.p2.v = _dg2rad*azdata[i] * self.geodesic_t.p2.u = _dg2rad*distdata[i] * geod_inv(&self.geodesic_t) # <<<<<<<<<<<<<< @@ -1313,7 +1318,7 @@ */ geod_inv((&((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t)); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":122 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":122 * self.geodesic_t.p2.u = _dg2rad*distdata[i] * geod_inv(&self.geodesic_t) * if isnan(self.geodesic_t.DIST): # <<<<<<<<<<<<<< @@ -1323,7 +1328,7 @@ __pyx_8 = isnan(((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.DIST); if (__pyx_8) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":123 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":123 * geod_inv(&self.geodesic_t) * if isnan(self.geodesic_t.DIST): * raise ValueError('undefined inverse geodesic (may be an antipodal point)') # <<<<<<<<<<<<<< @@ -1342,7 +1347,7 @@ } __pyx_L10:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":124 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":124 * if isnan(self.geodesic_t.DIST): * raise ValueError('undefined inverse geodesic (may be an antipodal point)') * if pj_errno != 0: # <<<<<<<<<<<<<< @@ -1352,7 +1357,7 @@ __pyx_2 = (pj_errno != 0); if (__pyx_2) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":125 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":125 * raise ValueError('undefined inverse geodesic (may be an antipodal point)') * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) # <<<<<<<<<<<<<< @@ -1372,17 +1377,17 @@ } __pyx_L11:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":126 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":126 * if pj_errno != 0: * raise RuntimeError(pj_strerrno(pj_errno)) * if radians: # <<<<<<<<<<<<<< * lonsdata[i] = self.geodesic_t.ALPHA12 * latsdata[i] = self.geodesic_t.ALPHA21 */ - __pyx_1 = PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;} + __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;} if (__pyx_1) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":127 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":127 * raise RuntimeError(pj_strerrno(pj_errno)) * if radians: * lonsdata[i] = self.geodesic_t.ALPHA12 # <<<<<<<<<<<<<< @@ -1391,7 +1396,7 @@ */ (__pyx_v_lonsdata[__pyx_v_i]) = ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.ALPHA12; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":128 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":128 * if radians: * lonsdata[i] = self.geodesic_t.ALPHA12 * latsdata[i] = self.geodesic_t.ALPHA21 # <<<<<<<<<<<<<< @@ -1403,7 +1408,7 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":130 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":130 * latsdata[i] = self.geodesic_t.ALPHA21 * else: * lonsdata[i] = _rad2dg*self.geodesic_t.ALPHA12 # <<<<<<<<<<<<<< @@ -1419,7 +1424,7 @@ Py_DECREF(__pyx_4); __pyx_4 = 0; (__pyx_v_lonsdata[__pyx_v_i]) = __pyx_7; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":131 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":131 * else: * lonsdata[i] = _rad2dg*self.geodesic_t.ALPHA12 * latsdata[i] = _rad2dg*self.geodesic_t.ALPHA21 # <<<<<<<<<<<<<< @@ -1437,7 +1442,7 @@ } __pyx_L12:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":132 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":132 * lonsdata[i] = _rad2dg*self.geodesic_t.ALPHA12 * latsdata[i] = _rad2dg*self.geodesic_t.ALPHA21 * azdata[i] = self.geodesic_t.DIST # <<<<<<<<<<<<<< @@ -1465,9 +1470,9 @@ return __pyx_r; } -static PyObject *__pyx_f_5_geod_4Geod__npts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_py_5_geod_4Geod__npts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_5_geod_4Geod__npts[] = "\n given initial and terminus lat/lon, find npts intermediate points."; -static PyObject *__pyx_f_5_geod_4Geod__npts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_f_py_5_geod_4Geod__npts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { double __pyx_v_lon1; double __pyx_v_lat1; double __pyx_v_lon2; @@ -1493,17 +1498,17 @@ __pyx_v_lats = Py_None; Py_INCREF(Py_None); __pyx_v_lons = Py_None; Py_INCREF(Py_None); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":139 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":139 * cdef int i * cdef double del_s * if radians: # <<<<<<<<<<<<<< * self.geodesic_t.p1.v = lon1 * self.geodesic_t.p1.u = lat1 */ - __pyx_1 = PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; goto __pyx_L1;} + __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; goto __pyx_L1;} if (__pyx_1) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":140 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":140 * cdef double del_s * if radians: * self.geodesic_t.p1.v = lon1 # <<<<<<<<<<<<<< @@ -1512,7 +1517,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.v = __pyx_v_lon1; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":141 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":141 * if radians: * self.geodesic_t.p1.v = lon1 * self.geodesic_t.p1.u = lat1 # <<<<<<<<<<<<<< @@ -1521,7 +1526,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.u = __pyx_v_lat1; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":142 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":142 * self.geodesic_t.p1.v = lon1 * self.geodesic_t.p1.u = lat1 * self.geodesic_t.p2.v = lon2 # <<<<<<<<<<<<<< @@ -1530,7 +1535,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p2.v = __pyx_v_lon2; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":143 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":143 * self.geodesic_t.p1.u = lat1 * self.geodesic_t.p2.v = lon2 * self.geodesic_t.p2.u = lat2 # <<<<<<<<<<<<<< @@ -1542,7 +1547,7 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":145 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":145 * self.geodesic_t.p2.u = lat2 * else: * self.geodesic_t.p1.v = _dg2rad*lon1 # <<<<<<<<<<<<<< @@ -1558,7 +1563,7 @@ Py_DECREF(__pyx_4); __pyx_4 = 0; ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.v = __pyx_5; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":146 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":146 * else: * self.geodesic_t.p1.v = _dg2rad*lon1 * self.geodesic_t.p1.u = _dg2rad*lat1 # <<<<<<<<<<<<<< @@ -1574,7 +1579,7 @@ Py_DECREF(__pyx_4); __pyx_4 = 0; ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p1.u = __pyx_5; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":147 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":147 * self.geodesic_t.p1.v = _dg2rad*lon1 * self.geodesic_t.p1.u = _dg2rad*lat1 * self.geodesic_t.p2.v = _dg2rad*lon2 # <<<<<<<<<<<<<< @@ -1590,7 +1595,7 @@ Py_DECREF(__pyx_4); __pyx_4 = 0; ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.p2.v = __pyx_5; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":148 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":148 * self.geodesic_t.p1.u = _dg2rad*lat1 * self.geodesic_t.p2.v = _dg2rad*lon2 * self.geodesic_t.p2.u = _dg2rad*lat2 # <<<<<<<<<<<<<< @@ -1608,7 +1613,7 @@ } __pyx_L2:; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":150 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":150 * self.geodesic_t.p2.u = _dg2rad*lat2 * # do inverse computation to set azimuths, distance. * geod_inv(&self.geodesic_t) # <<<<<<<<<<<<<< @@ -1617,7 +1622,7 @@ */ geod_inv((&((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t)); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":152 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":152 * geod_inv(&self.geodesic_t) * # set up some constants needed for forward computation. * geod_pre(&self.geodesic_t) # <<<<<<<<<<<<<< @@ -1626,7 +1631,7 @@ */ geod_pre((&((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t)); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":154 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":154 * geod_pre(&self.geodesic_t) * # distance increment. * del_s = self.geodesic_t.DIST/(npts+1) # <<<<<<<<<<<<<< @@ -1635,7 +1640,7 @@ */ __pyx_v_del_s = (((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.DIST / (__pyx_v_npts + 1)); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":156 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":156 * del_s = self.geodesic_t.DIST/(npts+1) * # initialize output tuples. * lats = () # <<<<<<<<<<<<<< @@ -1647,7 +1652,7 @@ __pyx_v_lats = __pyx_2; __pyx_2 = 0; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":157 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":157 * # initialize output tuples. * lats = () * lons = () # <<<<<<<<<<<<<< @@ -1659,7 +1664,7 @@ __pyx_v_lons = __pyx_3; __pyx_3 = 0; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":159 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":159 * lons = () * # loop over intermediate points, compute lat/lons. * for i from 1 <= i < npts+1: # <<<<<<<<<<<<<< @@ -1669,7 +1674,7 @@ __pyx_6 = (__pyx_v_npts + 1); for (__pyx_v_i = 1; __pyx_v_i < __pyx_6; __pyx_v_i++) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":160 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":160 * # loop over intermediate points, compute lat/lons. * for i from 1 <= i < npts+1: * self.geodesic_t.DIST = i*del_s # <<<<<<<<<<<<<< @@ -1678,7 +1683,7 @@ */ ((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t.DIST = (__pyx_v_i * __pyx_v_del_s); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":161 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":161 * for i from 1 <= i < npts+1: * self.geodesic_t.DIST = i*del_s * geod_for(&self.geodesic_t) # <<<<<<<<<<<<<< @@ -1687,17 +1692,17 @@ */ geod_for((&((struct __pyx_obj_5_geod_Geod *)__pyx_v_self)->geodesic_t)); - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":162 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":162 * self.geodesic_t.DIST = i*del_s * geod_for(&self.geodesic_t) * if radians: # <<<<<<<<<<<<<< * lats = lats + (self.geodesic_t.p2.u,) * lons = lons + (self.geodesic_t.p2.v,) */ - __pyx_1 = PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; goto __pyx_L1;} + __pyx_1 = __Pyx_PyObject_IsTrue(__pyx_v_radians); if (unlikely(__pyx_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; goto __pyx_L1;} if (__pyx_1) { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":163 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":163 * geod_for(&self.geodesic_t) * if radians: * lats = lats + (self.geodesic_t.p2.u,) # <<<<<<<<<<<<<< @@ -1714,7 +1719,7 @@ __pyx_v_lats = __pyx_3; __pyx_3 = 0; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":164 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":164 * if radians: * lats = lats + (self.geodesic_t.p2.u,) * lons = lons + (self.geodesic_t.p2.v,) # <<<<<<<<<<<<<< @@ -1734,7 +1739,7 @@ } /*else*/ { - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":166 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":166 * lons = lons + (self.geodesic_t.p2.v,) * else: * lats = lats + (_rad2dg*self.geodesic_t.p2.u,) # <<<<<<<<<<<<<< @@ -1755,7 +1760,7 @@ __pyx_v_lats = __pyx_2; __pyx_2 = 0; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":167 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":167 * else: * lats = lats + (_rad2dg*self.geodesic_t.p2.u,) * lons = lons + (_rad2dg*self.geodesic_t.p2.v,) # <<<<<<<<<<<<<< @@ -1778,7 +1783,7 @@ __pyx_L5:; } - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":168 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":168 * lats = lats + (_rad2dg*self.geodesic_t.p2.u,) * lons = lons + (_rad2dg*self.geodesic_t.p2.v,) * return lons, lats # <<<<<<<<<<<<<< @@ -1812,9 +1817,14 @@ {&__pyx_n_RuntimeError, "RuntimeError"}, {&__pyx_n_ValueError, "ValueError"}, {&__pyx_n___class__, "__class__"}, + {&__pyx_n___new__, "__new__"}, + {&__pyx_n___reduce__, "__reduce__"}, {&__pyx_n___version__, "__version__"}, {&__pyx_n__dg2rad, "_dg2rad"}, {&__pyx_n__doublesize, "_doublesize"}, + {&__pyx_n__fwd, "_fwd"}, + {&__pyx_n__inv, "_inv"}, + {&__pyx_n__npts, "_npts"}, {&__pyx_n__rad2dg, "_rad2dg"}, {&__pyx_n_append, "append"}, {&__pyx_n_degrees, "degrees"}, @@ -1826,16 +1836,16 @@ }; static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_k2p, __pyx_k2, sizeof(__pyx_k2)}, - {&__pyx_k6p, __pyx_k6, sizeof(__pyx_k6)}, - {&__pyx_k7p, __pyx_k7, sizeof(__pyx_k7)}, - {&__pyx_k8p, __pyx_k8, sizeof(__pyx_k8)}, - {&__pyx_k9p, __pyx_k9, sizeof(__pyx_k9)}, - {&__pyx_k10p, __pyx_k10, sizeof(__pyx_k10)}, - {&__pyx_k11p, __pyx_k11, sizeof(__pyx_k11)}, - {&__pyx_k12p, __pyx_k12, sizeof(__pyx_k12)}, - {&__pyx_k13p, __pyx_k13, sizeof(__pyx_k13)}, - {0, 0, 0} + {&__pyx_k2p, __pyx_k2, sizeof(__pyx_k2), 0}, + {&__pyx_k6p, __pyx_k6, sizeof(__pyx_k6), 0}, + {&__pyx_k7p, __pyx_k7, sizeof(__pyx_k7), 0}, + {&__pyx_k8p, __pyx_k8, sizeof(__pyx_k8), 0}, + {&__pyx_k9p, __pyx_k9, sizeof(__pyx_k9), 0}, + {&__pyx_k10p, __pyx_k10, sizeof(__pyx_k10), 0}, + {&__pyx_k11p, __pyx_k11, sizeof(__pyx_k11), 0}, + {&__pyx_k12p, __pyx_k12, sizeof(__pyx_k12), 0}, + {&__pyx_k13p, __pyx_k13, sizeof(__pyx_k13), 0}, + {0, 0, 0, 0} }; static PyObject *__pyx_tp_new_5_geod_Geod(PyTypeObject *t, PyObject *a, PyObject *k) { @@ -1843,7 +1853,7 @@ struct __pyx_obj_5_geod_Geod *p = (struct __pyx_obj_5_geod_Geod *)o; p->geodparams = Py_None; Py_INCREF(Py_None); p->proj_version = Py_None; Py_INCREF(Py_None); - if (__pyx_f_5_geod_4Geod___new__(o, a, k) < 0) { + if (__pyx_f_py_5_geod_4Geod___new__(o, a, k) < 0) { Py_DECREF(o); o = 0; } return o; @@ -1878,10 +1888,10 @@ } static struct PyMethodDef __pyx_methods_5_geod_Geod[] = { - {"__reduce__", (PyCFunction)__pyx_f_5_geod_4Geod___reduce__, METH_NOARGS, __pyx_doc_5_geod_4Geod___reduce__}, - {"_fwd", (PyCFunction)__pyx_f_5_geod_4Geod__fwd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_geod_4Geod__fwd}, - {"_inv", (PyCFunction)__pyx_f_5_geod_4Geod__inv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_geod_4Geod__inv}, - {"_npts", (PyCFunction)__pyx_f_5_geod_4Geod__npts, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_geod_4Geod__npts}, + {"__reduce__", (PyCFunction)__pyx_f_py_5_geod_4Geod___reduce__, METH_NOARGS, __pyx_doc_5_geod_4Geod___reduce__}, + {"_fwd", (PyCFunction)__pyx_f_py_5_geod_4Geod__fwd, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_geod_4Geod__fwd}, + {"_inv", (PyCFunction)__pyx_f_py_5_geod_4Geod__inv, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_geod_4Geod__inv}, + {"_npts", (PyCFunction)__pyx_f_py_5_geod_4Geod__npts, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_geod_4Geod__npts}, {0, 0, 0, 0} }; @@ -1930,7 +1940,9 @@ 0, /*nb_true_divide*/ 0, /*nb_inplace_floor_divide*/ 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 0, /*nb_index*/ + #endif }; static PySequenceMethods __pyx_tp_as_sequence_Geod = { @@ -2034,7 +2046,7 @@ if (PyObject_SetAttrString(__pyx_m, "Geod", (PyObject *)&__pyx_type_5_geod_Geod) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;} __pyx_ptype_5_geod_Geod = &__pyx_type_5_geod_Geod; - /* "/Volumes/User/jwhitaker/python/pyproj/_pyproj.pxi":1 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_pyproj.pxi":1 * import math # <<<<<<<<<<<<<< * * _dg2rad = math.radians(1.) @@ -2043,7 +2055,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_math, __pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; - /* "/Volumes/User/jwhitaker/python/pyproj/_pyproj.pxi":3 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_pyproj.pxi":3 * import math * * _dg2rad = math.radians(1.) # <<<<<<<<<<<<<< @@ -2063,7 +2075,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n__dg2rad, __pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; - /* "/Volumes/User/jwhitaker/python/pyproj/_pyproj.pxi":4 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_pyproj.pxi":4 * * _dg2rad = math.radians(1.) * _rad2dg = math.degrees(1.) # <<<<<<<<<<<<<< @@ -2083,7 +2095,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n__rad2dg, __pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 4; goto __pyx_L1;} Py_DECREF(__pyx_1); __pyx_1 = 0; - /* "/Volumes/User/jwhitaker/python/pyproj/_pyproj.pxi":5 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_pyproj.pxi":5 * _dg2rad = math.radians(1.) * _rad2dg = math.degrees(1.) * _doublesize = sizeof(double) # <<<<<<<<<<<<<< @@ -2094,7 +2106,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n__doublesize, __pyx_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; goto __pyx_L1;} Py_DECREF(__pyx_3); __pyx_3 = 0; - /* "/Volumes/User/jwhitaker/python/pyproj/_pyproj.pxi":6 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_pyproj.pxi":6 * _rad2dg = math.degrees(1.) * _doublesize = sizeof(double) * __version__ = "1.8.3" # <<<<<<<<<<<<<< @@ -2103,7 +2115,7 @@ */ if (PyObject_SetAttr(__pyx_m, __pyx_n___version__, __pyx_k2p) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 6; goto __pyx_L1;} - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":29 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":29 * return (self.__class__,(self.geodparams,)) * * def _fwd(self, object lons, object lats, object az, object dist, radians=False): # <<<<<<<<<<<<<< @@ -2113,7 +2125,7 @@ Py_INCREF(Py_False); __pyx_k3 = Py_False; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":84 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":84 * azdata[i] = _rad2dg*self.geodesic_t.ALPHA21 * * def _inv(self, object lons1, object lats1, object lons2, object lats2, radians=False): # <<<<<<<<<<<<<< @@ -2123,7 +2135,7 @@ Py_INCREF(Py_False); __pyx_k4 = Py_False; - /* "/Volumes/User/jwhitaker/python/pyproj/_geod.pyx":134 + /* "/Users/jsw/python/matplotlib/toolkits/basemap/src/_geod.pyx":134 * azdata[i] = self.geodesic_t.DIST * * def _npts(self, double lon1, double lat1, double lon2, double lat2, int npts, radians=False): # <<<<<<<<<<<<<< @@ -2288,7 +2300,11 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { - *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } if (!*t->p) return -1; ++t; Modified: trunk/toolkits/basemap/src/_proj.c =================================================================== --- trunk/toolkits/basemap/src/_proj.c 2007-10-12 17:30:17 UTC (rev 3939) +++ trunk/toolkits/basemap/src/_proj.c 2007-10-14 14:16:48 UTC (rev 3940) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.9.6.6 on Wed Sep 12 12:21:02 2007 */ +/* Generated by Cython 0.9.6.7 on Sun Oct 14 08:16:26 2007 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -37,7 +37,7 @@ typedef struct {const char *s; const void **p;} __Pyx_CApiTabEntry; /*proto*/ typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/ -typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/ +typedef struct {PyObject **p; char *s; long n; int is_unicode;} __Pyx_S... [truncated message content] |
From: <md...@us...> - 2007-10-12 17:30:22
|
Revision: 3939 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3939&view=rev Author: mdboom Date: 2007-10-12 10:30:17 -0700 (Fri, 12 Oct 2007) Log Message: ----------- More progress on examples. Modified Paths: -------------- branches/transforms/PASSED_DEMOS branches/transforms/examples/collections_demo.py branches/transforms/examples/simple_plot_fps.py branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/axis.py branches/transforms/lib/matplotlib/colorbar.py branches/transforms/lib/matplotlib/contour.py branches/transforms/lib/matplotlib/text.py branches/transforms/lib/matplotlib/ticker.py branches/transforms/lib/matplotlib/transforms.py branches/transforms/src/_backend_agg.cpp Modified: branches/transforms/PASSED_DEMOS =================================================================== --- branches/transforms/PASSED_DEMOS 2007-10-12 14:29:57 UTC (rev 3938) +++ branches/transforms/PASSED_DEMOS 2007-10-12 17:30:17 UTC (rev 3939) @@ -16,10 +16,10 @@ arctest.py O arrow_demo.py O axes_demo.py O -axes_props.py [SOMETHING FUNNY ABOUT DASHED LINES] +axes_props.py O axhspan_demo.py O axis_equal_demo.py O -backend_driver.py +backend_driver.py [N/A] barchart_demo.py O barcode_demo.py O barh_demo.py [BROKEN IN TRUNK] @@ -29,14 +29,14 @@ broken_barh.py O clippath_test.py O clippedline.py O -collections_demo.py -- [NEEDS ADDITIONAL WORK] +collections_demo.py O colorbar_only.py O color_by_yvalue.py O color_demo.py O colours.py [???] -contour_demo.py -contourf_demo.py -contour_image.py +contour_demo.py O +contourf_demo.py [FLOATING POINT EXCEPTION] +contour_image.py [FLOATING POINT EXCEPTION] coords_demo.py O coords_report.py O csd_demo.py O Modified: branches/transforms/examples/collections_demo.py =================================================================== --- branches/transforms/examples/collections_demo.py 2007-10-12 14:29:57 UTC (rev 3938) +++ branches/transforms/examples/collections_demo.py 2007-10-12 17:30:17 UTC (rev 3939) @@ -87,7 +87,7 @@ a = fig.add_subplot(2,2,3) col = collections.RegularPolyCollection(fig.dpi, 7, - sizes = N.fabs(xx) / 10.0, offsets=xyo, + sizes = N.fabs(xx)*10.0, offsets=xyo, transOffset=a.transData) trans = transforms.Affine2D().scale(fig.dpi/72.0) col.set_transform(trans) # the points to pixels transform Modified: branches/transforms/examples/simple_plot_fps.py =================================================================== --- branches/transforms/examples/simple_plot_fps.py 2007-10-12 14:29:57 UTC (rev 3938) +++ branches/transforms/examples/simple_plot_fps.py 2007-10-12 17:30:17 UTC (rev 3939) @@ -21,11 +21,13 @@ #savefig('simple_plot') import time - +from matplotlib import transforms + frames = 100.0 t = time.clock() ion() for i in xrange(int(frames)): + transforms.CATCH = True part = i / frames axis([0.0, 1.0 - part, -1.0 + part, 1.0 - part]) show() Modified: branches/transforms/lib/matplotlib/axes.py =================================================================== --- branches/transforms/lib/matplotlib/axes.py 2007-10-12 14:29:57 UTC (rev 3938) +++ branches/transforms/lib/matplotlib/axes.py 2007-10-12 17:30:17 UTC (rev 3939) @@ -1110,7 +1110,6 @@ # and the data in xydata # MGDTODO: This isn't always the most efficient way to do this... in # some cases things should use update_datalim_bounds - if not ma.isMaskedArray(xys): xys = npy.asarray(xys) self.update_datalim_numerix(xys[:, 0], xys[:, 1]) Modified: branches/transforms/lib/matplotlib/axis.py =================================================================== --- branches/transforms/lib/matplotlib/axis.py 2007-10-12 14:29:57 UTC (rev 3938) +++ branches/transforms/lib/matplotlib/axis.py 2007-10-12 17:30:17 UTC (rev 3939) @@ -91,16 +91,18 @@ self._size = size self._padPixels = self.figure.dpi * self._pad * (1/72.0) + self._locTransform = Affine2D() + + self.tick1line = self._get_tick1line() + self.tick2line = self._get_tick2line() + self.gridline = self._get_gridline() - - self.tick1line = self._get_tick1line(loc) - self.tick2line = self._get_tick2line(loc) - self.gridline = self._get_gridline(loc) - - self.label1 = self._get_text1(loc) + self.label1 = self._get_text1() self.label = self.label1 # legacy name - self.label2 = self._get_text2(loc) + self.label2 = self._get_text2() + self.update_position(loc) + self.gridOn = gridOn self.tick1On = tick1On self.tick2On = tick2On @@ -138,23 +140,23 @@ 'Get the value of the tick label pad in points' return self._pad.get() - def _get_text1(self, loc): + def _get_text1(self): 'Get the default Text 1 instance' pass - def _get_text2(self, loc): + def _get_text2(self): 'Get the default Text 2 instance' pass - def _get_tick1line(self, loc): + def _get_tick1line(self): 'Get the default line2D instance for tick1' pass - def _get_tick2line(self, loc): + def _get_tick2line(self): 'Get the default line2D instance for tick2' pass - def _get_gridline(self, loc): + def _get_gridline(self): 'Get the default grid Line2d instance for this tick' pass @@ -183,22 +185,6 @@ renderer.close_group(self.__name__) - def set_xy(self, loc): - """ - Set the location of tick in data coords with scalar loc - - ACCEPTS: float - """ - raise NotImplementedError('Derived must override') - - def set_label(self, s): # legacy name - """ - Set the text of ticklabel - - ACCEPTS: str - """ - self.label1.set_text(s) - def set_label1(self, s): """ Set the text of ticklabel @@ -206,7 +192,8 @@ ACCEPTS: str """ self.label1.set_text(s) - + set_label = set_label1 + def set_label2(self, s): """ Set the text of ticklabel2 @@ -233,7 +220,7 @@ the label text and the grid line """ __name__ = 'xtick' - def _get_text1(self, loc): + def _get_text1(self): 'Get the default Text instance' # the y loc is 3 points below the min of y axis # get the affine as an a,b,c,d,tx,ty list @@ -242,7 +229,7 @@ trans, vert, horiz = self.axes.get_xaxis_text1_transform(self._padPixels) t = TextWithDash( - x=loc, y=0, + x=0, y=0, fontproperties=FontProperties(size=rcParams['xtick.labelsize']), color=rcParams['xtick.color'], verticalalignment=vert, @@ -256,15 +243,15 @@ return t - def _get_text2(self, loc): + def _get_text2(self): 'Get the default Text 2 instance' # x in data coords, y in axes coords #t = Text( trans, vert, horiz = self.axes.get_xaxis_text2_transform(self._padPixels) - t = TextWithDash( - x=loc, y=1, + t = TextWithDash( + x=0, y=1, fontproperties=FontProperties(size=rcParams['xtick.labelsize']), color=rcParams['xtick.color'], verticalalignment=vert, @@ -272,60 +259,55 @@ xaxis=True, horizontalalignment=horiz, ) - t.set_transform(trans) self._set_artist_props(t) return t - def _get_tick1line(self, loc): + def _get_tick1line(self): 'Get the default line2D instance' # x in data coords, y in axes coords - l = Line2D( xdata=(loc,), ydata=(0,), - color='k', - linestyle = 'None', - marker = self._xtickmarkers[0], - markersize=self._size, - ) + l = Line2D(xdata=(0,), ydata=(0,), + color='k', + linestyle = 'None', + marker = self._xtickmarkers[0], + markersize=self._size, + ) l.set_transform(self.axes.get_xaxis_transform()) self._set_artist_props(l) return l - def _get_tick2line(self, loc): + def _get_tick2line(self): 'Get the default line2D instance' # x in data coords, y in axes coords - l = Line2D( xdata=(loc,), ydata=(1,), + l = Line2D( xdata=(0,), ydata=(1,), color='k', linestyle = 'None', marker = self._xtickmarkers[1], markersize=self._size, ) - l.set_transform(self.axes.get_xaxis_transform()) + l.set_transform(self._locTransform + self.axes.get_xaxis_transform()) self._set_artist_props(l) return l - def _get_gridline(self, loc): + def _get_gridline(self): 'Get the default line2D instance' # x in data coords, y in axes coords - l = Line2D(xdata=(loc, loc), ydata=(0, 1.0), + l = Line2D(xdata=(0.0, 0.0), ydata=(0, 1.0), color=rcParams['grid.color'], linestyle=rcParams['grid.linestyle'], linewidth=rcParams['grid.linewidth'], ) - l.set_transform(self.axes.get_xaxis_transform()) + l.set_transform(self._locTransform + self.axes.get_xaxis_transform()) self._set_artist_props(l) return l def update_position(self, loc): 'Set the location of tick in data coords with scalar loc' - x = loc - - self.tick1line.set_xdata((x,)) - self.tick2line.set_xdata((x,)) - self.gridline.set_xdata((x, )) - self.label1.set_x(x) - self.label2.set_x(x) + self._locTransform.clear().translate(loc, 0.0) + self.label1.set_x(loc) + self.label2.set_x(loc) self._loc = loc def get_view_interval(self): @@ -355,14 +337,14 @@ __name__ = 'ytick' # how far from the y axis line the right of the ticklabel are - def _get_text1(self, loc): + def _get_text1(self): 'Get the default Text instance' # x in axes coords, y in data coords #t = Text( trans, vert, horiz = self.axes.get_yaxis_text1_transform(self._padPixels) t = TextWithDash( - x=0, y=loc, + x=0, y=0, fontproperties=FontProperties(size=rcParams['ytick.labelsize']), color=rcParams['ytick.color'], verticalalignment=vert, @@ -375,14 +357,14 @@ self._set_artist_props(t) return t - def _get_text2(self, loc): + def _get_text2(self): 'Get the default Text instance' # x in axes coords, y in data coords #t = Text( trans, vert, horiz = self.axes.get_yaxis_text2_transform(self._padPixels) - t = TextWithDash( - x=1, y=loc, + t = TextWithDash( + x=1, y=0, fontproperties=FontProperties(size=rcParams['ytick.labelsize']), color=rcParams['ytick.color'], verticalalignment=vert, @@ -394,20 +376,20 @@ self._set_artist_props(t) return t - def _get_tick1line(self, loc): + def _get_tick1line(self): 'Get the default line2D instance' # x in axes coords, y in data coords - l = Line2D( (0,), (loc,), color='k', + l = Line2D( (0,), (0,), color='k', marker = self._ytickmarkers[0], linestyle = 'None', markersize=self._size, ) - l.set_transform(self.axes.get_yaxis_transform()) + l.set_transform(self._locTransform + self.axes.get_yaxis_transform()) self._set_artist_props(l) return l - def _get_tick2line(self, loc): + def _get_tick2line(self): 'Get the default line2D instance' # x in axes coords, y in data coords l = Line2D( (1,), (0,), color='k', @@ -416,34 +398,29 @@ markersize=self._size, ) - l.set_transform(self.axes.get_yaxis_transform()) + l.set_transform(self._locTransform + self.axes.get_yaxis_transform()) self._set_artist_props(l) return l - def _get_gridline(self, loc): + def _get_gridline(self): 'Get the default line2D instance' # x in axes coords, y in data coords - l = Line2D( xdata=(0,1), ydata=(loc,loc), + l = Line2D( xdata=(0,1), ydata=(0, 0), color=rcParams['grid.color'], linestyle=rcParams['grid.linestyle'], linewidth=rcParams['grid.linewidth'], ) - l.set_transform(self.axes.get_yaxis_transform()) + l.set_transform(self._locTransform + self.axes.get_yaxis_transform()) self._set_artist_props(l) return l def update_position(self, loc): 'Set the location of tick in data coords with scalar loc' - y = loc - self.tick1line.set_ydata((y,)) - self.tick2line.set_ydata((y,)) - self.gridline.set_ydata((y, )) - - self.label1.set_y( y ) - self.label2.set_y( y ) - + self._locTransform.clear().translate(0.0, loc) + self.label1.set_y(loc) + self.label2.set_y(loc) self._loc = loc @@ -558,9 +535,11 @@ popall(self.majorTicks) popall(self.minorTicks) - self.majorTicks.extend([self._get_tick(major=True) for i in range(1)]) - self.minorTicks.extend([self._get_tick(major=False) for i in range(1)]) - + self.majorTicks.extend([self._get_tick(major=True)]) + self.minorTicks.extend([self._get_tick(major=False)]) + self._lastNumMajorTicks = 1 + self._lastNumMinorTicks = 1 + self.converter = None self.units = None self.set_units(None) @@ -744,16 +723,21 @@ 'get the tick instances; grow as necessary' if numticks is None: numticks = len(self.get_major_locator()()) - - if len(self.majorTicks)<numticks: + + if len(self.majorTicks) < numticks: # update the new tick label properties from the old - protoTick = self.majorTicks[0] - for i in range(numticks-len(self.majorTicks)): + for i in range(numticks - len(self.majorTicks)): tick = self._get_tick(major=True) - #tick = protoTick + self.majorTicks.append(tick) + + if self._lastNumMajorTicks < numticks: + protoTick = self.majorTicks[0] + for i in range(self._lastNumMajorTicks, len(self.majorTicks)): + tick = self.majorTicks[i] if self._gridOnMajor: tick.gridOn = True self._copy_tick_props(protoTick, tick) - self.majorTicks.append(tick) + + self._lastNumMajorTicks = numticks ticks = self.majorTicks[:numticks] return ticks @@ -764,13 +748,20 @@ if numticks is None: numticks = len(self.get_minor_locator()()) - if len(self.minorTicks)<numticks: + if len(self.minorTicks) < numticks: + # update the new tick label properties from the old + for i in range(numticks - len(self.minorTicks)): + tick = self._get_tick(minor=True) + self.minorTicks.append(tick) + + if self._lastNumMinorTicks < numticks: protoTick = self.minorTicks[0] - for i in range(numticks-len(self.minorTicks)): - tick = self._get_tick(major=False) + for i in range(self._lastNumMinorTicks, len(self.minorTicks)): + tick = self.minorTicks[i] if self._gridOnMinor: tick.gridOn = True self._copy_tick_props(protoTick, tick) - self.minorTicks.append(tick) + + self._lastNumMinorTicks = numticks ticks = self.minorTicks[:numticks] return ticks @@ -946,7 +937,6 @@ self.set_major_formatter( FixedFormatter(ticklabels) ) - ret = [] for i, tick in enumerate(self.get_major_ticks()): if i<len(ticklabels): Modified: branches/transforms/lib/matplotlib/colorbar.py =================================================================== --- branches/transforms/lib/matplotlib/colorbar.py 2007-10-12 14:29:57 UTC (rev 3938) +++ branches/transforms/lib/matplotlib/colorbar.py 2007-10-12 17:30:17 UTC (rev 3939) @@ -314,8 +314,7 @@ b = self._boundaries[self._inside] locator = ticker.FixedLocator(b, nbins=10) if isinstance(self.norm, colors.NoNorm): - intv = transforms.Interval(transforms.Value(self._values[0]), - transforms.Value(self._values[-1])) + intv = self._values[0], self._values[-1] else: intv = self.vmin, self.vmax locator.create_dummy_axis() Modified: branches/transforms/lib/matplotlib/contour.py =================================================================== --- branches/transforms/lib/matplotlib/contour.py 2007-10-12 14:29:57 UTC (rev 3938) +++ branches/transforms/lib/matplotlib/contour.py 2007-10-12 17:30:17 UTC (rev 3939) @@ -8,6 +8,7 @@ import numpy as npy import matplotlib.numerix.npyma as ma import matplotlib._cntr as _cntr +import matplotlib.path as path import matplotlib.ticker as ticker import matplotlib.transforms as transforms import matplotlib.cm as cm @@ -210,7 +211,7 @@ trans = self.ax.transData - slc = trans.seq_xy_tups(linecontour) + slc = trans.transform(linecontour) x,y = slc[ind] xx= npy.asarray(slc)[:,0].copy() yy=npy.asarray(slc)[:,1].copy() @@ -247,8 +248,9 @@ new_x1, new_y1 = x-xlabel, y-ylabel new_x2, new_y2 = x+xlabel, y+ylabel - new_x1d, new_y1d = trans.inverse_xy_tup((new_x1, new_y1)) - new_x2d, new_y2d = trans.inverse_xy_tup((new_x2, new_y2)) + inverse = trans.inverted() + new_x1d, new_y1d = inverse.transform_point((new_x1, new_y1)) + new_x2d, new_y2d = inverse.transform_point((new_x2, new_y2)) new_xy1 = npy.array(((new_x1d, new_y1d),)) new_xy2 = npy.array(((new_x2d, new_y2d),)) @@ -333,20 +335,22 @@ con = self.collections[icon] lw = self.get_label_width(lev, fmt, fsize) additions = [] - for segNum, linecontour in enumerate(con._segments): + paths = con.get_paths() + for segNum, linepath in enumerate(paths): + linecontour = linepath.vertices # for closed contours add one more point to # avoid division by zero if npy.all(linecontour[0] == linecontour[-1]): linecontour = npy.concatenate((linecontour, - linecontour[1][npy.newaxis,:])) + linecontour[1][npy.newaxis,:])) #linecontour.append(linecontour[1]) # transfer all data points to screen coordinates - slc = trans.seq_xy_tups(linecontour) + slc = trans.transform(linecontour) if self.print_label(slc,lw): x,y, rotation, ind = self.locate_label(slc, lw) # transfer the location of the label back to # data coordinates - dx,dy = trans.inverse_xy_tup((x,y)) + dx,dy = trans.inverted().transform_point((x,y)) t = text.Text(dx, dy, rotation = rotation, horizontalalignment='center', verticalalignment='center') @@ -355,12 +359,14 @@ self.cl.append(t) self.cl_cvalues.append(cvalue) if inline: - new = self.break_linecontour(linecontour, rotation, - lw, ind) - con._segments[segNum] = new[0] - additions.append(new[1]) - con._segments.extend(additions) + new = self.break_linecontour(linecontour, rotation, lw, ind) + if len(new[0]): + paths[segNum] = path.Path(new[0], closed=False) + if len(new[1]): + additions.append(path.Path(new[1], closed=False)) + paths.extend(additions) + class ContourSet(cm.ScalarMappable, ContourLabeler): """ Create and store a set of contour lines or filled regions. @@ -494,6 +500,7 @@ ''' if self.locator is None: self.locator = ticker.MaxNLocator(N+1) + self.locator.create_dummy_axis() locator = self.locator zmax = self.zmax zmin = self.zmin Modified: branches/transforms/lib/matplotlib/text.py =================================================================== --- branches/transforms/lib/matplotlib/text.py 2007-10-12 14:29:57 UTC (rev 3938) +++ branches/transforms/lib/matplotlib/text.py 2007-10-12 17:30:17 UTC (rev 3939) @@ -172,7 +172,6 @@ self._linespacing = other._linespacing def _get_layout(self, renderer): - # layout the xylocs in display coords as if angle = zero and # then rotate them around self._x, self._y #return _unit_box @@ -327,11 +326,10 @@ self._fontproperties, angle) return + canvasw, canvash = renderer.get_canvas_width_height() for line, wh, x, y in info: x, y = trans.transform_point((x, y)) - if renderer.flipy(): - canvasw, canvash = renderer.get_canvas_width_height() y = canvash-y renderer.draw_text(gc, x, y, line, Modified: branches/transforms/lib/matplotlib/ticker.py =================================================================== --- branches/transforms/lib/matplotlib/ticker.py 2007-10-12 14:29:57 UTC (rev 3938) +++ branches/transforms/lib/matplotlib/ticker.py 2007-10-12 17:30:17 UTC (rev 3939) @@ -145,6 +145,11 @@ def set_data_interval(self, vmin, vmax): self.axis.set_data_interval(vmin, vmax) + + def set_bounds(self, vmin, vmax): + self.set_view_interval(vmin, vmax) + self.set_data_interval(vmin, vmax) + class Formatter(TickHelper): """ Modified: branches/transforms/lib/matplotlib/transforms.py =================================================================== --- branches/transforms/lib/matplotlib/transforms.py 2007-10-12 14:29:57 UTC (rev 3938) +++ branches/transforms/lib/matplotlib/transforms.py 2007-10-12 17:30:17 UTC (rev 3939) @@ -32,8 +32,10 @@ import cbook from path import Path -DEBUG = True +DEBUG = False +# MGDTODO: Cache get_affine??? + class TransformNode(object): """ TransformNode is the base class for anything that participates in @@ -81,7 +83,7 @@ # A list of the children is kept around for debugging purposes # only. self._children = [] - + def __copy__(self, *args): raise NotImplementedError( "TransformNode instances can not be copied. " + @@ -402,13 +404,13 @@ self._points[0] + (W, H)]) def splitx(self, *args): - ''' + """ e.g., bbox.splitx(f1, f2, ...) Returns a list of new BBoxes formed by splitting the original one with vertical lines at fractional positions f1, f2, ... - ''' + """ boxes = [] xf = [0] + list(args) + [1] l, b, r, t = self.lbrt @@ -418,13 +420,13 @@ return boxes def splity(self, *args): - ''' + """ e.g., bbox.splitx(f1, f2, ...) Returns a list of new PBoxes formed by splitting the original one with horizontal lines at fractional positions f1, f2, ... - ''' + """ boxes = [] yf = [0] + list(args) + [1] l, b, r, t = self.lbrt @@ -434,6 +436,11 @@ return boxes def count_contains(self, vertices): + """ + Count the number of vertices contained in the Bbox. + + vertices is a Nx2 numpy array. + """ if len(vertices) == 0: return 0 vertices = npy.asarray(vertices) @@ -446,6 +453,11 @@ return N.sum(inside) def count_overlaps(self, bboxes): + """ + Count the number of bounding boxes that overlap this one. + + bboxes is a sequence of Bbox objects + """ ax1, ay1, ax2, ay2 = self._get_lbrt() if ax2 < ax1: ax2, ax1 = ax1, ax2 @@ -454,7 +466,9 @@ count = 0 for bbox in bboxes: - bx1, by1, bx2, by2 = bbox._get_lbrt() + # bx1, by1, bx2, by2 = bbox._get_lbrt() + # The above, inlined... + bx1, by1, bx2, by2 = bbox.get_points().flatten() if bx2 < bx1: bx2, bx1 = bx1, bx2 if by2 < by1: @@ -464,7 +478,53 @@ (bx1 >= ax2) or (by1 >= ay2))) return count - + + def expanded(self, sw, sh): + """ + Return a new Bbox which is this Bbox expanded around its + center by the given factors sw and sh. + """ + width = self.width + height = self.height + deltaw = (sw * width - width) / 2.0 + deltah = (sh * height - height) / 2.0 + a = npy.array([[-deltaw, -deltah], [deltaw, deltah]]) + return Bbox(self._points + a) + + def translated(self, tx, ty): + """ + Return a copy of the Bbox, translated by tx and ty. + """ + return Bbox(self._points + (tx, ty)) + + #@staticmethod + def union(bboxes): + """ + Return a Bbox that contains all of the given bboxes. + """ + assert(len(bboxes)) + + if len(bboxes) == 1: + return bboxes[0] + + xmin = npy.inf + ymin = npy.inf + xmax = -npy.inf + ymax = -npy.inf + + for bbox in bboxes: + points = bbox.get_points() + xs = points[:, 0] + ys = points[:, 1] + xmin = min(xmin, npy.min(xs)) + ymin = min(ymin, npy.min(ys)) + xmax = max(xmax, npy.max(xs)) + ymax = max(ymax, npy.max(ys)) + + return Bbox.from_lbrt(xmin, ymin, xmax, ymax) + union = staticmethod(union) + + class Bbox(BboxBase): def __init__(self, points): """ @@ -535,7 +595,6 @@ when None, use the last value passed to Bbox.ignore(). """ # MGDTODO: It may be more efficient for some callers to use update_from_data_xy instead - if ignore is None: ignore = self._ignore @@ -569,7 +628,6 @@ max(y.max(), self.ymax)]], npy.float_) self._minpos = npy.minimum(minpos, self._minpos) - self.invalidate() def update_from_data_xy(self, xy, ignore=None): @@ -665,52 +723,7 @@ """ self._points = other.get_points() self.invalidate() - - def expanded(self, sw, sh): - """ - Return a new Bbox which is this Bbox expanded around its - center by the given factors sw and sh. - """ - width = self.width - height = self.height - deltaw = (sw * width - width) / 2.0 - deltah = (sh * height - height) / 2.0 - a = npy.array([[-deltaw, -deltah], [deltaw, deltah]]) - return Bbox(self._points + a) - def translated(self, tx, ty): - """ - Return a copy of the Bbox, translated by tx and ty. - """ - return Bbox(self._points + (tx, ty)) - - #@staticmethod - def union(bboxes): - """ - Return a Bbox that contains all of the given bboxes. - """ - assert(len(bboxes)) - - if len(bboxes) == 1: - return bboxes[0] - - xmin = npy.inf - ymin = npy.inf - xmax = -npy.inf - ymax = -npy.inf - - for bbox in bboxes: - points = bbox.get_points() - xs = points[:, 0] - ys = points[:, 1] - xmin = min(xmin, npy.min(xs)) - ymin = min(ymin, npy.min(ys)) - xmax = max(xmax, npy.max(xs)) - ymax = max(ymax, npy.max(ys)) - - return Bbox.from_lbrt(xmin, ymin, xmax, ymax) - union = staticmethod(union) - class TransformedBbox(BboxBase): """ @@ -1633,15 +1646,39 @@ else: return npy.concatenate((x_points, y_points), 1) transform.__doc__ = Transform.transform.__doc__ - - transform_non_affine = transform + + def transform_affine(self, points): + if self._x.is_affine and self._y.is_affine: + return self.transform(points) + return points + transform_affine.__doc__ = Transform.transform_affine.__doc__ + + def transform_non_affine(self, points): + if self._x.is_affine and self._y.is_affine: + return points + return self.transform(points) transform_non_affine.__doc__ = Transform.transform_non_affine.__doc__ def inverted(self): return BlendedGenericTransform(self._x.inverted(), self._y.inverted()) inverted.__doc__ = Transform.inverted.__doc__ - + def get_affine(self): + if self._x.is_affine and self._y.is_affine: + if self._x == self._y: + return self._x.get_affine() + else: + x_mtx = self._x.get_affine().get_matrix() + y_mtx = self._y.get_affine().get_matrix() + # This works because we already know the transforms are + # separable, though normally one would want to set b and + # c to zero. + mtx = npy.vstack((x_mtx[0], y_mtx[1], [0.0, 0.0, 1.0])) + return Affine2D(mtx) + return IdentityTransform() + get_affine.__doc__ = Transform.get_affine.__doc__ + + class BlendedAffine1D(Affine2DBase): """ A "blended" transform uses one transform for the x-direction, and @@ -1807,7 +1844,7 @@ is_affine = property(_get_is_affine) def _get_is_separable(self): - return self._a.is_separable() and self._b.is_separable() + return self._a.is_separable and self._b.is_separable is_separable = property(_get_is_separable) def __repr__(self): @@ -1838,7 +1875,7 @@ def transform_path_affine(self, path): return self._b.transform_path_affine( - self._a.transform(path)) + self._a.transform_path(path)) transform_path_affine.__doc__ = Transform.transform_path_affine.__doc__ def transform_path_non_affine(self, path): @@ -1850,7 +1887,8 @@ def get_affine(self): if self._a.is_affine and self._b.is_affine: - return CompositeAffine2D(self._a.get_affine(), self._b.get_affine()) + return Affine2D(npy.dot(self._b.get_affine().get_matrix(), + self._a.get_affine().get_matrix())) return self._b.get_affine() get_affine.__doc__ = Transform.get_affine.__doc__ Modified: branches/transforms/src/_backend_agg.cpp =================================================================== --- branches/transforms/src/_backend_agg.cpp 2007-10-12 14:29:57 UTC (rev 3938) +++ branches/transforms/src/_backend_agg.cpp 2007-10-12 17:30:17 UTC (rev 3939) @@ -82,7 +82,10 @@ return agg::trans_affine(a, b, c, d, e, f); } } catch (...) { - + if (errors) { + Py_XDECREF(matrix); + throw; + } } Py_XDECREF(matrix); @@ -333,8 +336,10 @@ bool RendererAgg::bbox_to_rect(const Py::Object& bbox_obj, double* l, double* b, double* r, double* t) { + PyArrayObject* bbox = NULL; + if (bbox_obj.ptr() != Py_None) { - PyArrayObject* bbox = (PyArrayObject*) PyArray_FromObject(bbox_obj.ptr(), PyArray_DOUBLE, 2, 2); + bbox = (PyArrayObject*) PyArray_FromObject(bbox_obj.ptr(), PyArray_DOUBLE, 2, 2); if (!bbox || bbox->nd != 2 || bbox->dimensions[0] != 2 || bbox->dimensions[1] != 2) { Py_XDECREF(bbox); @@ -559,9 +564,9 @@ PathIterator path(path_obj); transformed_path_t path_transformed(path, trans); - bool snap = should_snap(path, trans); - GCAgg gc = GCAgg(gc_obj, dpi, snap); - quantize_t path_quantized(path_transformed, snap); + // bool snap = should_snap(path, trans); + GCAgg gc = GCAgg(gc_obj, dpi, true); + quantize_t path_quantized(path_transformed, true); path_quantized.rewind(0); facepair_t face = _get_rgba_face(face_obj, gc.alpha); @@ -638,6 +643,7 @@ } catch(...) { delete[] fillCache; delete[] strokeCache; + throw; } delete [] fillCache; @@ -879,7 +885,7 @@ theRasterizer->add_path(stroke); } - if (gc.isaa && !(snap && gc.dashes.size())) { + if (gc.isaa && !(snap && gc.linewidth < 1.5)) { if (has_clippath) { pixfmt_amask_type pfa(*pixFmt, *alphaMask); amask_ren_type r(pfa); @@ -954,99 +960,110 @@ GCAgg gc(dpi, false); - PyArrayObject* offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj.ptr(), PyArray_DOUBLE, 2, 2); - if (!offsets || offsets->dimensions[1] != 2) - throw Py::ValueError("Offsets array must be Nx2"); + PyArrayObject* offsets = NULL; + PyArrayObject* facecolors = NULL; + PyArrayObject* edgecolors = NULL; - PyArrayObject* facecolors = (PyArrayObject*)PyArray_FromObject(facecolors_obj.ptr(), PyArray_DOUBLE, 1, 2); - if (!facecolors || - (facecolors->nd == 1 && facecolors->dimensions[0] != 0) || - (facecolors->nd == 2 && facecolors->dimensions[1] != 4)) - throw Py::ValueError("Facecolors must be a Nx4 numpy array or empty"); + try { + offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj.ptr(), PyArray_DOUBLE, 2, 2); + if (!offsets || offsets->dimensions[1] != 2) + throw Py::ValueError("Offsets array must be Nx2"); - PyArrayObject* edgecolors = (PyArrayObject*)PyArray_FromObject(edgecolors_obj.ptr(), PyArray_DOUBLE, 1, 2); - if (!edgecolors || - (edgecolors->nd == 1 && edgecolors->dimensions[0] != 0) || - (edgecolors->nd == 2 && edgecolors->dimensions[1] != 4)) - throw Py::ValueError("Edgecolors must be a Nx4 numpy array"); + PyArrayObject* facecolors = (PyArrayObject*)PyArray_FromObject(facecolors_obj.ptr(), PyArray_DOUBLE, 1, 2); + if (!facecolors || + (facecolors->nd == 1 && facecolors->dimensions[0] != 0) || + (facecolors->nd == 2 && facecolors->dimensions[1] != 4)) + throw Py::ValueError("Facecolors must be a Nx4 numpy array or empty"); - size_t Npaths = paths.length(); - 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(); + PyArrayObject* edgecolors = (PyArrayObject*)PyArray_FromObject(edgecolors_obj.ptr(), PyArray_DOUBLE, 1, 2); + if (!edgecolors || + (edgecolors->nd == 1 && edgecolors->dimensions[0] != 0) || + (edgecolors->nd == 2 && edgecolors->dimensions[1] != 4)) + throw Py::ValueError("Edgecolors must be a Nx4 numpy array"); + + size_t Npaths = paths.length(); + 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) || N == 0) - return Py::Object(); - - 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], false); - trans *= master_transform; - 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]), false, 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; - - for (i = 0; i < N; ++i) { - PathIterator path(paths[i % Npaths]); - bool snap = (path.total_vertices() == 2); - double xo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 0); - double yo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 1); - offset_trans.transform(&xo, &yo); - agg::trans_affine_translation transOffset(xo, yo); - agg::trans_affine& trans = transforms[i % Ntransforms]; - - 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)); + if ((Nfacecolors == 0 && Nedgecolors == 0) || N == 0) + return Py::Object(); + + 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], false); + trans *= master_transform; + transforms.push_back(trans); } - - if (Nedgecolors) { - 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)); - gc.linewidth = double(Py::Float(linewidths[i % Nlinewidths])) * dpi/72.0; - gc.dashes = dashes[i % Nlinestyles].second; - gc.dashOffset = dashes[i % Nlinestyles].first; + + // 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]), false, dpi, d->second, d->first); } - - gc.isaa = bool(Py::Int(antialiaseds[i % Naa])); - _draw_path(path, trans * transOffset, snap, has_clippath, face, gc); + + // 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; + + for (i = 0; i < N; ++i) { + PathIterator path(paths[i % Npaths]); + bool snap = (path.total_vertices() == 2); + double xo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 0); + double yo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 1); + offset_trans.transform(&xo, &yo); + agg::trans_affine_translation transOffset(xo, yo); + agg::trans_affine& trans = transforms[i % Ntransforms]; + + 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)); + } + + if (Nedgecolors) { + 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)); + gc.linewidth = double(Py::Float(linewidths[i % Nlinewidths])) * dpi/72.0; + gc.dashes = dashes[i % Nlinestyles].second; + gc.dashOffset = dashes[i % Nlinestyles].first; + } + + gc.isaa = bool(Py::Int(antialiaseds[i % Naa])); + _draw_path(path, trans * transOffset, snap, has_clippath, face, gc); + } + } catch (...) { + Py_XDECREF(offsets); + Py_XDECREF(facecolors); + Py_XDECREF(edgecolors); + throw; } Py_XDECREF(offsets); @@ -1518,18 +1535,15 @@ void get_path_extents(PathIterator& path, agg::trans_affine& trans, double* x0, double* y0, double* x1, double* y1) { - typedef agg::conv_curve<PathIterator> curve_t; - - curve_t curved_path(path); + typedef agg::conv_transform<PathIterator> transformed_path_t; + typedef agg::conv_curve<transformed_path_t> curve_t; double x, y; - curved_path.rewind(0); + unsigned code; - unsigned code = curved_path.vertex(&x, &y); + transformed_path_t tpath(path, trans); + curve_t curved_path(tpath); - *x0 = x; - *y0 = y; - *x1 = x; - *y1 = y; + curved_path.rewind(0); while ((code = curved_path.vertex(&x, &y)) != agg::path_cmd_stop) { if (code & agg::path_cmd_end_poly == agg::path_cmd_end_poly) @@ -1539,9 +1553,6 @@ if (x > *x1) *x1 = x; if (y > *y1) *y1 = y; } - - trans.transform(x0, y0); - trans.transform(x1, y1); } Py::Object _backend_agg_module::get_path_extents(const Py::Tuple& args) { @@ -1550,7 +1561,11 @@ PathIterator path(args[0]); agg::trans_affine trans = py_to_agg_transformation_matrix(args[1]); - double x0, y0, x1, y1; + double x0 = std::numeric_limits<double>::infinity(); + double y0 = std::numeric_limits<double>::infinity(); + double x1 = -std::numeric_limits<double>::infinity(); + double y1 = -std::numeric_limits<double>::infinity(); + ::get_path_extents(path, trans, &x0, &y0, &x1, &y1); Py::Tuple result(4); @@ -1561,10 +1576,6 @@ return result; } -struct PathCollectionExtents { - double x0, y0, x1, y1; -}; - Py::Object _backend_agg_module::get_path_collection_extents(const Py::Tuple& args) { args.verify_length(5); @@ -1572,57 +1583,58 @@ agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0]); Py::SeqBase<Py::Object> paths = args[1]; Py::SeqBase<Py::Object> transforms_obj = args[2]; - Py::SeqBase<Py::Object> offsets = args[3]; + Py::Object offsets_obj = args[3]; agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[4], false); - size_t Npaths = paths.length(); - size_t Noffsets = offsets.length(); - size_t N = std::max(Npaths, Noffsets); - size_t Ntransforms = std::min(transforms_obj.length(), N); - size_t i; + PyArrayObject* offsets = NULL; + double x0, y0, x1, y1; - // 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], false); - trans *= master_transform; - transforms.push_back(trans); - } - - typedef std::vector<PathCollectionExtents> path_extents_t; - path_extents_t path_extents; - path_extents.resize(Npaths); + try { + offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj.ptr(), PyArray_DOUBLE, 2, 2); + if (!offsets || offsets->dimensions[1] != 2) + throw Py::ValueError("Offsets array must be Nx2"); - // Get each of the path extents first - i = 0; - for (path_extents_t::iterator p = path_extents.begin(); - p != path_extents.end(); ++p, ++i) { - PathIterator path(paths[i]); - agg::trans_affine& trans = transforms[i % Ntransforms]; - ::get_path_extents(path, trans, &p->x0, &p->y0, &p->x1, &p->y1); - } + size_t Npaths = paths.length(); + size_t Noffsets = offsets->dimensions[0]; + size_t N = std::max(Npaths, Noffsets); + size_t Ntransforms = std::min(transforms_obj.length(), N); + size_t i; - // The offset each of those and collect the mins/maxs - double x0 = std::numeric_limits<double>::infinity(); - double y0 = std::numeric_limits<double>::infinity(); - double x1 = -std::numeric_limits<double>::infinity(); - double y1 = -std::numeric_limits<double>::infinity(); - for (i = 0; i < N; ++i) { - Py::SeqBase<Py::Float> offset = Py::SeqBase<Py::Float>(offsets[i % Noffsets]); - double xo = Py::Float(offset[0]); - double yo = Py::Float(offset[1]); - offset_trans.transform(&xo, &yo); - PathCollectionExtents& ext = path_extents[i % Npaths]; + // 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], false); + trans *= master_transform; + transforms.push_back(trans); + } + + // The offset each of those and collect the mins/maxs + x0 = std::numeric_limits<double>::infinity(); + y0 = std::numeric_limits<double>::infinity(); + x1 = -std::numeric_limits<double>::infinity(); + y1 = -std::numeric_limits<double>::infinity(); + for (i = 0; i < N; ++i) { + PathIterator path(paths[i % Npaths]); + + double xo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 0); + double yo = *(double*)PyArray_GETPTR2(offsets, i % Noffsets, 1); + offset_trans.transform(&xo, &yo); + agg::trans_affine_translation transOffset(xo, yo); + agg::trans_affine trans = transforms[i % Ntransforms]; + trans *= transOffset; - x0 = std::min(x0, ext.x0 + xo); - y0 = std::min(y0, ext.y0 + yo); - x1 = std::max(x1, ext.x1 + xo); - y1 = std::max(y1, ext.y1 + yo); + ::get_path_extents(path, trans, &x0, &y0, &x1, &y1); + } + } catch (...) { + Py_XDECREF(offsets); + throw; } + Py_XDECREF(offsets); + Py::Tuple result(4); result[0] = Py::Float(x0); result[1] = Py::Float(y0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-10-12 14:29:59
|
Revision: 3938 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3938&view=rev Author: mdboom Date: 2007-10-12 07:29:57 -0700 (Fri, 12 Oct 2007) Log Message: ----------- Forgot the __init__.py Added Paths: ----------- branches/transforms/lib/matplotlib/projections/__init__.py Added: branches/transforms/lib/matplotlib/projections/__init__.py =================================================================== --- branches/transforms/lib/matplotlib/projections/__init__.py (rev 0) +++ branches/transforms/lib/matplotlib/projections/__init__.py 2007-10-12 14:29:57 UTC (rev 3938) @@ -0,0 +1,39 @@ +from polar import PolarAxes +from matplotlib import axes + +class ProjectionRegistry(object): + def __init__(self): + self._all_projection_types = {} + + def register(self, *projections): + for projection in projections: + name = projection.name + self._all_projection_types[name] = projection + + def get_projection_class(self, name): + return self._all_projection_types[name] + + def get_projection_names(self): + names = self._all_projection_types.keys() + names.sort() + return names +projection_registry = ProjectionRegistry() + +projection_registry.register( + axes.Axes, + PolarAxes) + +def get_projection_class(projection): + if projection is None: + projection = 'rectilinear' + + try: + return projection_registry.get_projection_class(projection) + except KeyError: + raise ValueError("Unknown projection '%s'" % projection) + +def projection_factory(projection, figure, rect, **kwargs): + return get_projection_class(projection)(figure, rect, **kwargs) + +def get_projection_names(): + return projection_registry.get_projection_names() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2007-10-12 12:27:49
|
Revision: 3937 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3937&view=rev Author: mdboom Date: 2007-10-12 05:27:25 -0700 (Fri, 12 Oct 2007) Log Message: ----------- First pass through all of the examples -- not all working yet, though. (See PASSED_DEMOS). Modified Paths: -------------- branches/transforms/PASSED_DEMOS branches/transforms/examples/to_numeric.py branches/transforms/lib/matplotlib/axes.py branches/transforms/lib/matplotlib/collections.py branches/transforms/lib/matplotlib/figure.py branches/transforms/lib/matplotlib/patches.py branches/transforms/lib/matplotlib/path.py branches/transforms/lib/matplotlib/projections/polar.py branches/transforms/lib/matplotlib/pyplot.py branches/transforms/lib/matplotlib/quiver.py branches/transforms/lib/matplotlib/table.py branches/transforms/lib/matplotlib/widgets.py branches/transforms/src/_backend_agg.cpp Modified: branches/transforms/PASSED_DEMOS =================================================================== --- branches/transforms/PASSED_DEMOS 2007-10-11 22:09:18 UTC (rev 3936) +++ branches/transforms/PASSED_DEMOS 2007-10-12 12:27:25 UTC (rev 3937) @@ -148,63 +148,63 @@ pcolor_log.py O pcolor_nonuniform.py O pcolor_small.py O -pick_event_demo2.py -pick_event_demo.py -pie_demo.py -plotfile_demo.py -polar_bar.py -polar_demo.py -polar_legend.py -polar_scatter.py -poly_editor.py -poormans_contour.py +pick_event_demo2.py O +pick_event_demo.py O +pie_demo.py O +plotfile_demo.py O +polar_bar.py O +polar_demo.py O +polar_legend.py O +polar_scatter.py O +poly_editor.py [NEEDS OVERHAUL] +poormans_contour.py O printing_in_wx.py -print_stdout.py -psd_demo.py +print_stdout.py [BROKEN?] +psd_demo.py O pstest.py pylab_with_gtk.py -pythonic_matplotlib.py -quadmesh_demo.py -quiver_demo.py -rc_traits.py -scatter_custom_symbol.py -scatter_demo2.py -scatter_demo.py -scatter_masked.py -scatter_profile.py -scatter_star_poly.py -set_and_get.py -shared_axis_across_figures.py -shared_axis_demo.py -simple3d_oo.py -simple3d.py -simple_plot_fps.py -simple_plot.py -specgram_demo.py -spy_demos.py -stem_plot.py -step_demo.py -stock_demo.py -strip_chart_demo.py -subplot_demo.py -subplots_adjust.py -subplot_toolbar.py -system_monitor.py -table_demo.py -tex_demo.py -text_handles.py -text_rotation.py -text_themes.py -tex_unicode_demo.py -toggle_images.py -to_numeric.py +pythonic_matplotlib.py O +quadmesh_demo.py [MASKED VALUES NOT QUITE RIGHT] +quiver_demo.py [SEGFAULTS] +rc_traits.py [N/A] +scatter_custom_symbol.py O +scatter_demo2.py O +scatter_demo.py O +scatter_masked.py O +scatter_profile.py O +scatter_star_poly.py O [SOME BUGS IN TRUNK -- FIXED ON BRANCH] +set_and_get.py O +shared_axis_across_figures.py O +shared_axis_demo.py O +simple3d_oo.py [PUNTING ON 3D FOR NOW] +simple3d.py [PUNTING ON 3D FOR NOW] +simple_plot_fps.py O +simple_plot.py O +specgram_demo.py O +spy_demos.py O +stem_plot.py O +step_demo.py O +stock_demo.py O +strip_chart_demo.py [REQUIRES GTK] +subplot_demo.py O +subplots_adjust.py O +subplot_toolbar.py O +system_monitor.py O +table_demo.py +tex_demo.py O +text_handles.py O +text_rotation.py O +text_themes.py O +tex_unicode_demo.py O +toggle_images.py [???] +to_numeric.py [REQUIRES PIL] transoffset.py -two_scales.py -unicode_demo.py -vertical_ticklabels.py -vline_demo.py -webapp_demo.py -wxcursor_demo.py -xcorr_demo.py -zoom_window.py -zorder_demo.py +two_scales.py O +unicode_demo.py O +vertical_ticklabels.py O +vline_demo.py O +webapp_demo.py +wxcursor_demo.py +xcorr_demo.py O +zoom_window.py O +zorder_demo.py O Modified: branches/transforms/examples/to_numeric.py =================================================================== --- branches/transforms/examples/to_numeric.py 2007-10-11 22:09:18 UTC (rev 3936) +++ branches/transforms/examples/to_numeric.py 2007-10-12 12:27:25 UTC (rev 3937) @@ -17,7 +17,7 @@ s = agg.tostring_rgb() # get the width and the height to resize the matrix -l,b,w,h = agg.figure.bbox.get_bounds() +l,b,w,h = agg.figure.bbox.bounds w, h = int(w), int(h) Modified: branches/transforms/lib/matplotlib/axes.py =================================================================== --- branches/transforms/lib/matplotlib/axes.py 2007-10-11 22:09:18 UTC (rev 3936) +++ branches/transforms/lib/matplotlib/axes.py 2007-10-12 12:27:25 UTC (rev 3937) @@ -1196,9 +1196,9 @@ len(self.lines)==0 and len(self.patches)==0)): - if scalex: self.set_xbound(self.dataLim.intervalx().get_bounds()) + if scalex: self.set_xbound(self.dataLim.intervalx) - if scaley: self.set_ybound(self.dataLim.intervaly().get_bounds()) + if scaley: self.set_ybound(self.dataLim.intervaly) return if scalex: @@ -4107,7 +4107,6 @@ if sym is not None: if symstyle==0: - collection = mcoll.RegularPolyCollection( self.figure.dpi, numsides, rotation, scales, @@ -4143,7 +4142,7 @@ verts /= rescale scales = npy.asarray(scales) - scales = npy.sqrt(scales * self.figure.dpi.get() / 72.) + scales = npy.sqrt(scales * self.figure.dpi / 72.) if len(scales)==1: verts = [scales[0]*verts] else: @@ -4858,7 +4857,7 @@ self.set_xlabel('Frequency') self.set_ylabel('Power Spectrum (dB)') self.grid(True) - vmin, vmax = self.viewLim.intervaly().get_bounds() + vmin, vmax = self.viewLim.intervaly intv = vmax-vmin logi = int(npy.log10(intv)) if logi==0: logi=.1 Modified: branches/transforms/lib/matplotlib/collections.py =================================================================== --- branches/transforms/lib/matplotlib/collections.py 2007-10-11 22:09:18 UTC (rev 3936) +++ branches/transforms/lib/matplotlib/collections.py 2007-10-12 12:27:25 UTC (rev 3937) @@ -78,9 +78,9 @@ **kwargs ): """ - Create a PatchCollection + Create a Collection - %(PatchCollection)s + %(Collection)s """ artist.Artist.__init__(self) cm.ScalarMappable.__init__(self, norm, cmap) @@ -103,8 +103,9 @@ self._uniform_offsets = None self._offsets = npy.zeros((1, 2)) if offsets is not None: -# if len(offsets.shape) == 1: -# offsets = offsets[npy.newaxis,:] # Make it Nx2. + offsets = npy.asarray(offsets, npy.float_) + if len(offsets.shape) == 1: + offsets = offsets[npy.newaxis,:] # Make it Nx2. if transOffset is not None: Affine2D = transforms.Affine2D self._offsets = offsets @@ -171,7 +172,10 @@ if not transform.is_affine: paths = [transform.transform_path_non_affine(path) for path in paths] transform = transform.get_affine() - + if not transOffset.is_affine: + offsets = transOffset.transform_non_affine(offsets) + transOffset = transOffset.get_affine() + renderer.draw_path_collection( transform, self.clipbox, clippath, clippath_trans, paths, self.get_transforms(), @@ -353,7 +357,7 @@ #print 'update_scalarmappable: self._A', self._A if self._A is None: return if len(self._A.shape)>1: - raise ValueError('PatchCollections can only map rank 1 arrays') + raise ValueError('Collections can only map rank 1 arrays') if len(self._facecolors): self._facecolors = self.to_rgba(self._A, self._alpha) else: @@ -410,33 +414,45 @@ (0, 2) .. (0, meshWidth), (1, 0), (1, 1), and so on. """ def __init__(self, meshWidth, meshHeight, coordinates, showedges): + Path = path.Path + Collection.__init__(self) self._meshWidth = meshWidth self._meshHeight = meshHeight self._coordinates = coordinates self._showedges = showedges + + # MGDTODO: Numpify + coordinates = coordinates.reshape((meshHeight + 1, meshWidth + 1, 2)) + c = coordinates + paths = [] + # We could let the Path constructor generate the codes for us, + # but this is faster, since we know they'll always be the same + codes = npy.array([Path.MOVETO, Path.LINETO, Path.LINETO, Path.LINETO]) + for m in xrange(meshHeight): + for n in xrange(meshWidth): + paths.append(Path( + [c[m , n], + c[m , n+1], + c[m+1, n+1], + c[m+1, n]], + codes)) + self._paths = paths + + def get_paths(self, dataTrans=None): + return self._paths - def get_verts(self, dataTrans=None): - return self._coordinates; - def draw(self, renderer): - # does not call update_scalarmappable, need to update it - # when creating/changing ****** Why not? speed? - if not self.get_visible(): return - transform = self.get_transform() - transoffset = self._transOffset - transform.freeze() - transoffset.freeze() - #print 'QuadMesh draw' self.update_scalarmappable() ####################### - renderer.draw_quad_mesh( self._meshWidth, self._meshHeight, - self._facecolors, self._coordinates[:,0], - self._coordinates[:, 1], self.clipbox, transform, - self._offsets, transoffset, self._showedges) - transform.thaw() - transoffset.thaw() + self._linewidths = (1,) + if self._showedges: + self._edgecolors = npy.array([[0.0, 0.0, 0.0, 1.0]], npy.float_) + else: + self._edgecolors = self._facecolors + Collection.draw(self, renderer) + class PolyCollection(Collection): def __init__(self, verts, **kwargs): """ @@ -476,6 +492,8 @@ __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd class RegularPolyCollection(Collection): + _path_generator = path.Path.unit_regular_polygon + def __init__(self, dpi, numsides, @@ -514,18 +532,16 @@ offsets = offsets, transOffset = ax.transData, ) - - """ Collection.__init__(self,**kwargs) self._sizes = sizes self._dpi = dpi - self._paths = [path.Path.unit_regular_polygon(numsides)] + self._paths = [self._path_generator(numsides)] # sizes is the area of the circle circumscribing the polygon # in points^2 self._transforms = [ - transforms.Affine2D().rotate(rotation).scale( - (math.sqrt(x) * self._dpi / 72.0) * (1.0 / math.sqrt(math.pi))) + transforms.Affine2D().rotate(-rotation).scale( + (math.sqrt(x) * self._dpi / 72.0) / math.sqrt(math.pi)) for x in sizes] self.set_transform(transforms.IdentityTransform()) @@ -554,72 +570,13 @@ class StarPolygonCollection(RegularPolyCollection): - def __init__(self, - dpi, - numsides, - rotation = 0 , - sizes = (1,), - **kwargs): - """ - Draw a regular star like Polygone with numsides. - - * dpi is the figure dpi instance, and is required to do the - area scaling. - - * numsides: the number of sides of the polygon - - * sizes gives the area of the circle circumscribing the - regular polygon in points^2 - - * rotation is the rotation of the polygon in radians - - %(Collection)s - """ - - RegularPolyCollection.__init__(self, dpi, numsides, rotation, sizes, **kwargs) - __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd - - def _update_verts(self): - scale = 1.0/math.sqrt(math.pi) - ns2 = self.numsides*2 - r = scale*npy.ones(ns2) - r[1::2] *= 0.5 - theta = (math.pi/self.numsides)*npy.arange(ns2) + self.rotation - self._verts = zip( r*npy.sin(theta), r*npy.cos(theta) ) - + _path_generator = path.Path.unit_regular_star + + class AsteriskPolygonCollection(RegularPolyCollection): - def __init__(self, - dpi, - numsides, - rotation = 0 , - sizes = (1,), - **kwargs): - """ - Draw a regular asterisk Polygone with numsides spikes. - - * dpi is the figure dpi instance, and is required to do the - area scaling. - - * numsides: the number of spikes of the polygon - - * sizes gives the area of the circle circumscribing the - regular polygon in points^2 - - * rotation is the rotation of the polygon in radians - - %(Collection)s - """ - - RegularPolyCollection.__init__(self, dpi, numsides, rotation, sizes, **kwargs) - __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd - - def _update_verts(self): - scale = 1.0/math.sqrt(math.pi) - r = scale*npy.ones(self.numsides*2) - r[1::2] = 0 - theta = (math.pi/self.numsides)*npy.arange(2*self.numsides) + self.rotation - self._verts = zip( r*npy.sin(theta), r*npy.cos(theta) ) - + _path_generator = path.Path.unit_regular_asterisk + + class LineCollection(Collection, cm.ScalarMappable): """ All parameters must be sequences or scalars; if scalars, they will Modified: branches/transforms/lib/matplotlib/figure.py =================================================================== --- branches/transforms/lib/matplotlib/figure.py 2007-10-11 22:09:18 UTC (rev 3936) +++ branches/transforms/lib/matplotlib/figure.py 2007-10-12 12:27:25 UTC (rev 3937) @@ -106,8 +106,7 @@ class Figure(Artist): def __str__(self): - return "Figure(%gx%g)"%(self.bbox.max) - # return "Figure(%gx%g)"%(self.figwidth.get(),self.figheight.get()) + return "Figure(%gx%g)" % tuple(self.bbox.size) def __init__(self, figsize = None, # defaults to rc figure.figsize Modified: branches/transforms/lib/matplotlib/patches.py =================================================================== --- branches/transforms/lib/matplotlib/patches.py 2007-10-11 22:09:18 UTC (rev 3936) +++ branches/transforms/lib/matplotlib/patches.py 2007-10-12 12:27:25 UTC (rev 3937) @@ -495,7 +495,7 @@ A general polygon patch. """ def __str__(self): - return "Poly(%g,%g)"%self.xy[0] + return "Poly(%g, %g)" % tuple(self._path.vertices[0]) def __init__(self, xy, **kwargs): """ @@ -506,11 +506,15 @@ See Patch documentation for additional kwargs """ Patch.__init__(self, **kwargs) + self.xy = xy self._path = Path(xy, closed=True) __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd def get_path(self): return self._path + + def update(self): + self._path = Path(self.xy, closed=True) class Wedge(Patch): def __str__(self): Modified: branches/transforms/lib/matplotlib/path.py =================================================================== --- branches/transforms/lib/matplotlib/path.py 2007-10-11 22:09:18 UTC (rev 3936) +++ branches/transforms/lib/matplotlib/path.py 2007-10-12 12:27:25 UTC (rev 3937) @@ -93,7 +93,7 @@ codes = self.LINETO * npy.ones( vertices.shape[0] + 1, self.code_type) codes[0] = self.MOVETO - codes[-1] = self.LINETO + codes[-1] = self.CLOSEPOLY vertices = npy.concatenate((vertices, [vertices[0]])) else: codes = self.LINETO * npy.ones( @@ -214,7 +214,7 @@ if cls._unit_rectangle is None: cls._unit_rectangle = \ Path([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 1.0]]) - return cls._unit_rectangle + return cls._unit_rectangle unit_rectangle = classmethod(unit_rectangle) _unit_regular_polygons = {} @@ -237,6 +237,37 @@ return path unit_regular_polygon = classmethod(unit_regular_polygon) + _unit_regular_stars = {} + #@classmethod + def unit_regular_star(cls, numVertices, innerCircle=0.5): + """ + Returns a Path for a unit regular star with the given + numVertices and radius of 1.0, centered at (0, 0). + """ + path = cls._unit_regular_stars.get((numVertices, innerCircle)) + if path is None: + ns2 = numVertices * 2 + theta = (2*npy.pi/ns2 * npy.arange(ns2)) + # This initial rotation is to make sure the polygon always + # "points-up" + theta += npy.pi / 2.0 + r = npy.ones(ns2) + r[1::2] = innerCircle + verts = npy.vstack((r*npy.cos(theta), r*npy.sin(theta))).transpose() + path = Path(verts) + cls._unit_regular_polygons[(numVertices, innerCircle)] = path + return path + unit_regular_star = classmethod(unit_regular_star) + + #@classmethod + def unit_regular_asterisk(cls, numVertices): + """ + Returns a Path for a unit regular asterisk with the given + numVertices and radius of 1.0, centered at (0, 0). + """ + return cls.unit_regular_star(numVertices, 0.0) + unit_regular_asterisk = classmethod(unit_regular_asterisk) + _unit_circle = None #@classmethod def unit_circle(cls): Modified: branches/transforms/lib/matplotlib/projections/polar.py =================================================================== --- branches/transforms/lib/matplotlib/projections/polar.py 2007-10-11 22:09:18 UTC (rev 3936) +++ branches/transforms/lib/matplotlib/projections/polar.py 2007-10-12 12:27:25 UTC (rev 3937) @@ -55,8 +55,7 @@ transform_non_affine.__doc__ = Transform.transform_non_affine.__doc__ def transform_path(self, path): - if len(path.vertices) == 2: - path = path.interpolated(self._resolution) + path = path.interpolated(self._resolution) return Path(self.transform(path.vertices), path.codes) transform_path.__doc__ = Transform.transform_path.__doc__ Modified: branches/transforms/lib/matplotlib/pyplot.py =================================================================== --- branches/transforms/lib/matplotlib/pyplot.py 2007-10-11 22:09:18 UTC (rev 3936) +++ branches/transforms/lib/matplotlib/pyplot.py 2007-10-12 12:27:25 UTC (rev 3937) @@ -2,7 +2,7 @@ import matplotlib from matplotlib import _pylab_helpers -from matplotlib.cbook import dedent, silent_list +from matplotlib.cbook import dedent, silent_list, is_string_like, is_numlike from matplotlib.figure import Figure, figaspect from matplotlib.backend_bases import FigureCanvasBase from matplotlib.image import imread as _imread @@ -1232,9 +1232,9 @@ def getname_val(identifier): 'return the name and column data for identifier' - if cbook.is_string_like(identifier): + if is_string_like(identifier): return identifier, r[identifier] - elif cbook.is_numlike(identifier): + elif is_numlike(identifier): name = r.dtype.names[int(identifier)] return name, r[name] else: Modified: branches/transforms/lib/matplotlib/quiver.py =================================================================== --- branches/transforms/lib/matplotlib/quiver.py 2007-10-11 22:09:18 UTC (rev 3936) +++ branches/transforms/lib/matplotlib/quiver.py 2007-10-12 12:27:25 UTC (rev 3937) @@ -168,8 +168,7 @@ self.coord = kw.pop('coordinates', 'axes') self.color = kw.pop('color', None) self.label = label - self.labelsep = (transforms.Value(kw.pop('labelsep', 0.1)) - * Q.ax.figure.dpi) + self.labelsep = (kw.pop('labelsep', 0.1) * Q.ax.figure.dpi) self.labelpos = kw.pop('labelpos', 'N') self.labelcolor = kw.pop('labelcolor', None) self.fontproperties = kw.pop('fontproperties', dict()) @@ -281,8 +280,8 @@ self.pivot = kw.pop('pivot', 'tail') kw.setdefault('facecolors', self.color) kw.setdefault('linewidths', (0,)) - collections.PolyCollection.__init__(self, None, offsets=zip(X, Y), - transOffset=ax.transData, **kw) + collections.PolyCollection.__init__(self, [], offsets=zip(X, Y), + transOffset=ax.transData, **kw) self.polykw = kw self.set_UVC(U, V, C) self._initialized = False @@ -324,7 +323,7 @@ if not self._initialized: trans = self._set_transform() ax = self.ax - sx, sy = trans.inverse_xy_tup((ax.bbox.width(), ax.bbox.height())) + sx, sy = trans.transform_point((ax.bbox.width, ax.bbox.height)) self.span = sx sn = max(8, min(25, math.sqrt(self.N))) if self.width is None: @@ -362,17 +361,17 @@ dx = dx1/dx0 else: if self.units == 'width': - dx = ax.bbox.ur().x() - ax.bbox.ll().x() + dx = ax.bbox.width elif self.units == 'height': - dx = ax.bbox.ur().y() - ax.bbox.ll().y() + dx = ax.bbox.height elif self.units == 'dots': dx = transforms.Value(1) elif self.units == 'inches': dx = ax.figure.dpi else: raise ValueError('unrecognized units') - bb = transforms.Bbox(transforms.origin(), transforms.Point(dx, dx)) - trans = transforms.get_bbox_transform(transforms.unit_bbox(), bb) + bb = transforms.Bbox.from_lbrt(0, 0, dx, dx) + trans = transforms.BboxTransform(transforms.Bbox.unit(), bb) self.set_transform(trans) return trans Modified: branches/transforms/lib/matplotlib/table.py =================================================================== --- branches/transforms/lib/matplotlib/table.py 2007-10-11 22:09:18 UTC (rev 3936) +++ branches/transforms/lib/matplotlib/table.py 2007-10-12 12:27:25 UTC (rev 3937) @@ -216,7 +216,7 @@ self._cells[(row, col)] = cell def _approx_text_height(self): - return self.FONTSIZE/72.0*self.figure.dpi.get()/self._axes.bbox.height() * 1.2 + return self.FONTSIZE/72.0*self.figure.dpi/self._axes.bbox.height * 1.2 def draw(self, renderer): # Need a renderer to do hit tests on mouseevent; assume the last one will do Modified: branches/transforms/lib/matplotlib/widgets.py =================================================================== --- branches/transforms/lib/matplotlib/widgets.py 2007-10-11 22:09:18 UTC (rev 3936) +++ branches/transforms/lib/matplotlib/widgets.py 2007-10-12 12:27:25 UTC (rev 3937) @@ -242,6 +242,7 @@ def set_val(self, val): self.poly.xy[-1] = val, 0 self.poly.xy[-2] = val, 1 + self.poly.update() self.valtext.set_text(self.valfmt%val) if self.drawon: self.ax.figure.canvas.draw() self.val = val Modified: branches/transforms/src/_backend_agg.cpp =================================================================== --- branches/transforms/src/_backend_agg.cpp 2007-10-11 22:09:18 UTC (rev 3936) +++ branches/transforms/src/_backend_agg.cpp 2007-10-12 12:27:25 UTC (rev 3937) @@ -832,6 +832,8 @@ // Render face if (face.first) { + theRasterizer->add_path(curve); + if (gc.isaa) { if (has_clippath) { pixfmt_amask_type pfa(*pixFmt, *alphaMask); @@ -841,7 +843,6 @@ agg::render_scanlines(*theRasterizer, *slineP8, ren); } else { rendererAA->color(face.second); - theRasterizer->add_path(curve); agg::render_scanlines(*theRasterizer, *slineP8, *rendererAA); } } else { @@ -853,7 +854,6 @@ agg::render_scanlines(*theRasterizer, *slineP8, ren); } else { rendererBin->color(face.second); - theRasterizer->add_path(curve); agg::render_scanlines(*theRasterizer, *slineP8, *rendererBin); } } @@ -945,7 +945,7 @@ Py::SeqBase<Py::Object> paths = args[4]; Py::SeqBase<Py::Object> transforms_obj = args[5]; Py::Object offsets_obj = args[6]; - agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[7], false); + agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[7]); Py::Object facecolors_obj = args[8]; Py::Object edgecolors_obj = args[9]; Py::SeqBase<Py::Float> linewidths = args[10]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |