From: <md...@us...> - 2008-05-19 19:05:29
|
Revision: 5193 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5193&view=rev Author: mdboom Date: 2008-05-19 12:05:23 -0700 (Mon, 19 May 2008) Log Message: ----------- [ 1966974 ] win32FontDirectory() can fail with access denied (Thanks, Patrik Simons) Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/font_manager.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-05-19 12:55:47 UTC (rev 5192) +++ branches/v0_91_maint/CHANGELOG 2008-05-19 19:05:23 UTC (rev 5193) @@ -1,3 +1,6 @@ +2008-05-19 Fix crash when Windows can not access the registry to + determine font path [Bug 1966974, thanks Patrik Simons] - MGD + 2008-05-14 Don't use stat on Windows (fixes font embedding problem) - MGD 2008-05-09 Fix /singlequote (') in Postscript backend - MGD Modified: branches/v0_91_maint/lib/matplotlib/font_manager.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/font_manager.py 2008-05-19 12:55:47 UTC (rev 5192) +++ branches/v0_91_maint/lib/matplotlib/font_manager.py 2008-05-19 19:05:23 UTC (rev 5193) @@ -107,14 +107,17 @@ except ImportError: pass # Fall through to default else: - user = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, MSFolders) try: + user = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER, MSFolders) try: - return _winreg.QueryValueEx(user, 'Fonts')[0] - except OSError: - pass # Fall through to default - finally: - _winreg.CloseKey(user) + try: + return _winreg.QueryValueEx(user, 'Fonts')[0] + except OSError: + pass # Fall through to default + finally: + _winreg.CloseKey(user) + except OSError: + pass # Fall through to default return os.path.join(os.environ['WINDIR'], 'Fonts') def win32InstalledFonts(directory=None, fontext='ttf'): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-05-20 21:02:18
|
Revision: 5205 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5205&view=rev Author: jdh2358 Date: 2008-05-20 14:02:08 -0700 (Tue, 20 May 2008) Log Message: ----------- remove pesky date auto xlabel Modified Paths: -------------- branches/v0_91_maint/CODING_GUIDE branches/v0_91_maint/lib/matplotlib/dates.py Modified: branches/v0_91_maint/CODING_GUIDE =================================================================== --- branches/v0_91_maint/CODING_GUIDE 2008-05-20 16:00:21 UTC (rev 5204) +++ branches/v0_91_maint/CODING_GUIDE 2008-05-20 21:02:08 UTC (rev 5205) @@ -46,7 +46,8 @@ keep them in sync. http://www.orcaware.com/svn/wiki/Svnmerge.py. The basic procedure is: - - install svnmerge.py in your PATH + - install svnmerge.py in your PATH: + wget http://svn.collab.net/repos/svn/trunk/contrib/client-side/svnmerge/svnmerge.py - get a svn copy of the branch (svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_91_maint) Modified: branches/v0_91_maint/lib/matplotlib/dates.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/dates.py 2008-05-20 16:00:21 UTC (rev 5204) +++ branches/v0_91_maint/lib/matplotlib/dates.py 2008-05-20 21:02:08 UTC (rev 5205) @@ -1003,7 +1003,7 @@ return units.AxisInfo( majloc = majloc, majfmt = majfmt, - label='date', + label='', ) else: return None axisinfo = staticmethod(axisinfo) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mme...@us...> - 2008-05-21 09:48:04
|
Revision: 5207 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5207&view=rev Author: mmetz_bn Date: 2008-05-21 02:47:59 -0700 (Wed, 21 May 2008) Log Message: ----------- Fixed bug in plotfile Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/pyplot.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-05-20 21:05:49 UTC (rev 5206) +++ branches/v0_91_maint/CHANGELOG 2008-05-21 09:47:59 UTC (rev 5207) @@ -1,3 +1,5 @@ +2008-05-21 Fix a "local variable unreferenced" bug in plotfile - MM + 2008-05-19 Fix crash when Windows can not access the registry to determine font path [Bug 1966974, thanks Patrik Simons] - MGD Modified: branches/v0_91_maint/lib/matplotlib/pyplot.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/pyplot.py 2008-05-20 21:05:49 UTC (rev 5206) +++ branches/v0_91_maint/lib/matplotlib/pyplot.py 2008-05-21 09:47:59 UTC (rev 5207) @@ -38,7 +38,7 @@ def switch_backend(newbackend): """ - Swtich the default backend to newbackend. This feature is + Switch the default backend to newbackend. This feature is EXPERIMENTAL, and is only expected to work switching to an image backend. Eg, if you have a bunch of PS scripts that you want to run from an interactive ipython session, you may want to switch to @@ -1225,7 +1225,7 @@ xname, x = getname_val(cols[0]) if len(cols)==1: - ax1 = fig.add_subplot(N,1,i) + ax1 = fig.add_subplot(1,1,1) funcname = plotfuncs.get(cols[0], 'plot') func = getattr(ax1, funcname) func(x, **kwargs) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-05-21 13:06:54
|
Revision: 5211 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5211&view=rev Author: mdboom Date: 2008-05-21 06:06:51 -0700 (Wed, 21 May 2008) Log Message: ----------- Backport TkAgg segfault fix. Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/src/_tkagg.cpp Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-05-21 13:03:36 UTC (rev 5210) +++ branches/v0_91_maint/CHANGELOG 2008-05-21 13:06:51 UTC (rev 5211) @@ -1,3 +1,5 @@ +2008-05-21 Fix segfault in TkAgg backend - MGD + 2008-05-21 Fix a "local variable unreferenced" bug in plotfile - MM 2008-05-19 Fix crash when Windows can not access the registry to Modified: branches/v0_91_maint/src/_tkagg.cpp =================================================================== --- branches/v0_91_maint/src/_tkagg.cpp 2008-05-21 13:03:36 UTC (rev 5210) +++ branches/v0_91_maint/src/_tkagg.cpp 2008-05-21 13:06:51 UTC (rev 5211) @@ -50,6 +50,7 @@ agg::int8u *destbuffer; double l,b,r,t; int destx, desty, destwidth, destheight, deststride; + unsigned long aggl, bboxl; long mode; long nval; @@ -71,7 +72,11 @@ return TCL_ERROR; } /* get array (or object that can be converted to array) pointer */ - aggo = (PyObject*)atol(argv[2]); + if (sscanf (argv[2],"%lu",&aggl) != 1) { + Tcl_AppendResult(interp, "error casting pointer", (char *) NULL); + return TCL_ERROR; + } + aggo = (PyObject*)aggl; RendererAgg *aggRenderer = (RendererAgg *)aggo; int srcheight = (int)aggRenderer->get_height(); @@ -85,7 +90,11 @@ } /* check for bbox/blitting */ - bboxo = (PyObject*)atol(argv[4]); + if (sscanf(argv[4], "%lu", &bboxl) != 1) { + Tcl_AppendResult(interp, "error casting pointer", (char *) NULL); + return TCL_ERROR; + } + bboxo = (PyObject*)bboxl; if (bboxo != Py_None) { bbox = (Bbox*)bboxo; l = bbox->ll_api()->x_api()->val(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-05-26 17:03:01
|
Revision: 5271 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5271&view=rev Author: jdh2358 Date: 2008-05-26 10:02:46 -0700 (Mon, 26 May 2008) Log Message: ----------- added a line vertex selector widget Modified Paths: -------------- branches/v0_91_maint/CODING_GUIDE branches/v0_91_maint/lib/matplotlib/lines.py Modified: branches/v0_91_maint/CODING_GUIDE =================================================================== --- branches/v0_91_maint/CODING_GUIDE 2008-05-25 21:31:43 UTC (rev 5270) +++ branches/v0_91_maint/CODING_GUIDE 2008-05-26 17:02:46 UTC (rev 5271) @@ -9,12 +9,6 @@ svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk matplotlib --username=youruser --password=yourpass -# checking out the main src -svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/matplotlib matplotlib --username=youruser --password=yourpass - -# branch checkouts, eg the transforms branch -svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/transforms transbranch - == Committing changes == When committing changes to matplotlib, there are a few things to bear Modified: branches/v0_91_maint/lib/matplotlib/lines.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/lines.py 2008-05-25 21:31:43 UTC (rev 5270) +++ branches/v0_91_maint/lib/matplotlib/lines.py 2008-05-26 17:02:46 UTC (rev 5271) @@ -569,6 +569,10 @@ def get_markersize(self): return self._markersize + def get_data(self, orig=True): + 'return the xdata, ydata; if orig is True, return the original data' + return self.get_xdata(orig=orig), self.get_ydata(orig=orig) + def get_xdata(self, orig=True): """ return the xdata; if orig is true return the original data, @@ -1460,7 +1464,58 @@ 'return True if line is dashstyle' return self._linestyle in ('--', '-.', ':') +class VertexSelector: + """ + manage the callbacks to maintain a list of selected vertices for + matplotlib.lines.Lin2D. Derived classes should override + process_selected to do something with the picks + """ + def __init__(self, line): + """ + Initialize the class with a matplotlib.lines.Line2D instance. + The line should already be added to some matplotlib.axes.Axes + instance and should have the picker property set. + """ + if not hasattr(line, 'axes'): + raise RuntimeError('You must first add the line to the Axes') + if line.get_picker() is None: + raise RuntimeError('You must first set the picker property of the line') + + self.axes = line.axes + self.line = line + self.canvas = self.axes.figure.canvas + self.cid = self.canvas.mpl_connect('pick_event', self.onpick) + + self.ind = set() + + + def process_selected(self, ind, xs, ys): + """ + Default do nothing implementation of the process_selected method. + + ind are the indices of the selected vertices. xs and ys are + the coordinates of the selected vertices. + """ + pass + + def onpick(self, event): + 'when the line is picked, update the set of selected indicies' + if event.artist is not self.line: return + + for i in event.ind: + if i in self.ind: + self.ind.remove(i) + else: + self.ind.add(i) + + + ind = list(self.ind) + ind.sort() + ind = npy.array(ind) + xdata, ydata = self.line.get_data() + self.process_selected(ind, xdata[ind], ydata[ind]) + lineStyles = Line2D._lineStyles lineMarkers = Line2D._markers This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-05-28 13:31:42
|
Revision: 5283 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5283&view=rev Author: mdboom Date: 2008-05-28 06:31:39 -0700 (Wed, 28 May 2008) Log Message: ----------- Fix rendering of composite glyphs in Type 3 conversion (particularly as evidenced in the Eunjin.ttf Korean font) Thanks Jae-Joon Lee for finding this! Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/ttconv/pprdrv_tt2.cpp Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-05-28 03:16:35 UTC (rev 5282) +++ branches/v0_91_maint/CHANGELOG 2008-05-28 13:31:39 UTC (rev 5283) @@ -1,3 +1,7 @@ +2008-05-28 Fix rendering of composite glyphs in Type 3 conversion + (particularly as evidenced in the Eunjin.ttf Korean font) + Thanks Jae-Joon Lee for finding this! + 2008-05-21 Fix segfault in TkAgg backend - MGD 2008-05-21 Fix a "local variable unreferenced" bug in plotfile - MM Modified: branches/v0_91_maint/ttconv/pprdrv_tt2.cpp =================================================================== --- branches/v0_91_maint/ttconv/pprdrv_tt2.cpp 2008-05-28 03:16:35 UTC (rev 5282) +++ branches/v0_91_maint/ttconv/pprdrv_tt2.cpp 2008-05-28 13:31:39 UTC (rev 5283) @@ -531,8 +531,8 @@ } else /* The tt spec. does not clearly indicate */ { /* whether these values are signed or not. */ - arg1 = *(glyph++); - arg2 = *(glyph++); + arg1 = *(signed char *)(glyph++); + arg2 = *(signed char *)(glyph++); } if(flags & WE_HAVE_A_SCALE) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-05-28 18:03:26
|
Revision: 5292 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5292&view=rev Author: jdh2358 Date: 2008-05-28 11:03:15 -0700 (Wed, 28 May 2008) Log Message: ----------- added keywords to configure sliders for sf patch 1866207 Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/examples/logo.py branches/v0_91_maint/examples/widgets/sliders.py branches/v0_91_maint/lib/matplotlib/widgets.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-05-28 17:00:15 UTC (rev 5291) +++ branches/v0_91_maint/CHANGELOG 2008-05-28 18:03:15 UTC (rev 5292) @@ -1,3 +1,8 @@ +2008-05-28 Allow keyword args to configure widget properties as + requested in + http://sourceforge.net/tracker/index.php?func=detail&aid=1866207&group_id=80706&atid=560722 + - JDH + 2008-05-28 Fix rendering of composite glyphs in Type 3 conversion (particularly as evidenced in the Eunjin.ttf Korean font) Thanks Jae-Joon Lee for finding this! Modified: branches/v0_91_maint/examples/logo.py =================================================================== --- branches/v0_91_maint/examples/logo.py 2008-05-28 17:00:15 UTC (rev 5291) +++ branches/v0_91_maint/examples/logo.py 2008-05-28 18:03:15 UTC (rev 5292) @@ -8,7 +8,7 @@ file('data/membrane.dat', 'rb').read(), float32) # 0.0005 is the sample interval t = 0.0005*arange(len(x)) -figure(1, figsize=(7,1), dpi=100) +figure(1, figsize=(4,1), dpi=70) ax = subplot(111, axisbg='y') plot(t, x) text(0.5, 0.5,'matplotlib', color='r', @@ -20,5 +20,5 @@ axis([1, 1.72,-60, 10]) setp(gca(), 'xticklabels', []) setp(gca(), 'yticklabels', []) -#savefig('logo2.png', dpi=300) +savefig('logo2.png', dpi=70) show() Modified: branches/v0_91_maint/examples/widgets/sliders.py =================================================================== --- branches/v0_91_maint/examples/widgets/sliders.py 2008-05-28 17:00:15 UTC (rev 5291) +++ branches/v0_91_maint/examples/widgets/sliders.py 2008-05-28 18:03:15 UTC (rev 5292) @@ -12,8 +12,8 @@ axfreq = axes([0.125, 0.1, 0.775, 0.03], axisbg=axcolor) axamp = axes([0.125, 0.15, 0.775, 0.03], axisbg=axcolor) -sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=1) -samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=1) +sfreq = Slider(axfreq, 'Freq', 0.1, 30.0, valinit=1, facecolor='blue', alpha=0.5) +samp = Slider(axamp, 'Amp', 0.1, 10.0, valinit=1, facecolor='red', alpha=0.5) def update(val): amp = samp.val Modified: branches/v0_91_maint/lib/matplotlib/widgets.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/widgets.py 2008-05-28 17:00:15 UTC (rev 5291) +++ branches/v0_91_maint/lib/matplotlib/widgets.py 2008-05-28 18:03:15 UTC (rev 5292) @@ -171,7 +171,7 @@ """ def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f', closedmin=True, closedmax=True, slidermin=None, slidermax=None, - dragging=True): + dragging=True, **kwargs): """ Create a slider from valmin to valmax in axes ax; @@ -185,6 +185,11 @@ slidermin and slidermax - be used to contrain the value of this slider to the values of other sliders. + + additional kwargs are passed on to self.poly which is the + matplotlib.patches.Rectangle which draws the slider. See the + matplotlib.patches.Rectangle documentation for legal property + names (eg facecolor, edgecolor, alpha, ...) """ self.ax = ax @@ -192,7 +197,7 @@ self.valmax = valmax self.val = valinit self.valinit = valinit - self.poly = ax.axvspan(valmin,valinit,0,1) + self.poly = ax.axvspan(valmin,valinit,0,1, **kwargs) self.vline = ax.axvline(valinit,0,1, color='r', lw=1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-05-28 18:19:32
|
Revision: 5294 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5294&view=rev Author: mdboom Date: 2008-05-28 11:19:30 -0700 (Wed, 28 May 2008) Log Message: ----------- Adding CHANGELOG entry and scary comment about what was going wrong. Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-05-28 18:13:05 UTC (rev 5293) +++ branches/v0_91_maint/CHANGELOG 2008-05-28 18:19:30 UTC (rev 5294) @@ -1,3 +1,6 @@ +2008-05-28 Fix crashing of PDFs in xpdf and ghostscript when two-byte + characters are used with Type 3 fonts - MGD + 2008-05-28 Allow keyword args to configure widget properties as requested in http://sourceforge.net/tracker/index.php?func=detail&aid=1866207&group_id=80706&atid=560722 Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py 2008-05-28 18:13:05 UTC (rev 5293) +++ branches/v0_91_maint/lib/matplotlib/backends/backend_pdf.py 2008-05-28 18:19:30 UTC (rev 5294) @@ -713,6 +713,12 @@ charprocDict['Type'] = Name('XObject') charprocDict['Subtype'] = Name('Form') charprocDict['BBox'] = bbox + # Each glyph includes bounding box information, + # but xpdf and ghostscript can't handle it in a + # Form XObject (they segfault!!!), so we remove it + # from the stream here. It's not needed anyway, + # since the Form XObject includes it in its BBox + # value. stream = stream[stream.find("d1") + 2:] charprocObject = self.reserveObject('charProc') self.beginStream(charprocObject.id, None, charprocDict) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-05-29 13:01:45
|
Revision: 5298 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5298&view=rev Author: mdboom Date: 2008-05-29 06:01:40 -0700 (Thu, 29 May 2008) Log Message: ----------- Implement path clipping in SVG backend. Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-05-29 11:47:44 UTC (rev 5297) +++ branches/v0_91_maint/CHANGELOG 2008-05-29 13:01:40 UTC (rev 5298) @@ -1,3 +1,5 @@ +2008-05-29 Implement path clipping in SVG backend - MGD + 2008-05-28 Fix crashing of PDFs in xpdf and ghostscript when two-byte characters are used with Type 3 fonts - MGD Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py 2008-05-29 11:47:44 UTC (rev 5297) +++ branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py 2008-05-29 13:01:40 UTC (rev 5298) @@ -56,6 +56,37 @@ self._svgwriter.write ('%s<%s style="%s" %s %s/>\n' % ( cliprect, element, style, clippath, details)) + def _path_commands(self, path): + cmd = [] + while 1: + code, xp, yp = path.vertex() + yp = self.height - yp + + if code == agg.path_cmd_stop: + cmd.append('z') # Hack, path_cmd_end_poly not found + break + elif code == agg.path_cmd_move_to: + cmd.append('M%g %g' % (xp, yp)) + elif code == agg.path_cmd_line_to: + cmd.append('L%g %g' % (xp, yp)) + elif code == agg.path_cmd_curve3: + verts = [xp, yp] + verts.extent(path.vertex()[1:]) + verts[-1] = self.height - verts[-1] + cmd.append('Q%g %g %g %g' % tuple(verts)) + elif code == agg.path_cmd_curve4: + verts = [xp, yp] + verts.extend(path.vertex()[1:]) + verts[-1] = self.height - verts[-1] + verts.extend(path.vertex()[1:]) + verts[-1] = self.height - verts[-1] + cmd.append('C%g %g %g %g %g %g'%tuple(verts)) + elif code == agg.path_cmd_end_poly: + cmd.append('z') + + path_data = "".join(cmd) + return path_data + def _get_font(self, prop): key = hash(prop) font = self.fontd.get(key) @@ -108,10 +139,28 @@ def _get_gc_clip_svg(self, gc): cliprect = gc.get_clip_rectangle() - if cliprect is None: + clippath = gc.get_clip_path() + if cliprect is None and clippath is None: return '', None - else: + elif clippath is not None: # See if we've already seen this clip rectangle + key = hash(clippath) + if self._clipd.get(key) is None: # If not, store a new clipPath + self._clipd[key] = clippath + style = "stroke: gray; fill: none;" + path_data = self._path_commands(clippath) + path = """\ +<defs> + <clipPath id="%(key)s"> + <path d="%(path_data)s"/> + </clipPath> +</defs> +""" % locals() + return path, key + else: + return '', key + elif cliprect is not None: + # See if we've already seen this clip rectangle key = hash(cliprect) if self._clipd.get(key) is None: # If not, store a new clipPath self._clipd[key] = cliprect @@ -139,35 +188,7 @@ self._svgwriter.write('</g>\n') def draw_path(self, gc, rgbFace, path): - cmd = [] - - while 1: - code, xp, yp = path.vertex() - yp = self.height - yp - - if code == agg.path_cmd_stop: - cmd.append('z') # Hack, path_cmd_end_poly not found - break - elif code == agg.path_cmd_move_to: - cmd.append('M%g %g' % (xp, yp)) - elif code == agg.path_cmd_line_to: - cmd.append('L%g %g' % (xp, yp)) - elif code == agg.path_cmd_curve3: - verts = [xp, yp] - verts.extent(path.vertex()[1:]) - verts[-1] = self.height - verts[-1] - cmd.append('Q%g %g %g %g' % tuple(verts)) - elif code == agg.path_cmd_curve4: - verts = [xp, yp] - verts.extend(path.vertex()[1:]) - verts[-1] = self.height - verts[-1] - verts.extend(path.vertex()[1:]) - verts[-1] = self.height - verts[-1] - cmd.append('C%g %g %g %g %g %g'%tuple(verts)) - elif code == agg.path_cmd_end_poly: - cmd.append('z') - - path_data = "".join(cmd) + path_data = self._path_commands(path) self._draw_svg_element("path", 'd="%s"' % path_data, gc, rgbFace) def draw_arc(self, gc, rgbFace, x, y, width, height, angle1, angle2, rotation): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2008-05-29 13:54:10
|
Revision: 5299 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5299&view=rev Author: dsdale Date: 2008-05-29 06:54:04 -0700 (Thu, 29 May 2008) Log Message: ----------- fixed two bugs in texmanager: dvipng version comparison, and another related to the addition of the get_gray method Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/texmanager.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-05-29 13:01:40 UTC (rev 5298) +++ branches/v0_91_maint/CHANGELOG 2008-05-29 13:54:04 UTC (rev 5299) @@ -1,3 +1,8 @@ +2008-05-29 Fixed two bugs in texmanager.py: + improved comparison of dvipng versions + fixed a bug introduced when get_grey method was added + - DSD + 2008-05-29 Implement path clipping in SVG backend - MGD 2008-05-28 Fix crashing of PDFs in xpdf and ghostscript when two-byte Modified: branches/v0_91_maint/lib/matplotlib/texmanager.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/texmanager.py 2008-05-29 13:01:40 UTC (rev 5298) +++ branches/v0_91_maint/lib/matplotlib/texmanager.py 2008-05-29 13:54:04 UTC (rev 5299) @@ -34,6 +34,7 @@ """ import copy, glob, md5, os, shutil, sys, warnings +import distutils.version import numpy as npy import matplotlib as mpl from matplotlib import rcParams @@ -44,14 +45,15 @@ if sys.platform.startswith('win'): cmd_split = '&' else: cmd_split = ';' -def get_dvipng_version(): +def dvipng_hack_alpha(): stdin, stdout = os.popen4('dvipng -version') for line in stdout: if line.startswith('dvipng '): version = line.split()[-1] mpl.verbose.report('Found dvipng version %s'% version, 'helpful') - return version + version = distutils.version.LooseVersion(version) + return version < distutils.version.LooseVersion('1.6') raise RuntimeError('Could not obtain dvipng version') @@ -76,7 +78,7 @@ if not os.path.exists(texcache): os.mkdir(texcache) - dvipngVersion = get_dvipng_version() + _dvipng_hack_alpha = dvipng_hack_alpha() # mappable cache of rgba_arrayd = {} @@ -332,8 +334,28 @@ pngfile = self.make_png(tex, fontsize, dpi) X = readpng(os.path.join(self.texcache, pngfile)) - if (self.dvipngVersion < '1.6') or rcParams['text.dvipnghack']: - # hack the alpha channel as described in comment above + if self._dvipng_hack_alpha or rcParams['text.dvipnghack']: + # hack the alpha channel + # dvipng assumed a constant background, whereas we want to + # overlay these rasters with antialiasing over arbitrary + # backgrounds that may have other figure elements under them. + # When you set dvipng -bg Transparent, it actually makes the + # alpha channel 1 and does the background compositing and + # antialiasing itself and puts the blended data in the rgb + # channels. So what we do is extract the alpha information + # from the red channel, which is a blend of the default dvipng + # background (white) and foreground (black). So the amount of + # red (or green or blue for that matter since white and black + # blend to a grayscale) is the alpha intensity. Once we + # extract the correct alpha information, we assign it to the + # alpha channel properly and let the users pick their rgb. In + # this way, we can overlay tex strings on arbitrary + # backgrounds with antialiasing + # + # red = alpha*red_foreground + (1-alpha)*red_background + # + # Since the foreground is black (0) and the background is + # white (1) this reduces to red = 1-alpha or alpha = 1-red alpha = npy.sqrt(1-X[:,:,0]) else: alpha = X[:,:,-1] @@ -346,26 +368,6 @@ """ Return tex string as an rgba array """ - # dvipng assumes a constant background, whereas we want to - # overlay these rasters with antialiasing over arbitrary - # backgrounds that may have other figure elements under them. - # When you set dvipng -bg Transparent, it actually makes the - # alpha channel 1 and does the background compositing and - # antialiasing itself and puts the blended data in the rgb - # channels. So what we do is extract the alpha information - # from the red channel, which is a blend of the default dvipng - # background (white) and foreground (black). So the amount of - # red (or green or blue for that matter since white and black - # blend to a grayscale) is the alpha intensity. Once we - # extract the correct alpha information, we assign it to the - # alpha channel properly and let the users pick their rgb. In - # this way, we can overlay tex strings on arbitrary - # backgrounds with antialiasing - # - # red = alpha*red_foreground + (1-alpha)*red_background - # - # Since the foreground is black (0) and the background is - # white (1) this reduces to red = 1-alpha or alpha = 1-red if not fontsize: fontsize = rcParams['font.size'] if not dpi: dpi = rcParams['savefig.dpi'] r,g,b = rgb @@ -375,7 +377,7 @@ if Z is None: alpha = self.get_grey(tex, fontsize, dpi) - Z = npy.zeros((X.shape[0], X.shape[1], 4), npy.float) + Z = npy.zeros((alpha.shape[0], alpha.shape[1], 4), npy.float) Z[:,:,0] = r Z[:,:,1] = g Z[:,:,2] = b This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-05-29 18:25:45
|
Revision: 5304 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5304&view=rev Author: jdh2358 Date: 2008-05-29 11:25:15 -0700 (Thu, 29 May 2008) Log Message: ----------- added clippath support for ps Modified Paths: -------------- branches/v0_91_maint/examples/polar_demo.py branches/v0_91_maint/lib/matplotlib/backends/backend_ps.py branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py Modified: branches/v0_91_maint/examples/polar_demo.py =================================================================== --- branches/v0_91_maint/examples/polar_demo.py 2008-05-29 16:44:49 UTC (rev 5303) +++ branches/v0_91_maint/examples/polar_demo.py 2008-05-29 18:25:15 UTC (rev 5304) @@ -57,4 +57,6 @@ ax.set_rmax(2.0) ax.set_title("And there was much rejoicing!", fontsize=20) + +fig.savefig('polar_demo') show() Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_ps.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/backends/backend_ps.py 2008-05-29 16:44:49 UTC (rev 5303) +++ branches/v0_91_maint/lib/matplotlib/backends/backend_ps.py 2008-05-29 18:25:15 UTC (rev 5304) @@ -150,6 +150,8 @@ self.used_characters = {} self.mathtext_parser = MathTextParser("PS") + self._clip_paths = dict() + def track_characters(self, font, s): """Keeps track of which characters are required from each font.""" @@ -445,6 +447,49 @@ ps = '%1.4g %1.4g m %1.4g %1.4g l'%(x0, y0, x1, y1) self._draw_ps(ps, gc, None, "line") + def _get_clippath_command(self, clippath): + id = self._clip_paths.get(clippath) + if id is None: + id = 'c%x' % len(self._clip_paths) + ps_cmd = ['/%s {' % id] + ps_cmd.append(self._get_path(clippath)) + ps_cmd.extend(['clip', 'newpath', '} bind def\n']) + self._pswriter.write('\n'.join(ps_cmd)) + self._clip_paths[clippath] = id + + return '%s\n'%id + + def _get_path(self, path): + cmd = [] + while 1: + code, xp, yp = path.vertex() + + + if code == agg.path_cmd_stop: + cmd.append('closepath\n') + break + elif code == agg.path_cmd_move_to: + cmd.append('%g %g m' % (xp, yp)) + elif code == agg.path_cmd_line_to: + cmd.append('%g %g l' % (xp, yp)) + elif code == agg.path_cmd_curve3: + verts = [xp, yp] + verts.extend(path.vertex()[1:]) + cmd.append('%g %g %g %g %g %g c' % (verts[0], verts[1], + verts[0], verts[1], + verts[2], verts[3])) + elif code == agg.path_cmd_curve4: + verts = [xp, yp] + verts.extend(path.vertex()[1:]) + verts.extend(path.vertex()[1:]) + cmd.append('%g %g %g %g %g %g c'%tuple(verts)) + elif code == agg.path_cmd_end_poly: + cmd.append('cl\n') + + if len(cmd)==0: + return None + return '\n'.join(cmd) + def draw_markers(self, gc, path, rgbFace, x, y, transform): """ Draw the markers defined by path at each of the positions in x @@ -515,10 +560,17 @@ mask = npy.where(npy.isnan(x) + npy.isnan(y), 0, 1) cliprect = gc.get_clip_rectangle() + clippath = gc.get_clip_path() if cliprect: write('gsave\n') xc,yc,wc,hc=cliprect write('%g %g %g %g clipbox\n' % (wc,hc,xc,yc)) + if clippath: + write('gsave\n') + cmd = self._get_clippath_command(clippath) + write(cmd) + + write(' '.join(['/o {', ps_cmd, '} bind def\n'])) # Now evaluate the marker command at each marker location: while start < len(x): @@ -527,8 +579,11 @@ write('\n'.join(ps)+'\n') start = end end += step + if cliprect: write('grestore\n') + if clippath: write('grestore\n') + def draw_path(self, gc, rgbFace, path): ps_cmd = [] @@ -594,10 +649,17 @@ self.push_gc(gc, store=1) cliprect = gc.get_clip_rectangle() + clippath = gc.get_clip_path() + if cliprect: write('gsave\n') xc,yc,wc,hc=cliprect write('%g %g %g %g clipbox\n' % (wc,hc,xc,yc)) + if clippath: + write('gsave\n') + cmd = self._get_clippath_command(clippath) + write(cmd) + 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]]\ @@ -607,8 +669,8 @@ start = end end += step if cliprect: write('grestore\n') + if clippath: write('grestore\n') - def draw_lines_old(self, gc, x, y, transform=None): """ x and y are npy.equal length arrays, draw lines connecting each @@ -633,11 +695,18 @@ self.push_gc(gc, store=1) cliprect = gc.get_clip_rectangle() + clippath = gc.get_clip_path() + if cliprect: write('gsave\n') xc,yc,wc,hc=cliprect write('%g %g %g %g clipbox\n' % (wc,hc,xc,yc)) + if clippath: + write('gsave\n') + cmd = self._get_clippath_command(clippath) + write(cmd) + steps = 50 start = 0 end = steps @@ -672,7 +741,7 @@ end += steps if transform: if cliprect: write("grestore\n") - + if clippath: write('grestore\n') def draw_point(self, gc, x, y): """ Draw a single point at x,y @@ -930,6 +999,7 @@ write("% "+command+"\n") cliprect = gc.get_clip_rectangle() + clippath = gc.get_clip_path() self.set_color(*gc.get_rgb()) self.set_linewidth(gc.get_linewidth()) jint = gc.get_joinstyle() @@ -941,6 +1011,13 @@ if cliprect: x,y,w,h=cliprect write('gsave\n%1.4g %1.4g %1.4g %1.4g clipbox\n' % (w,h,x,y)) + + if clippath: + write('gsave\n') + cmd = self._get_clippath_command(clippath) + write(cmd) + + # Jochen, is the strip necessary? - this could be a honking big string write(ps.strip()) write("\n") @@ -962,6 +1039,9 @@ if cliprect: write("grestore\n") + if clippath: + write('grestore\n') + def push_gc(self, gc, store=1): """ Push the current onto stack, with the exception of the clip box, which Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py 2008-05-29 16:44:49 UTC (rev 5303) +++ branches/v0_91_maint/lib/matplotlib/backends/backend_svg.py 2008-05-29 18:25:15 UTC (rev 5304) @@ -71,7 +71,7 @@ cmd.append('L%g %g' % (xp, yp)) elif code == agg.path_cmd_curve3: verts = [xp, yp] - verts.extent(path.vertex()[1:]) + verts.extend(path.vertex()[1:]) verts[-1] = self.height - verts[-1] cmd.append('Q%g %g %g %g' % tuple(verts)) elif code == agg.path_cmd_curve4: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-05-29 20:17:41
|
Revision: 5306 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5306&view=rev Author: jdh2358 Date: 2008-05-29 13:17:32 -0700 (Thu, 29 May 2008) Log Message: ----------- imread via pil now returns lumininance or rgb if possible Modified Paths: -------------- branches/v0_91_maint/API_CHANGES branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/image.py Modified: branches/v0_91_maint/API_CHANGES =================================================================== --- branches/v0_91_maint/API_CHANGES 2008-05-29 18:25:58 UTC (rev 5305) +++ branches/v0_91_maint/API_CHANGES 2008-05-29 20:17:32 UTC (rev 5306) @@ -1,3 +1,8 @@ + matplotlib.image.imread now no longer always returns RGBA -- if + the image is luminance or RGB, it will return a MxN or MxNx3 array + if possible. Also uint8 is no longer always forced to float. + + 0.91.2 Released For csv2rec, checkrows=0 is the new default indicating all rows Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-05-29 18:25:58 UTC (rev 5305) +++ branches/v0_91_maint/CHANGELOG 2008-05-29 20:17:32 UTC (rev 5306) @@ -1,3 +1,8 @@ +2008-05-29 matplotlib.image.imread now no longer always returns RGBA + -- if the image is luminance or RGB, it will return a MxN + or MxNx3 array if possible. Also uint8 is no longer always + forced to float. + 2008-05-29 Implement path clipping in PS backend - JDH 2008-05-29 Fixed two bugs in texmanager.py: Modified: branches/v0_91_maint/lib/matplotlib/image.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/image.py 2008-05-29 18:25:58 UTC (rev 5305) +++ branches/v0_91_maint/lib/matplotlib/image.py 2008-05-29 20:17:32 UTC (rev 5306) @@ -607,11 +607,15 @@ """ return image file in fname as numpy array - Return value is a MxNx4 array of 0-1 normalized floats + return value is a numpy array. For grayscale images, the return + array is MxN. For RGB images, the return value is MxNx3. For + RGBA images the return value is MxNx4 matplotlib can only read PNGs natively, but if PIL is installed, - it will use it to load the image and return an RGBA if possible + it will use it to load the image and return an array (if possible) which can be used with imshow + + TODO: support RGB and grayscale return values in _image.readpng """ def pilread(): @@ -639,15 +643,39 @@ def pil_to_array( pilImage ): + """ + load a PIL image and return it as a numpy array of uint8. For + grayscale images, the return array is MxN. For RGB images, the + return value is MxNx3. For RGBA images the return value is MxNx4 + """ + def toarray(im): + 'return a 1D array of floats' + x_str = im.tostring('raw',im.mode,0,-1) + x = npy.fromstring(x_str,npy.uint8) + return x + if pilImage.mode in ('RGBA', 'RGBX'): - im = pilImage # no need to convert images in rgba format + im = pilImage # no need to convert images + elif pilImage.mode=='L': + im = pilImage # no need to luminance images + # return MxN luminance array + x = toarray(im) + x.shape = im.size[1], im.size[0] + return x + elif pilImage.mode=='RGB': + #return MxNx3 RGB array + im = pilImage # no need to RGB images + x = toarray(im) + x.shape = im.size[1], im.size[0], 3 + return x + else: # try to convert to an rgba image try: im = pilImage.convert('RGBA') except ValueError: raise RuntimeError('Unknown image mode') - x_str = im.tostring('raw',im.mode,0,-1) - x = npy.fromstring(x_str,npy.uint8) + # return MxNx4 RGBA array + x = toarray(im) x.shape = im.size[1], im.size[0], 4 return x This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2008-05-29 22:59:47
|
Revision: 5312 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5312&view=rev Author: cmoad Date: 2008-05-29 15:59:43 -0700 (Thu, 29 May 2008) Log Message: ----------- tagging new version Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/__init__.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-05-29 21:37:55 UTC (rev 5311) +++ branches/v0_91_maint/CHANGELOG 2008-05-29 22:59:43 UTC (rev 5312) @@ -1,3 +1,5 @@ +=============================================================== 2008-01-06 Released 0.91.3 at revision 5312 + 2008-05-29 matplotlib.image.imread now no longer always returns RGBA -- if the image is luminance or RGB, it will return a MxN or MxNx3 array if possible. Also uint8 is no longer always Modified: branches/v0_91_maint/lib/matplotlib/__init__.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/__init__.py 2008-05-29 21:37:55 UTC (rev 5311) +++ branches/v0_91_maint/lib/matplotlib/__init__.py 2008-05-29 22:59:43 UTC (rev 5312) @@ -55,7 +55,7 @@ """ from __future__ import generators -__version__ = '0.91.2svn' +__version__ = '0.91.3svn' __revision__ = '$Revision$' __date__ = '$Date$' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <cm...@us...> - 2008-05-30 03:07:41
|
Revision: 5313 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5313&view=rev Author: cmoad Date: 2008-05-29 20:07:39 -0700 (Thu, 29 May 2008) Log Message: ----------- minor rev bump Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/__init__.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-05-29 22:59:43 UTC (rev 5312) +++ branches/v0_91_maint/CHANGELOG 2008-05-30 03:07:39 UTC (rev 5313) @@ -1,4 +1,5 @@ -=============================================================== 2008-01-06 Released 0.91.3 at revision 5312 +=============================================================== +2008-05-29 Released 0.91.3 at revision 5313 2008-05-29 matplotlib.image.imread now no longer always returns RGBA -- if the image is luminance or RGB, it will return a MxN Modified: branches/v0_91_maint/lib/matplotlib/__init__.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/__init__.py 2008-05-29 22:59:43 UTC (rev 5312) +++ branches/v0_91_maint/lib/matplotlib/__init__.py 2008-05-30 03:07:39 UTC (rev 5313) @@ -55,7 +55,7 @@ """ from __future__ import generators -__version__ = '0.91.3svn' +__version__ = '0.91.3' __revision__ = '$Revision$' __date__ = '$Date$' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-05-30 19:22:12
|
Revision: 5329 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5329&view=rev Author: jdh2358 Date: 2008-05-30 12:21:56 -0700 (Fri, 30 May 2008) Log Message: ----------- added support for None for dvipng and removed the sqrt in the hack which I think is wrong Modified Paths: -------------- branches/v0_91_maint/lib/matplotlib/rcsetup.py branches/v0_91_maint/lib/matplotlib/texmanager.py branches/v0_91_maint/matplotlibrc.template Modified: branches/v0_91_maint/lib/matplotlib/rcsetup.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/rcsetup.py 2008-05-30 18:59:44 UTC (rev 5328) +++ branches/v0_91_maint/lib/matplotlib/rcsetup.py 2008-05-30 19:21:56 UTC (rev 5329) @@ -42,6 +42,16 @@ else: raise ValueError('Could not convert "%s" to boolean' % b) +def validate_bool_maybe_none(b): + 'Convert b to a boolean or raise' + if type(b) is str: + b = b.lower() + if b=='none': return None + if b in ('t', 'y', 'yes', 'on', 'true', '1', 1, True): return True + elif b in ('f', 'n', 'no', 'off', 'false', '0', 0, False): return False + else: + raise ValueError('Could not convert "%s" to boolean' % b) + def validate_float(s): 'convert s to float or raise' try: return float(s) @@ -339,7 +349,7 @@ 'text.usetex' : [False, validate_bool], 'text.latex.unicode' : [False, validate_bool], 'text.latex.preamble' : [[''], validate_stringlist], - 'text.dvipnghack' : [False, validate_bool], + 'text.dvipnghack' : [None, validate_bool_maybe_none], 'text.fontstyle' : ['normal', str], 'text.fontangle' : ['normal', str], 'text.fontvariant' : ['normal', str], Modified: branches/v0_91_maint/lib/matplotlib/texmanager.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/texmanager.py 2008-05-30 18:59:44 UTC (rev 5328) +++ branches/v0_91_maint/lib/matplotlib/texmanager.py 2008-05-30 19:21:56 UTC (rev 5329) @@ -334,7 +334,12 @@ pngfile = self.make_png(tex, fontsize, dpi) X = readpng(os.path.join(self.texcache, pngfile)) - if self._dvipng_hack_alpha or rcParams['text.dvipnghack']: + if rcParams['text.dvipnghack'] is not None: + hack = rcParams['text.dvipnghack'] + else: + hack = self._dvipng_hack_alpha + print 'using hack', hack + if hack: # hack the alpha channel # dvipng assumed a constant background, whereas we want to # overlay these rasters with antialiasing over arbitrary @@ -356,7 +361,9 @@ # # Since the foreground is black (0) and the background is # white (1) this reduces to red = 1-alpha or alpha = 1-red - alpha = npy.sqrt(1-X[:,:,0]) + #alpha = npy.sqrt(1-X[:,:,0]) # should this be sqrt here? + alpha = 1-X[:,:,0] + else: alpha = X[:,:,-1] Modified: branches/v0_91_maint/matplotlibrc.template =================================================================== --- branches/v0_91_maint/matplotlibrc.template 2008-05-30 18:59:44 UTC (rev 5328) +++ branches/v0_91_maint/matplotlibrc.template 2008-05-30 19:21:56 UTC (rev 5329) @@ -147,9 +147,14 @@ # beware of package collisions: color, geometry, graphicx, # type1cm, textcomp. Adobe Postscript (PSSNFS) font packages # may also be loaded, depending on your font settings -#text.dvipnghack : False # some versions of dvipng don't handle - # alpha channel properly. Use True to correct and flush - # ~/.matplotlib/tex.cache before testing + +#text.dvipnghack : None # some versions of dvipng don't handle alpha + # channel properly. Use True to correct + # and flush ~/.matplotlib/tex.cache + # before testing and False to force + # correction off. None will try and + # guess based on your dvipng version + #text.markup : 'plain' # Affects how text, such as titles and labels, are # interpreted by default. # 'plain': As plain, unformatted text This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-06-02 14:53:33
|
Revision: 5358 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5358&view=rev Author: mdboom Date: 2008-06-02 07:53:20 -0700 (Mon, 02 Jun 2008) Log Message: ----------- Fix crash in Agg drawing collections with no fill and/or edge color. Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/src/_backend_agg.cpp Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-06-02 14:17:14 UTC (rev 5357) +++ branches/v0_91_maint/CHANGELOG 2008-06-02 14:53:20 UTC (rev 5358) @@ -1,4 +1,6 @@ -=============================================================== +2008-06-02 Fix crash in Agg when drawing collections with no fill and/or + edge color - MGD + 2008-05-29 Released 0.91.3 at revision 5313 2008-05-29 matplotlib.image.imread now no longer always returns RGBA Modified: branches/v0_91_maint/src/_backend_agg.cpp =================================================================== --- branches/v0_91_maint/src/_backend_agg.cpp 2008-06-02 14:17:14 UTC (rev 5357) +++ branches/v0_91_maint/src/_backend_agg.cpp 2008-06-02 14:53:20 UTC (rev 5358) @@ -690,6 +690,9 @@ size_t N = Nsegments; size_t Ndash = 0; + if (Nsegments == 0) + throw Py::ValueError("segments must have non-zero length"); + Py::SeqBase<Py::Object> dashtup(linestyle); bool useDashes = dashtup[0].ptr() != Py_None; @@ -791,50 +794,54 @@ else path.line_to(thisx, height-thisy); } + if (Nc != 0 && Nlw != 0) { + double lw = points_to_pixels ( Py::Float( linewidths[i%Nlw] ) ); + if (! useDashes ) { - double lw = points_to_pixels ( Py::Float( linewidths[i%Nlw] ) ); + agg::conv_stroke<agg::path_storage> stroke(path); + //stroke.line_cap(cap); + //stroke.line_join(join); + stroke.width(lw); + theRasterizer->add_path(stroke); + } + else { - if (! useDashes ) { + dash_t dash(path); + //dash.dash_start(offset); + for (size_t idash=0; idash<Ndash/2; idash++) + dash.add_dash(dasha[2*idash], dasha[2*idash+1]); - agg::conv_stroke<agg::path_storage> stroke(path); - //stroke.line_cap(cap); - //stroke.line_join(join); - stroke.width(lw); - theRasterizer->add_path(stroke); - } - else { + agg::conv_stroke<dash_t> stroke(dash); + //stroke.line_cap(cap); + //stroke.line_join(join); + stroke.width(lw); + theRasterizer->add_path(stroke); + } - dash_t dash(path); - //dash.dash_start(offset); - for (size_t idash=0; idash<Ndash/2; idash++) - dash.add_dash(dasha[2*idash], dasha[2*idash+1]); + // get the color and render + Py::SeqBase<Py::Object> rgba(colors[ i%Nc]); + double r = Py::Float(rgba[0]); + double g = Py::Float(rgba[1]); + double b = Py::Float(rgba[2]); + double a = Py::Float(rgba[3]); + agg::rgba color(r, g, b, a); - agg::conv_stroke<dash_t> stroke(dash); - //stroke.line_cap(cap); - //stroke.line_join(join); - stroke.width(lw); - theRasterizer->add_path(stroke); + // render antialiased or not + int isaa; + if (Naa != 0) + isaa = Py::Int(antialiaseds[i%Naa]); + else + isaa = true; + if ( isaa ) { + rendererAA->color(color); + agg::render_scanlines(*theRasterizer, *slineP8, *rendererAA); + } + else { + rendererBin->color(color); + agg::render_scanlines(*theRasterizer, *slineBin, *rendererBin); + } } - - // get the color and render - Py::SeqBase<Py::Object> rgba(colors[ i%Nc]); - double r = Py::Float(rgba[0]); - double g = Py::Float(rgba[1]); - double b = Py::Float(rgba[2]); - double a = Py::Float(rgba[3]); - agg::rgba color(r, g, b, a); - - // render antialiased or not - int isaa = Py::Int(antialiaseds[i%Naa]); - if ( isaa ) { - rendererAA->color(color); - agg::render_scanlines(*theRasterizer, *slineP8, *rendererAA); - } - else { - rendererBin->color(color); - agg::render_scanlines(*theRasterizer, *slineBin, *rendererBin); - } } //for every segment if (useDashes) delete [] dasha; return Py::Object(); @@ -1219,6 +1226,9 @@ size_t N = (Noffsets>Nverts) ? Noffsets : Nverts; + if (Nverts == 0) + throw Py::ValueError("Must have at least one set of vertices"); + std::pair<double, double> xyo, xy; Py::SeqBase<Py::Object> thisverts; size_t i, j; @@ -1302,55 +1312,64 @@ } path.close_polygon(); - int isaa = Py::Int(antialiaseds[i%Naa]); + int isaa; + if (Naa != 0) + isaa = Py::Int(antialiaseds[i%Naa]); + else + isaa = true; + // get the facecolor and render - Py::SeqBase<Py::Object> rgba = Py::SeqBase<Py::Object>(facecolors[ i%Nface]); - double r = Py::Float(rgba[0]); - double g = Py::Float(rgba[1]); - double b = Py::Float(rgba[2]); - double a = Py::Float(rgba[3]); - if (a>0) { //only render if alpha>0 - agg::rgba facecolor(r, g, b, a); + if (Nface != 0) { + Py::SeqBase<Py::Object> rgba = Py::SeqBase<Py::Object>(facecolors[ i%Nface]); + double r = Py::Float(rgba[0]); + double g = Py::Float(rgba[1]); + double b = Py::Float(rgba[2]); + double a = Py::Float(rgba[3]); + if (a>0) { //only render if alpha>0 + agg::rgba facecolor(r, g, b, a); - theRasterizer->add_path(path); + theRasterizer->add_path(path); - if (isaa) { - rendererAA->color(facecolor); - agg::render_scanlines(*theRasterizer, *slineP8, *rendererAA); - } - else { - rendererBin->color(facecolor); - agg::render_scanlines(*theRasterizer, *slineBin, *rendererBin); - } - } //renderer face + if (isaa) { + rendererAA->color(facecolor); + agg::render_scanlines(*theRasterizer, *slineP8, *rendererAA); + } + else { + rendererBin->color(facecolor); + agg::render_scanlines(*theRasterizer, *slineBin, *rendererBin); + } + } //renderer face + } + if (Nedge != 0 && Nlw != 0) { // get the edgecolor and render - rgba = Py::SeqBase<Py::Object>(edgecolors[ i%Nedge]); - r = Py::Float(rgba[0]); - g = Py::Float(rgba[1]); - b = Py::Float(rgba[2]); - a = Py::Float(rgba[3]); + Py::SeqBase<Py::Object> rgba = Py::SeqBase<Py::Object>(edgecolors[ i%Nedge]); + double r = Py::Float(rgba[0]); + double g = Py::Float(rgba[1]); + double b = Py::Float(rgba[2]); + double a = Py::Float(rgba[3]); - double lw = points_to_pixels ( Py::Float( linewidths[i%Nlw] ) ); - if ((a>0) && lw) { //only render if alpha>0 and linewidth !=0 - agg::rgba edgecolor(r, g, b, a); + double lw = points_to_pixels ( Py::Float( linewidths[i%Nlw] ) ); + if ((a>0) && lw) { //only render if alpha>0 and linewidth !=0 + agg::rgba edgecolor(r, g, b, a); - agg::conv_stroke<agg::path_storage> stroke(path); - //stroke.line_cap(cap); - //stroke.line_join(join); - stroke.width(lw); - theRasterizer->add_path(stroke); + agg::conv_stroke<agg::path_storage> stroke(path); + //stroke.line_cap(cap); + //stroke.line_join(join); + stroke.width(lw); + theRasterizer->add_path(stroke); - // render antialiased or not - if ( isaa ) { - rendererAA->color(edgecolor); - agg::render_scanlines(*theRasterizer, *slineP8, *rendererAA); - } - else { - rendererBin->color(edgecolor); - agg::render_scanlines(*theRasterizer, *slineBin, *rendererBin); - } - } //rendered edge + // render antialiased or not + if ( isaa ) { + rendererAA->color(edgecolor); + agg::render_scanlines(*theRasterizer, *slineP8, *rendererAA); + } + else { + rendererBin->color(edgecolor); + agg::render_scanlines(*theRasterizer, *slineBin, *rendererBin); + } + } //rendered edge + } delete [] xs; delete [] ys; @@ -1429,10 +1448,14 @@ } + double scale; + if (Nsizes != 0) { + scale = Py::Float(sizes[i%Nsizes]); + } else { + scale = 1.0; + } - double scale = Py::Float(sizes[i%Nsizes]); - agg::path_storage path; for (j=0; j<Nverts; j++) { @@ -1445,54 +1468,63 @@ } path.close_polygon(); - int isaa = Py::Int(antialiaseds[i%Naa]); - // get the facecolor and render - Py::SeqBase<Py::Object> rgba = Py::SeqBase<Py::Object>(facecolors[ i%Nface]); - double r = Py::Float(rgba[0]); - double g = Py::Float(rgba[1]); - double b = Py::Float(rgba[2]); - double a = Py::Float(rgba[3]); - if (a>0) { //only render if alpha>0 - agg::rgba facecolor(r, g, b, a); + int isaa; + if (Naa != 0) + isaa = Py::Int(antialiaseds[i%Naa]); + else + isaa = true; - theRasterizer->add_path(path); + if (Nface != 0) { + // get the facecolor and render + Py::SeqBase<Py::Object> rgba = Py::SeqBase<Py::Object>(facecolors[ i%Nface]); + double r = Py::Float(rgba[0]); + double g = Py::Float(rgba[1]); + double b = Py::Float(rgba[2]); + double a = Py::Float(rgba[3]); + if (a>0) { //only render if alpha>0 + agg::rgba facecolor(r, g, b, a); - if (isaa) { - rendererAA->color(facecolor); - agg::render_scanlines(*theRasterizer, *slineP8, *rendererAA); - } - else { - rendererBin->color(facecolor); - agg::render_scanlines(*theRasterizer, *slineBin, *rendererBin); - } - } //renderer face + theRasterizer->add_path(path); + if (isaa) { + rendererAA->color(facecolor); + agg::render_scanlines(*theRasterizer, *slineP8, *rendererAA); + } + else { + rendererBin->color(facecolor); + agg::render_scanlines(*theRasterizer, *slineBin, *rendererBin); + } + } //renderer face + } + + if (Nedge != 0 && Nlw != 0) { // get the edgecolor and render - rgba = Py::SeqBase<Py::Object>(edgecolors[ i%Nedge]); - r = Py::Float(rgba[0]); - g = Py::Float(rgba[1]); - b = Py::Float(rgba[2]); - a = Py::Float(rgba[3]); - double lw = points_to_pixels ( Py::Float( linewidths[i%Nlw] ) ); - if ((a>0) && lw) { //only render if alpha>0 - agg::rgba edgecolor(r, g, b, a); + Py::SeqBase<Py::Object> rgba = Py::SeqBase<Py::Object>(edgecolors[ i%Nedge]); + double r = Py::Float(rgba[0]); + double g = Py::Float(rgba[1]); + double b = Py::Float(rgba[2]); + double a = Py::Float(rgba[3]); + double lw = points_to_pixels ( Py::Float( linewidths[i%Nlw] ) ); + if ((a>0) && lw) { //only render if alpha>0 + agg::rgba edgecolor(r, g, b, a); - agg::conv_stroke<agg::path_storage> stroke(path); - //stroke.line_cap(cap); - //stroke.line_join(join); - stroke.width(lw); - theRasterizer->add_path(stroke); + agg::conv_stroke<agg::path_storage> stroke(path); + //stroke.line_cap(cap); + //stroke.line_join(join); + stroke.width(lw); + theRasterizer->add_path(stroke); - // render antialiased or not - if ( isaa ) { - rendererAA->color(edgecolor); - agg::render_scanlines(*theRasterizer, *slineP8, *rendererAA); - } - else { - rendererBin->color(edgecolor); - agg::render_scanlines(*theRasterizer, *slineBin, *rendererBin); - } - } //rendered edge + // render antialiased or not + if ( isaa ) { + rendererAA->color(edgecolor); + agg::render_scanlines(*theRasterizer, *slineP8, *rendererAA); + } + else { + rendererBin->color(edgecolor); + agg::render_scanlines(*theRasterizer, *slineBin, *rendererBin); + } + } //rendered edge + } } // for every poly delete [] xverts; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-06-04 17:49:21
|
Revision: 5383 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5383&view=rev Author: jdh2358 Date: 2008-06-04 10:49:17 -0700 (Wed, 04 Jun 2008) Log Message: ----------- try to handle xaxis_date more gracefully when no data has been added Modified Paths: -------------- branches/v0_91_maint/lib/matplotlib/axes.py branches/v0_91_maint/src/_transforms.cpp branches/v0_91_maint/src/_transforms.h Modified: branches/v0_91_maint/lib/matplotlib/axes.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/axes.py 2008-06-04 16:53:48 UTC (rev 5382) +++ branches/v0_91_maint/lib/matplotlib/axes.py 2008-06-04 17:49:17 UTC (rev 5383) @@ -1,5 +1,5 @@ from __future__ import division, generators -import math, sys, warnings +import math, sys, warnings, datetime import numpy as npy @@ -1858,10 +1858,25 @@ tz is the time zone to use in labeling dates. Defaults to rc value. """ + if self.dataLim.is_ignore(): + # no data has been added - let's set the default datalim. + # We should probably use a better proxy for the datalim + # have been updated than the ignore setting + dmax = today = datetime.date.today() + dmin = today-datetime.timedelta(days=10) + self._process_unit_info(xdata=(dmin, dmax)) + + dmin, dmax = self.convert_xunits([dmin, dmax]) + + self.viewLim.intervalx().set_bounds(dmin, dmax) + self.viewLim.intervalx().set_bounds(dmin, dmax) + + locator = self.xaxis.get_major_locator() if not isinstance(locator, mdates.DateLocator): locator = mdates.AutoDateLocator(tz) self.xaxis.set_major_locator(locator) + locator.refresh() formatter = self.xaxis.get_major_formatter() if not isinstance(formatter, mdates.DateFormatter): @@ -1873,11 +1888,24 @@ tz is the time zone to use in labeling dates. Defaults to rc value. """ + if self.dataLim.is_ignore(): + # no data has been added - let's set the default datalim. + # We should probably use a better proxy for the datalim + # have been updated than the ignore setting + dmax = today = datetime.date.today() + dmin = today-datetime.timedelta(days=10) + self._process_unit_info(xdata=(dmin, dmax)) + dmin, dmax = self.convert_xunits([dmin, dmax]) + self.viewLim.intervaly().set_bounds(dmin, dmax) + self.viewLim.intervaly().set_bounds(dmin, dmax) + + locator = self.yaxis.get_major_locator() if not isinstance(locator, mdates.DateLocator): locator = mdates.AutoDateLocator(tz) self.yaxis.set_major_locator(locator) + locator.refresh() formatter = self.xaxis.get_major_formatter() if not isinstance(formatter, mdates.DateFormatter): Modified: branches/v0_91_maint/src/_transforms.cpp =================================================================== --- branches/v0_91_maint/src/_transforms.cpp 2008-06-04 16:53:48 UTC (rev 5382) +++ branches/v0_91_maint/src/_transforms.cpp 2008-06-04 17:49:17 UTC (rev 5383) @@ -348,6 +348,13 @@ } Py::Object +Bbox::is_ignore(const Py::Tuple &args) { + _VERBOSE("Bbox::ignore"); + args.verify_length(0); + return Py::Int(_ignore); +} + +Py::Object Bbox::overlapsx(const Py::Tuple &args, const Py::Dict &kwargs) { _VERBOSE("Bbox::overlapsx"); args.verify_length(1); @@ -2349,6 +2356,7 @@ add_varargs_method("ymin", &Bbox::ymin, "ymin()\n"); add_varargs_method("ignore", &Bbox::ignore, "ignore(int)"); + add_varargs_method("is_ignore", &Bbox::is_ignore, "is_ignore()"); add_varargs_method("scale", &Bbox::scale, "scale(sx,sy)"); add_varargs_method("deepcopy", &Bbox::deepcopy, "deepcopy()\n"); } Modified: branches/v0_91_maint/src/_transforms.h =================================================================== --- branches/v0_91_maint/src/_transforms.h 2008-06-04 16:53:48 UTC (rev 5382) +++ branches/v0_91_maint/src/_transforms.h 2008-06-04 17:49:17 UTC (rev 5383) @@ -357,8 +357,11 @@ //set the ignore attr Py::Object ignore(const Py::Tuple &args); + //return the ignore setting + Py::Object is_ignore(const Py::Tuple &args); + Point* ll_api() {return _ll;} Point* ur_api() {return _ur;} private: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2008-06-09 20:07:22
|
Revision: 5442 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5442&view=rev Author: dsdale Date: 2008-06-09 13:07:15 -0700 (Mon, 09 Jun 2008) Log Message: ----------- don't install traits Modified Paths: -------------- branches/v0_91_maint/setup.cfg.template branches/v0_91_maint/setupext.py Modified: branches/v0_91_maint/setup.cfg.template =================================================================== --- branches/v0_91_maint/setup.cfg.template 2008-06-09 19:58:46 UTC (rev 5441) +++ branches/v0_91_maint/setup.cfg.template 2008-06-09 20:07:15 UTC (rev 5442) @@ -25,7 +25,8 @@ #pytz = False #dateutil = False # -## Experimental config package support: +## Experimental config package support, this should only be enabled by +## matplotlib developers, for matplotlib development #enthought.traits = False #configobj = False Modified: branches/v0_91_maint/setupext.py =================================================================== --- branches/v0_91_maint/setupext.py 2008-06-09 19:58:46 UTC (rev 5441) +++ branches/v0_91_maint/setupext.py 2008-06-09 20:07:15 UTC (rev 5442) @@ -105,7 +105,7 @@ 'provide_pytz': 'auto', 'provide_dateutil': 'auto', 'provide_configobj': 'auto', - 'provide_traits': 'auto', + 'provide_traits': False, 'build_agg': True, 'build_gtk': 'auto', 'build_gtkagg': 'auto', @@ -140,7 +140,7 @@ try: options['provide_traits'] = config.getboolean("provide_packages", "enthought.traits") - except: options['provide_traits'] = 'auto' + except: options['provide_traits'] = False try: options['build_gtk'] = config.getboolean("gui_support", "gtk") except: options['build_gtk'] = 'auto' @@ -461,9 +461,11 @@ return False def check_provide_traits(): - if options['provide_traits'] is True: - print_status("enthought.traits", "matplotlib will provide") - return True + # Let's not install traits by default for now, unless it is specifically + # asked for in setup.cfg AND it is not already installed +# if options['provide_traits'] is True: +# print_status("enthought.traits", "matplotlib will provide") +# return True try: from enthought import traits try: @@ -477,12 +479,16 @@ version = version.version except AttributeError: version = version.__version__ - if version.endswith('mpl'): - print_status("enthought.traits", "matplotlib will provide") - return True - else: - print_status("enthought.traits", version) - return False + # next 2 lines added temporarily while we figure out what to do + # with traits: + print_status("enthought.traits", version) + return False +# if version.endswith('mpl'): +# print_status("enthought.traits", "matplotlib will provide") +# return True +# else: +# print_status("enthought.traits", version) +# return False except ImportError: if options['provide_traits']: print_status("enthought.traits", "matplotlib will provide") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-06-26 12:28:51
|
Revision: 5675 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5675&view=rev Author: mdboom Date: 2008-06-26 05:28:48 -0700 (Thu, 26 Jun 2008) Log Message: ----------- Fix direction of horizontal and vertical hatching. Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/backends/backend_ps.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-06-25 22:03:15 UTC (rev 5674) +++ branches/v0_91_maint/CHANGELOG 2008-06-26 12:28:48 UTC (rev 5675) @@ -1,3 +1,5 @@ +2008-06-26 Fix direction of horizontal/vertical hatches - MGD + =============================================================== 2008-06-22 Released 0.91.4 at revision 5638 Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_ps.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/backends/backend_ps.py 2008-06-25 22:03:15 UTC (rev 5674) +++ branches/v0_91_maint/lib/matplotlib/backends/backend_ps.py 2008-06-26 12:28:48 UTC (rev 5675) @@ -254,12 +254,12 @@ hatchr cvi hatchgap idiv hatchgap mul {hatcht moveto 0 hatchb hatcht sub rlineto} for - stroke + strokeCHAN grestore """ % (angle, 12/density) self._pswriter.write("gsave\n") - self._pswriter.write(do_hatch(0, hatches['horiz'])) - self._pswriter.write(do_hatch(90, hatches['vert'])) + self._pswriter.write(do_hatch(90, hatches['horiz'])) + self._pswriter.write(do_hatch(0, hatches['vert'])) self._pswriter.write(do_hatch(45, hatches['diag1'])) self._pswriter.write(do_hatch(-45, hatches['diag2'])) self._pswriter.write("grestore\n") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-06-27 12:49:37
|
Revision: 5684 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5684&view=rev Author: mdboom Date: 2008-06-27 05:49:34 -0700 (Fri, 27 Jun 2008) Log Message: ----------- Fix mathtext parsing bug. Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/mathtext.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-06-26 20:15:45 UTC (rev 5683) +++ branches/v0_91_maint/CHANGELOG 2008-06-27 12:49:34 UTC (rev 5684) @@ -1,3 +1,5 @@ +2008-06-26 Fix mathtext bug for expressions like $x_{\leftarrow}$ - MGD + 2008-06-26 Fix direction of horizontal/vertical hatches - MGD =============================================================== Modified: branches/v0_91_maint/lib/matplotlib/mathtext.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/mathtext.py 2008-06-26 20:15:45 UTC (rev 5683) +++ branches/v0_91_maint/lib/matplotlib/mathtext.py 2008-06-27 12:49:34 UTC (rev 5684) @@ -2087,7 +2087,7 @@ start_group + ZeroOrMore( autoDelim - | simple) + ^ simple) + end_group ).setParseAction(self.group).setName("group") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ds...@us...> - 2008-06-30 13:24:26
|
Revision: 5700 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5700&view=rev Author: dsdale Date: 2008-06-30 06:24:13 -0700 (Mon, 30 Jun 2008) Log Message: ----------- removed Qt4's NavigationToolbar2.destroy method Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/backends/backend_qt4.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-06-30 13:21:19 UTC (rev 5699) +++ branches/v0_91_maint/CHANGELOG 2008-06-30 13:24:13 UTC (rev 5700) @@ -1,3 +1,7 @@ +2008-06-30 Removed Qt4 NavigationToolbar2.destroy -- it appears to + have been unnecessary and caused a bug reported by P. + Raybaut - DSD + 2008-06-26 Fix mathtext bug for expressions like $x_{\leftarrow}$ - MGD 2008-06-26 Fix direction of horizontal/vertical hatches - MGD Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_qt4.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/backends/backend_qt4.py 2008-06-30 13:21:19 UTC (rev 5699) +++ branches/v0_91_maint/lib/matplotlib/backends/backend_qt4.py 2008-06-30 13:24:13 UTC (rev 5700) @@ -340,13 +340,6 @@ # reference holder for subplots_adjust window self.adj_window = None - def destroy( self ): - for text, tooltip_text, image_file, callback in self.toolitems: - if text is not None: - QtCore.QObject.disconnect( self.buttons[ text ], - QtCore.SIGNAL( 'clicked()' ), - getattr( self, callback ) ) - def dynamic_update( self ): self.canvas.draw() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-07-08 14:52:03
|
Revision: 5720 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5720&view=rev Author: mdboom Date: 2008-07-08 07:50:20 -0700 (Tue, 08 Jul 2008) Log Message: ----------- Improve mathtext superscript placement. Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/mathtext.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-07-08 12:05:54 UTC (rev 5719) +++ branches/v0_91_maint/CHANGELOG 2008-07-08 14:50:20 UTC (rev 5720) @@ -1,3 +1,5 @@ +2008-07-08 Improve mathtext superscript placement - MGD + 2008-06-30 Removed Qt4 NavigationToolbar2.destroy -- it appears to have been unnecessary and caused a bug reported by P. Raybaut - DSD Modified: branches/v0_91_maint/lib/matplotlib/mathtext.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/mathtext.py 2008-07-08 12:05:54 UTC (rev 5719) +++ branches/v0_91_maint/lib/matplotlib/mathtext.py 2008-07-08 14:50:20 UTC (rev 5720) @@ -1167,7 +1167,7 @@ # Percentage of x-height that sub/superscripts drop below the baseline SUBDROP = 0.3 # Percentage of x-height that superscripts drop below the baseline -SUP1 = 0.7 +SUP1 = 0.5 # Percentage of x-height that subscripts drop below the baseline SUB1 = 0.0 # Percentage of x-height that superscripts are offset relative to the subscript This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-07-09 13:33:22
|
Revision: 5723 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5723&view=rev Author: mdboom Date: 2008-07-09 06:33:13 -0700 (Wed, 09 Jul 2008) Log Message: ----------- Improve mathtext radical rendering Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/mathtext.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008-07-09 12:04:06 UTC (rev 5722) +++ branches/v0_91_maint/CHANGELOG 2008-07-09 13:33:13 UTC (rev 5723) @@ -1,3 +1,5 @@ +2008-07-09 Improve mathtext radical rendering - MGD + 2008-07-08 Improve mathtext superscript placement - MGD 2008-06-30 Removed Qt4 NavigationToolbar2.destroy -- it appears to Modified: branches/v0_91_maint/lib/matplotlib/mathtext.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/mathtext.py 2008-07-09 12:04:06 UTC (rev 5722) +++ branches/v0_91_maint/lib/matplotlib/mathtext.py 2008-07-09 13:33:13 UTC (rev 5723) @@ -190,7 +190,7 @@ from matplotlib.afm import AFM from matplotlib.cbook import enumerate, iterable, Bunch, get_realpath_and_stat, \ - is_string_like + is_string_like, maxdict from matplotlib.ft2font import FT2Font, FT2Image, KERNING_DEFAULT, LOAD_FORCE_AUTOHINT, LOAD_NO_HINTING from matplotlib.font_manager import findfont, FontProperties from matplotlib._mathtext_data import latex_to_bakoma, \ @@ -318,7 +318,13 @@ self.image, ox, oy - info.metrics.ymax, info.glyph) def render_rect_filled(self, x1, y1, x2, y2): - self.image.draw_rect_filled(x1, y1, x2, max(y2 - 1, y1)) + height = max(int(y2 - y1) - 1, 0) + if height == 0: + center = (y2 + y1) / 2.0 + y = int(center - (height + 1) / 2.0) + else: + y = int(y1) + self.image.draw_rect_filled(int(x1), y, ceil(x2), y + height) def get_results(self, box): return (self.ox, @@ -477,8 +483,8 @@ to be destroyed.""" self.used_characters = None - def get_kern(self, font1, sym1, fontsize1, - font2, sym2, fontsize2, dpi): + def get_kern(self, font1, fontclass1, sym1, fontsize1, + font2, fontclass2, sym2, fontsize2, dpi): """ Get the kerning distance for font between sym1 and sym2. @@ -666,7 +672,8 @@ info2 = self._get_info(font2, fontclass2, sym2, fontsize2, dpi) font = info1.font return font.get_kerning(info1.num, info2.num, KERNING_DEFAULT) / 64.0 - return 0.0 + return Fonts.get_kern(self, font1, fontclass1, sym1, fontsize1, + font2, fontclass2, sym2, fontsize2, dpi) class BakomaFonts(TruetypeFonts): """ @@ -1121,7 +1128,8 @@ font = info1.font return (font.get_kern_dist(info1.glyph, info2.glyph) * 0.001 * fontsize1) - return 0.0 + return Fonts.get_kern(self, font1, fontclass1, sym1, fontsize1, + font2, fontclass2, sym2, fontsize2, dpi) def get_xheight(self, font, fontsize, dpi): cached_font = self._get_font(font) @@ -1431,6 +1439,19 @@ new_children.append(kern) self.children = new_children + # This is a failed experiment to fake cross-font kerning. +# def get_kerning(self, next): +# if len(self.children) >= 2 and isinstance(self.children[-2], Char): +# if isinstance(next, Char): +# print "CASE A" +# return self.children[-2].get_kerning(next) +# elif isinstance(next, Hlist) and len(next.children) and isinstance(next.children[0], Char): +# print "CASE B" +# result = self.children[-2].get_kerning(next.children[0]) +# print result +# return result +# return 0.0 + def hpack(self, w=0., m='additional'): """The main duty of hpack is to compute the dimensions of the resulting boxes, and to adjust the glue if one of those dimensions is @@ -1442,8 +1463,8 @@ w: specifies a width m: is either 'exactly' or 'additional'. - Thus, hpack(w, exactly) produces a box whose width is exactly w, while - hpack (w, additional ) yields a box whose width is the natural width + Thus, hpack(w, 'exactly') produces a box whose width is exactly w, while + hpack (w, 'additional') yields a box whose width is the natural width plus w. The default values produce a box with the natural width. node644, node649""" # I don't know why these get reset in TeX. Shift_amount is pretty @@ -1506,8 +1527,8 @@ m: is either 'exactly' or 'additional'. l: a maximum height - Thus, vpack(h, exactly) produces a box whose width is exactly w, while - vpack(w, additional) yields a box whose width is the natural width + Thus, vpack(h, 'exactly') produces a box whose width is exactly w, while + vpack(w, 'additional') yields a box whose width is the natural width plus w. The default values produce a box with the natural width. node644, node668""" # I don't know why these get reset in TeX. Shift_amount is pretty @@ -2603,13 +2624,6 @@ thickness = state.font_output.get_underline_thickness( state.font, state.fontsize, state.dpi) - if root is None: - root = Box(0., 0., 0.) - else: - root = Hlist([Char(x, state) for x in root]) - root.shrink() - root.shrink() - # Determine the height of the body, and add a little extra to # the height so it doesn't seem cramped height = body.height - body.shift_amount + thickness * 5.0 @@ -2626,10 +2640,18 @@ Fill(), padded_body]) # Stretch the glue between the hrule and the body - rightside.vpack(height + 1.0, depth, 'exactly') + rightside.vpack(height + (state.fontsize * state.dpi) / (100.0 * 12.0), + depth, 'exactly') # Add the root and shift it upward so it is above the tick. # The value of 0.6 is a hard-coded hack ;) + if root is None: + root = Box(check.width * 0.5, 0., 0.) + else: + root = Hlist([Char(x, state) for x in root]) + root.shrink() + root.shrink() + root_vlist = Vlist([Hlist([root])]) root_vlist.shift_amount = -height * 0.6 @@ -2673,12 +2695,12 @@ _parser = None _backend_mapping = { - 'Bitmap': MathtextBackendBitmap, - 'Agg' : MathtextBackendAgg, - 'PS' : MathtextBackendPs, - 'Pdf' : MathtextBackendPdf, - 'SVG' : MathtextBackendSvg, - 'Cairo' : MathtextBackendCairo + 'bitmap': MathtextBackendBitmap, + 'agg' : MathtextBackendAgg, + 'ps' : MathtextBackendPs, + 'pdf' : MathtextBackendPdf, + 'svg' : MathtextBackendSvg, + 'cairo' : MathtextBackendCairo } _font_type_mapping = { @@ -2689,8 +2711,8 @@ } def __init__(self, output): - self._output = output - self._cache = {} + self._output = output.lower() + self._cache = maxdict(50) def parse(self, s, dpi = 72, prop = None): if prop is None: @@ -2706,7 +2728,7 @@ else: backend = self._backend_mapping[self._output]() fontset = rcParams['mathtext.fontset'] - fontset_class = self._font_type_mapping.get(fontset) + fontset_class = self._font_type_mapping.get(fontset.lower()) if fontset_class is not None: font_output = fontset_class(prop, backend) else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |