You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
1
(3) |
2
|
3
|
4
(1) |
5
|
6
(1) |
7
(2) |
8
(22) |
9
(8) |
10
(24) |
11
(3) |
12
(4) |
13
|
14
(3) |
15
(3) |
16
(1) |
17
(2) |
18
(6) |
19
|
20
|
21
(3) |
22
(2) |
23
(8) |
24
(1) |
25
|
26
(6) |
27
(1) |
28
(3) |
29
(4) |
30
|
31
(9) |
|
|
Revision: 4892 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4892&view=rev Author: mdboom Date: 2008年01月23日 12:33:27 -0800 (2008年1月23日) Log Message: ----------- Fix exception with maskedarray branch of numpy (Thanks, David Huard) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/path.py Modified: trunk/matplotlib/lib/matplotlib/path.py =================================================================== --- trunk/matplotlib/lib/matplotlib/path.py 2008年01月23日 19:12:41 UTC (rev 4891) +++ trunk/matplotlib/lib/matplotlib/path.py 2008年01月23日 20:33:27 UTC (rev 4892) @@ -117,7 +117,7 @@ codes = self.LINETO * npy.ones( len(vertices), self.code_type) codes[0] = self.MOVETO - vertices = ma.compress(npy.invert(mask1d), vertices, 0) + vertices = npy.compress(npy.invert(mask1d), vertices, 0) vertices = npy.asarray(vertices) codes = npy.where(npy.concatenate((mask1d[-1:], mask1d[:-1])), self.MOVETO, codes) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4891 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4891&view=rev Author: mdboom Date: 2008年01月23日 11:12:41 -0800 (2008年1月23日) Log Message: ----------- Fix warnings on gcc 4.2.1 Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp trunk/matplotlib/src/_image.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008年01月23日 18:27:05 UTC (rev 4890) +++ trunk/matplotlib/src/_backend_agg.cpp 2008年01月23日 19:12:41 UTC (rev 4891) @@ -1300,7 +1300,7 @@ PyObject* write_method = PyObject_GetAttrString(py_file_obj, "write"); PyObject* result = NULL; if (write_method) - result = PyObject_CallFunction(write_method, "s#", data, length); + result = PyObject_CallFunction(write_method, (char *)"s#", data, length); Py_XDECREF(write_method); Py_XDECREF(result); } @@ -1310,7 +1310,7 @@ PyObject* flush_method = PyObject_GetAttrString(py_file_obj, "flush"); PyObject* result = NULL; if (flush_method) - result = PyObject_CallFunction(flush_method, ""); + result = PyObject_CallFunction(flush_method, (char *)""); Py_XDECREF(flush_method); Py_XDECREF(result); } Modified: trunk/matplotlib/src/_image.cpp =================================================================== --- trunk/matplotlib/src/_image.cpp 2008年01月23日 18:27:05 UTC (rev 4890) +++ trunk/matplotlib/src/_image.cpp 2008年01月23日 19:12:41 UTC (rev 4891) @@ -580,7 +580,7 @@ PyObject* write_method = PyObject_GetAttrString(py_file_obj, "write"); PyObject* result = NULL; if (write_method) - result = PyObject_CallFunction(write_method, "s#", data, length); + result = PyObject_CallFunction(write_method, (char *)"s#", data, length); Py_XDECREF(write_method); Py_XDECREF(result); } @@ -590,7 +590,7 @@ PyObject* flush_method = PyObject_GetAttrString(py_file_obj, "flush"); PyObject* result = NULL; if (flush_method) - result = PyObject_CallFunction(flush_method, ""); + result = PyObject_CallFunction(flush_method, (char *)""); Py_XDECREF(flush_method); Py_XDECREF(result); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4890 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4890&view=rev Author: mdboom Date: 2008年01月23日 10:27:05 -0800 (2008年1月23日) Log Message: ----------- Fix relim again (thanks Darren Dale) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年01月23日 18:13:40 UTC (rev 4889) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年01月23日 18:27:05 UTC (rev 4890) @@ -1200,12 +1200,11 @@ def relim(self): 'recompute the datalimits based on current artists' self.dataLim.ignore(True) + self.ignore_existing_data_limits = True for line in self.lines: - self.ignore_existing_data_limits = True self._update_line_limits(line) for p in self.patches: - self.ignore_existing_data_limits = True self._update_patch_limits(p) def update_datalim(self, xys): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4889 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4889&view=rev Author: mdboom Date: 2008年01月23日 10:13:40 -0800 (2008年1月23日) Log Message: ----------- Remove an accidental printf. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008年01月23日 14:35:21 UTC (rev 4888) +++ trunk/matplotlib/src/_backend_agg.cpp 2008年01月23日 18:13:40 UTC (rev 4889) @@ -929,7 +929,8 @@ PyArrayObject* edgecolors = NULL; try { - offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj.ptr(), PyArray_DOUBLE, 0, 2); + offsets = (PyArrayObject*)PyArray_FromObject + (offsets_obj.ptr(), PyArray_DOUBLE, 0, 2); if (!offsets || (PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) || (PyArray_NDIM(offsets) == 1 && PyArray_DIM(offsets, 0) != 0)) { @@ -1078,7 +1079,6 @@ Py_XDECREF(edgecolors); return Py::Object(); } catch (...) { - printf("Exception!\n"); Py_XDECREF(offsets); Py_XDECREF(facecolors); Py_XDECREF(edgecolors); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4888 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4888&view=rev Author: mdboom Date: 2008年01月23日 06:35:21 -0800 (2008年1月23日) Log Message: ----------- Minor speed improvements in Agg backend. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp trunk/matplotlib/src/agg_py_path_iterator.h Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008年01月23日 13:33:01 UTC (rev 4887) +++ trunk/matplotlib/src/_backend_agg.cpp 2008年01月23日 14:35:21 UTC (rev 4888) @@ -343,6 +343,10 @@ return false; code = path.vertex(&x0, &y0); + if (code == agg::path_cmd_stop) { + path.rewind(0); + return false; + } trans.transform(&x0, &y0); while ((code = path.vertex(&x1, &y1)) != agg::path_cmd_stop) { @@ -1602,7 +1606,6 @@ double g = Py::Float(rgb[1]); double b = Py::Float(rgb[2]); return agg::rgba(r, g, b, alpha); - } @@ -1615,8 +1618,6 @@ double p = Py::Float( points ) ; //return (int)(p*PIXELS_PER_INCH/72.0*dpi/72.0)+0.5; return (int)(p*dpi/72.0)+0.5; - - } double Modified: trunk/matplotlib/src/agg_py_path_iterator.h =================================================================== --- trunk/matplotlib/src/agg_py_path_iterator.h 2008年01月23日 13:33:01 UTC (rev 4887) +++ trunk/matplotlib/src/agg_py_path_iterator.h 2008年01月23日 14:35:21 UTC (rev 4888) @@ -118,7 +118,7 @@ SimplifyPath(VertexSource& source, bool quantize, bool simplify, double width = 0.0, double height = 0.0) : m_source(&source), m_quantize(quantize), m_simplify(simplify), - m_width(width), m_height(height), m_queue_read(0), m_queue_write(0), + m_width(width + 1.0), m_height(height + 1.0), m_queue_read(0), m_queue_write(0), m_moveto(true), m_lastx(0.0), m_lasty(0.0), m_clipped(false), m_do_clipping(width > 0.0 && height > 0.0), m_origdx(0.0), m_origdy(0.0), @@ -246,9 +246,9 @@ //could be clipped, but a more involved calculation would be needed if (m_do_clipping && ((*x < -1.0 && m_lastx < -1.0) || - (*x > m_width + 1.0 && m_lastx > m_width + 1.0) || + (*x > m_width && m_lastx > m_width) || (*y < -1.0 && m_lasty < -1.0) || - (*y > m_height + 1.0 && m_lasty > m_height + 1.0))) + (*y > m_height && m_lasty > m_height))) { m_lastx = *x; m_lasty = *y; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4887 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4887&view=rev Author: jswhit Date: 2008年01月23日 05:33:01 -0800 (2008年1月23日) Log Message: ----------- remove backwards compatibility kludge for ax.get_position Modified Paths: -------------- trunk/toolkits/basemap/examples/contour_demo.py trunk/toolkits/basemap/examples/panelplot.py trunk/toolkits/basemap/examples/plotmap.py trunk/toolkits/basemap/examples/plotmap_masked.py trunk/toolkits/basemap/examples/plotmap_oo.py trunk/toolkits/basemap/examples/plotprecip.py trunk/toolkits/basemap/examples/pnganim.py trunk/toolkits/basemap/examples/simpletest_oo.py trunk/toolkits/basemap/examples/test.py Modified: trunk/toolkits/basemap/examples/contour_demo.py =================================================================== --- trunk/toolkits/basemap/examples/contour_demo.py 2008年01月23日 13:20:03 UTC (rev 4886) +++ trunk/toolkits/basemap/examples/contour_demo.py 2008年01月23日 13:33:01 UTC (rev 4887) @@ -22,11 +22,8 @@ CS = m.contour(x,y,hgt,15,linewidths=0.5,colors='k') CS = m.contourf(x,y,hgt,15,cmap=cm.jet) # setup colorbar axes instance. -# for matplotlib 0.91 and earlier, could do l,b,w,h = ax.get_position() -# for post 0.91, pos = ax.get_position(); l,b,w,h = pos.bounds -# this works for both. pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes colorbar(drawedges=True, cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -52,7 +49,7 @@ CS = m.contour(x,y,hgt,15,linewidths=0.5,colors='k') CS = m.contourf(x,y,hgt,15,cmap=cm.jet) pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes colorbar(drawedges=True, cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -78,7 +75,7 @@ CS = m.contour(x,y,hgt,15,linewidths=0.5,colors='k') CS = m.contourf(x,y,hgt,15,cmap=cm.jet) pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes colorbar(drawedges=True, cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -104,7 +101,7 @@ CS = m.contour(x,y,hgt,15,linewidths=0.5,colors='k') CS = m.contourf(x,y,hgt,15,cmap=cm.jet) pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes colorbar(drawedges=True, cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -131,7 +128,7 @@ CS = m.contour(x,y,hgt,15,linewidths=0.5,colors='k') CS = m.contourf(x,y,hgt,15,cmap=cm.jet) pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes colorbar(drawedges=True, cax=cax) # draw colorbar axes(ax) # make the original axes current again Modified: trunk/toolkits/basemap/examples/panelplot.py =================================================================== --- trunk/toolkits/basemap/examples/panelplot.py 2008年01月23日 13:20:03 UTC (rev 4886) +++ trunk/toolkits/basemap/examples/panelplot.py 2008年01月23日 13:33:01 UTC (rev 4887) @@ -28,7 +28,7 @@ CS = mnh.contourf(xnh,ynh,hgt,15,cmap=P.cm.Spectral) # colorbar on bottom. pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = P.axes([l, b-0.05, w, 0.025]) # setup colorbar axes P.colorbar(cax=cax, orientation='horizontal',ticks=CS.levels[0::4]) # draw colorbar P.axes(ax) # make the original axes current again @@ -51,7 +51,7 @@ CS = msh.contourf(xsh,ysh,hgt,15,cmap=P.cm.Spectral) # colorbar on bottom. pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = P.axes([l, b-0.05, w, 0.025]) # setup colorbar axes P.colorbar(cax=cax,orientation='horizontal',ticks=MultipleLocator(320)) # draw colorbar P.axes(ax) # make the original axes current again @@ -74,7 +74,7 @@ CS = mnh.contourf(xnh,ynh,hgt,15,cmap=P.cm.RdBu) # colorbar on right pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = P.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes P.colorbar(cax=cax, ticks=MultipleLocator(160), format='%4i') # draw colorbar P.axes(ax) # make the original axes current again @@ -89,7 +89,7 @@ CS = msh.contourf(xsh,ysh,hgt,15,cmap=P.cm.RdBu) # colorbar on right. pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = P.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes P.colorbar(cax=cax, ticks=MultipleLocator(160), format='%4i') # draw colorbar P.axes(ax) # make the original axes current again Modified: trunk/toolkits/basemap/examples/plotmap.py =================================================================== --- trunk/toolkits/basemap/examples/plotmap.py 2008年01月23日 13:20:03 UTC (rev 4886) +++ trunk/toolkits/basemap/examples/plotmap.py 2008年01月23日 13:33:01 UTC (rev 4887) @@ -32,11 +32,8 @@ # plot image over map with imshow. im = m.imshow(topodat,cm.jet) # setup colorbar axes instance. -# for matplotlib 0.91 and earlier, could do l,b,w,h = ax.get_position() -# for post 0.91, pos = ax.get_position(); l,b,w,h = pos.bounds -# this works for both. pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.075, b, 0.05, h]) colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again Modified: trunk/toolkits/basemap/examples/plotmap_masked.py =================================================================== --- trunk/toolkits/basemap/examples/plotmap_masked.py 2008年01月23日 13:20:03 UTC (rev 4886) +++ trunk/toolkits/basemap/examples/plotmap_masked.py 2008年01月23日 13:33:01 UTC (rev 4887) @@ -40,11 +40,8 @@ # plot image over map with imshow. im = m.imshow(topodatm,palette,norm=colors.normalize(vmin=0.0,vmax=3000.0,clip=False)) # setup colorbar axes instance. -# for matplotlib 0.91 and earlier, could do l,b,w,h = ax.get_position() -# for post 0.91, pos = ax.get_position(); l,b,w,h = pos.bounds -# this works for both. pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.075, b, 0.05, h]) colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again Modified: trunk/toolkits/basemap/examples/plotmap_oo.py =================================================================== --- trunk/toolkits/basemap/examples/plotmap_oo.py 2008年01月23日 13:20:03 UTC (rev 4886) +++ trunk/toolkits/basemap/examples/plotmap_oo.py 2008年01月23日 13:33:01 UTC (rev 4887) @@ -45,11 +45,8 @@ # plot image over map with imshow. im = m.imshow(topodat,cm.jet) # setup colorbar axes instance. -# for matplotlib 0.91 and earlier, could do l,b,w,h = ax.get_position() -# for post 0.91, pos = ax.get_position(); l,b,w,h = pos.bounds -# this works for both. pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = fig.add_axes([l+w+0.075, b, 0.05, h],frameon=False) # setup colorbar axes fig.colorbar(im, cax=cax) # draw colorbar # plot blue dot on boulder, colorado and label it as such. Modified: trunk/toolkits/basemap/examples/plotprecip.py =================================================================== --- trunk/toolkits/basemap/examples/plotprecip.py 2008年01月23日 13:20:03 UTC (rev 4886) +++ trunk/toolkits/basemap/examples/plotprecip.py 2008年01月23日 13:33:01 UTC (rev 4887) @@ -52,7 +52,7 @@ cs = m.contourf(x,y,data,clevs,cmap=cm.s3pcpn) # new axis for colorbar. pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = pylab.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes # draw colorbar. pylab.colorbar(cs, cax, format='%g', ticks=clevs, drawedges=False) @@ -78,7 +78,7 @@ im2.set_cmap(cm.s3pcpn_l) # new axis for colorbar. pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = pylab.axes([l+w+0.025, b, 0.025, h]) # setup colorbar axes # using im2, not im (hack to prevent colors from being # too compressed at the low end on the colorbar - results Modified: trunk/toolkits/basemap/examples/pnganim.py =================================================================== --- trunk/toolkits/basemap/examples/pnganim.py 2008年01月23日 13:20:03 UTC (rev 4886) +++ trunk/toolkits/basemap/examples/pnganim.py 2008年01月23日 13:33:01 UTC (rev 4887) @@ -99,7 +99,7 @@ # number of repeated frames at beginning and end is n1. nframe = 0; n1 = 10 pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds # loop over times, make contour plots, draw coastlines, # parallels, meridians and title. for nt,date in enumerate(datelabels[1:]): Modified: trunk/toolkits/basemap/examples/simpletest_oo.py =================================================================== --- trunk/toolkits/basemap/examples/simpletest_oo.py 2008年01月23日 13:20:03 UTC (rev 4886) +++ trunk/toolkits/basemap/examples/simpletest_oo.py 2008年01月23日 13:33:01 UTC (rev 4887) @@ -37,11 +37,8 @@ # add a title. ax.set_title('Robinson Projection') # add a colorbar. -# for matplotlib 0.91 and earlier, could do l,b,w,h = ax.get_position() -# for post 0.91, pos = ax.get_position(); l,b,w,h = pos.bounds -# this works for both. pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = fig.add_axes([l, b-0.1, w, 0.03],frameon=False) # setup colorbar axes fig.colorbar(cs, cax=cax, orientation='horizontal',ticks=cs.levels[::3]) # save image (width 800 pixels with dpi=100 and fig width 8 inches). Modified: trunk/toolkits/basemap/examples/test.py =================================================================== --- trunk/toolkits/basemap/examples/test.py 2008年01月23日 13:20:03 UTC (rev 4886) +++ trunk/toolkits/basemap/examples/test.py 2008年01月23日 13:33:01 UTC (rev 4887) @@ -30,11 +30,8 @@ # plot image over map. im = m.imshow(topoin,cm.jet) # get axes position, add colorbar axes to right of this. -# for matplotlib 0.91 and earlier, could do l,b,w,h = ax.get_position() -# for post 0.91, pos = ax.get_position(); l,b,w,h = pos.bounds -# this works for both. pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -114,7 +111,7 @@ # get current axis instance. ax = gca() pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -146,7 +143,7 @@ # get current axis instance. ax = gca() pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -179,7 +176,7 @@ # get current axis instance. ax = gca() pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -211,7 +208,7 @@ # get current axis instance. ax = gca() pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -245,7 +242,7 @@ # get current axis instance. ax = gca() pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -276,7 +273,7 @@ # plot image over map. im = m.imshow(topodat,cm.jet) pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -309,7 +306,7 @@ # plot image over map. im = m.imshow(topodat,cm.jet) pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -344,7 +341,7 @@ im = m.imshow(topodat,cm.jet) im.set_clim(-4000.,3000.) # adjust range of colors. pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -379,7 +376,7 @@ # plot image over map. im = m.imshow(topodat,cm.jet) pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -410,7 +407,7 @@ # plot image over map. im = m.imshow(topodat,cm.jet) pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -442,7 +439,7 @@ # plot image over map. im = m.imshow(topodat,cm.jet) pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -483,7 +480,7 @@ # - see contour_demo.py) im = m.imshow(topo,palette,norm=colors.normalize(clip=False)) pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -524,7 +521,7 @@ # - see contour_demo.py) im = m.imshow(topo,palette,norm=colors.normalize(clip=False)) pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.075, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -552,7 +549,7 @@ x,y = m(*meshgrid(lonsin,latsin)) p = m.pcolormesh(x,y,topodatin,shading='flat') pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -579,7 +576,7 @@ x,y = m(*meshgrid(lonsin,latsin)) p = m.pcolormesh(x,y,topodatin,shading='flat') pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again @@ -606,7 +603,7 @@ x,y = m(*meshgrid(lonsin,latsin)) p = m.pcolormesh(x,y,topodatin,shading='flat') pos = ax.get_position() -l, b, w, h = getattr(pos, 'bounds', pos) +l, b, w, h = pos.bounds cax = axes([l+w+0.05, b, 0.05, h]) # setup colorbar axes. colorbar(cax=cax) # draw colorbar axes(ax) # make the original axes current again This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4886 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4886&view=rev Author: jswhit Date: 2008年01月23日 05:20:03 -0800 (2008年1月23日) Log Message: ----------- make a copy of projparams dict, so original is not modified. Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008年01月22日 19:43:18 UTC (rev 4885) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/basemap.py 2008年01月23日 13:20:03 UTC (rev 4886) @@ -930,7 +930,7 @@ boundaryxy = _geos.Polygon(b) # compute proj instance for full disk, if necessary. if not self._fulldisk: - projparms = self.projparams + projparms = self.projparams.copy() del projparms['x_0'] del projparms['y_0'] if self.projection == 'ortho': This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4885 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4885&view=rev Author: mdboom Date: 2008年01月22日 11:43:18 -0800 (2008年1月22日) Log Message: ----------- Speed improvements for path simplification algorithm. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp trunk/matplotlib/src/agg_py_path_iterator.h Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008年01月22日 13:08:27 UTC (rev 4884) +++ trunk/matplotlib/src/_backend_agg.cpp 2008年01月22日 19:43:18 UTC (rev 4885) @@ -370,7 +370,7 @@ template<class Path> bool should_simplify(Path& path) { - return !path.has_curves() && path.total_vertices() > 5; + return !path.has_curves() && path.total_vertices() >= 128; } Py::Object @@ -803,10 +803,7 @@ if (gc.linewidth != 0.0) { double linewidth = gc.linewidth; if (!gc.isaa) { - if (linewidth < 0.5) - linewidth = 0.5; - else - linewidth = round(linewidth); + linewidth = (linewidth < 0.5) ? 0.5 : round(linewidth); } if (gc.dashes.size() == 0) { stroke_t stroke(path); Modified: trunk/matplotlib/src/agg_py_path_iterator.h =================================================================== --- trunk/matplotlib/src/agg_py_path_iterator.h 2008年01月22日 13:08:27 UTC (rev 4884) +++ trunk/matplotlib/src/agg_py_path_iterator.h 2008年01月22日 19:43:18 UTC (rev 4885) @@ -24,7 +24,9 @@ m_vertices = (PyArrayObject*)PyArray_FromObject (vertices_obj.ptr(), PyArray_DOUBLE, 2, 2); - if (!m_vertices || PyArray_NDIM(m_vertices) != 2 || PyArray_DIM(m_vertices, 1) != 2) + if (!m_vertices || + PyArray_NDIM(m_vertices) != 2 || + PyArray_DIM(m_vertices, 1) != 2) throw Py::ValueError("Invalid vertices array."); if (codes_obj.ptr() != Py_None) @@ -116,7 +118,7 @@ SimplifyPath(VertexSource& source, bool quantize, bool simplify, double width = 0.0, double height = 0.0) : m_source(&source), m_quantize(quantize), m_simplify(simplify), - m_width(width), m_height(height), + m_width(width), m_height(height), m_queue_read(0), m_queue_write(0), m_moveto(true), m_lastx(0.0), m_lasty(0.0), m_clipped(false), m_do_clipping(width > 0.0 && height > 0.0), m_origdx(0.0), m_origdy(0.0), @@ -177,19 +179,21 @@ // will be popped from the queue in subsequent calls. The following // block will empty the queue before proceeding to the main loop below. // -- Michael Droettboom - if (m_queue.size()) + if (m_queue_read < m_queue_write) { - const item& front = m_queue.front(); + const item& front = m_queue[m_queue_read++]; unsigned cmd = front.cmd; *x = front.x; *y = front.y; - m_queue.pop(); #if DEBUG_SIMPLIFY printf((cmd == agg::path_cmd_move_to) ? "|" : "-"); #endif return cmd; } + m_queue_read = 0; + m_queue_write = 0; + // If the queue is now empty, and the path was fully consumed // in the last call to the main loop, return agg::path_cmd_stop to // signal that there are no more points to emit. @@ -200,8 +204,8 @@ return agg::path_cmd_stop; } - // The main simplification loop. The point is consume only as many - // points as necessary until some have been added to the outbound + // The main simplification loop. The point is to consume only as many + // points as necessary until something has been added to the outbound // queue, not to run through the entire path in one go. This // eliminates the need to allocate and fill an entire additional path // array on each draw. @@ -241,10 +245,10 @@ //skip any lines that are outside the drawing area. Note: More lines //could be clipped, but a more involved calculation would be needed if (m_do_clipping && - ((*x < -1 && m_lastx < -1) || - (*x > m_width + 1 && m_lastx > m_width + 1) || - (*y < -1 && m_lasty < -1) || - (*y > m_height + 1 && m_lasty > m_height + 1))) + ((*x < -1.0 && m_lastx < -1.0) || + (*x > m_width + 1.0 && m_lastx > m_width + 1.0) || + (*y < -1.0 && m_lasty < -1.0) || + (*y > m_height + 1.0 && m_lasty > m_height + 1.0))) { m_lastx = *x; m_lasty = *y; @@ -264,31 +268,24 @@ { if (m_clipped) { - m_queue.push(item(agg::path_cmd_move_to, m_lastx, m_lasty)); + m_queue[m_queue_write++].set(agg::path_cmd_move_to, m_lastx, m_lasty); m_clipped = false; } m_origdx = *x - m_lastx; m_origdy = *y - m_lasty; - m_origdNorm2 = m_origdx*m_origdx + m_origdy+m_origdy; + m_origdNorm2 = m_origdx*m_origdx + m_origdy*m_origdy; //set all the variables to reflect this new orig vecor m_dnorm2Max = m_origdNorm2; - m_dnorm2Min = 0; + m_dnorm2Min = 0.0; m_haveMin = false; m_lastMax = true; - m_maxX = *x; - m_maxY = *y; - m_minX = m_lastx; - m_minY = m_lasty; - - m_lastWrittenX = m_lastx; - m_lastWrittenY = m_lasty; - - // set the last point seen - m_lastx = *x; - m_lasty = *y; + m_lastx = m_maxX = *x; + m_lasty = m_maxY = *y; + m_lastWrittenX = m_minX = m_lastx; + m_lastWrittenY = m_minY = m_lasty; #if DEBUG_SIMPLIFY m_skipped++; #endif @@ -313,7 +310,6 @@ // get the para vector ( = (o.v)o/(o.o)) double paradx = totdot*m_origdx/m_origdNorm2; double parady = totdot*m_origdy/m_origdNorm2; - double paradNorm2 = paradx*paradx + parady*parady; // get the perp vector ( = v - para) double perpdx = totdx - paradx; @@ -330,6 +326,8 @@ //direction. If anti-p, test if it is the longest in the //opposite direction (the min of our final line) + double paradNorm2 = paradx*paradx + parady*parady; + m_lastMax = false; if (totdot >= 0) { @@ -368,25 +366,21 @@ //direction we are drawing in, move back to we start drawing from //back there. if (m_haveMin) - m_queue.push(item(agg::path_cmd_line_to, m_minX, m_minY)); - m_queue.push(item(agg::path_cmd_line_to, m_maxX, m_maxY)); + m_queue[m_queue_write++].set(agg::path_cmd_move_to, m_minX, m_minY); + m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_maxX, m_maxY); //if we clipped some segments between this line and the next line //we are starting, we also need to move to the last point. if (m_clipped) - { - m_queue.push(item(agg::path_cmd_move_to, m_lastx, m_lasty)); - } + m_queue[m_queue_write++].set(agg::path_cmd_move_to, m_lastx, m_lasty); else if (!m_lastMax) - { //if the last line was not the longest line, then move back to //the end point of the last line in the sequence. Only do this //if not clipped, since in that case lastx,lasty is not part of //the line just drawn. //Would be move_to if not for the artifacts - m_queue.push(item(agg::path_cmd_line_to, m_lastx, m_lasty)); - } + m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_lastx, m_lasty); //now reset all the variables to get ready for the next line m_origdx = *x - m_lastx; @@ -394,23 +388,17 @@ m_origdNorm2 = m_origdx*m_origdx + m_origdy*m_origdy; m_dnorm2Max = m_origdNorm2; - m_dnorm2Min = 0; + m_dnorm2Min = 0.0; m_haveMin = false; m_lastMax = true; - m_maxX = *x; - m_maxY = *y; - m_minX = m_lastx; - m_minY = m_lasty; + m_lastx = m_maxX = *x; + m_lasty = m_maxY = *y; + m_lastWrittenX = m_minX = m_lastx; + m_lastWrittenY = m_minY = m_lasty; - m_lastWrittenX = m_lastx; - m_lastWrittenY = m_lasty; - m_clipped = false; - - m_lastx = *x; - m_lasty = *y; #if DEBUG_SIMPLIFY - m_pushed += m_queue.size(); + m_pushed += m_queue_write - m_queue_read; #endif break; } @@ -423,21 +411,20 @@ if (m_origdNorm2 != 0) { if (m_haveMin) - m_queue.push(item(agg::path_cmd_line_to, m_minX, m_minY)); - m_queue.push(item(agg::path_cmd_line_to, m_maxX, m_maxY)); + m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_minX, m_minY); + m_queue[m_queue_write++].set(agg::path_cmd_line_to, m_maxX, m_maxY); } m_done = true; } // Return the first item in the queue, if any, otherwise // indicate that we're done. - if (m_queue.size()) + if (m_queue_read < m_queue_write) { - const item& front = m_queue.front(); + const item& front = m_queue[m_queue_read++]; unsigned cmd = front.cmd; *x = front.x; *y = front.y; - m_queue.pop(); #if DEBUG_SIMPLIFY printf((cmd == agg::path_cmd_move_to) ? "|" : "-"); #endif @@ -460,14 +447,20 @@ struct item { - item(unsigned cmd_, const double& x_, double& y_) : - cmd(cmd_), x(x_), y(y_) {} + item() {} + inline void set(const unsigned cmd_, const double& x_, const double& y_) { + cmd = cmd_; + x = x_; + y = y_; + } unsigned cmd; double x; double y; }; - typedef std::queue<item> ItemQueue; - ItemQueue m_queue; + int m_queue_read; + int m_queue_write; + item m_queue[6]; + bool m_moveto; double m_lastx, m_lasty; bool m_clipped; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4884 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4884&view=rev Author: mdboom Date: 2008年01月22日 05:08:27 -0800 (2008年1月22日) Log Message: ----------- Fix relim() to properly ignore existing data. (Thanks Darren Dale). Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年01月21日 19:08:35 UTC (rev 4883) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年01月22日 13:08:27 UTC (rev 4884) @@ -1201,9 +1201,11 @@ 'recompute the datalimits based on current artists' self.dataLim.ignore(True) for line in self.lines: + self.ignore_existing_data_limits = True self._update_line_limits(line) for p in self.patches: + self.ignore_existing_data_limits = True self._update_patch_limits(p) def update_datalim(self, xys): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4883 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4883&view=rev Author: mdboom Date: 2008年01月21日 11:08:35 -0800 (2008年1月21日) Log Message: ----------- Add more debugging output to the path simplification code. Modified Paths: -------------- trunk/matplotlib/src/agg_py_path_iterator.h Modified: trunk/matplotlib/src/agg_py_path_iterator.h =================================================================== --- trunk/matplotlib/src/agg_py_path_iterator.h 2008年01月21日 19:03:48 UTC (rev 4882) +++ trunk/matplotlib/src/agg_py_path_iterator.h 2008年01月21日 19:08:35 UTC (rev 4883) @@ -6,7 +6,7 @@ #include "numpy/arrayobject.h" #include "agg_path_storage.h" #include "MPL_isnan.h" -#include <deque> +#include <queue> class PathIterator { @@ -134,7 +134,8 @@ #if DEBUG_SIMPLIFY ~SimplifyPath() { - printf("%d %d\n", m_pushed, m_skipped); + if (m_simplify) + printf("%d %d\n", m_pushed, m_skipped); } #endif @@ -175,21 +176,29 @@ // multiple points can be emitted in a single call, and those points // will be popped from the queue in subsequent calls. The following // block will empty the queue before proceeding to the main loop below. + // -- Michael Droettboom if (m_queue.size()) { const item& front = m_queue.front(); unsigned cmd = front.cmd; *x = front.x; *y = front.y; - m_queue.pop_front(); + m_queue.pop(); +#if DEBUG_SIMPLIFY + printf((cmd == agg::path_cmd_move_to) ? "|" : "-"); +#endif return cmd; } // If the queue is now empty, and the path was fully consumed // in the last call to the main loop, return agg::path_cmd_stop to // signal that there are no more points to emit. - if (m_done) + if (m_done) { +#if DEBUG_SIMPLIFY + printf(".\n"); +#endif return agg::path_cmd_stop; + } // The main simplification loop. The point is consume only as many // points as necessary until some have been added to the outbound @@ -209,15 +218,15 @@ // + init if (m_moveto) { - m_queue.push_back(item(agg::path_cmd_move_to, *x, *y)); m_lastx = *x; m_lasty = *y; m_moveto = false; m_origdNorm2 = 0.0; #if DEBUG_SIMPLIFY m_pushed++; + printf("|"); #endif - break; + return agg::path_cmd_move_to; } // Don't render line segments less than one pixel long @@ -240,6 +249,9 @@ m_lastx = *x; m_lasty = *y; m_clipped = true; +#if DEBUG_SIMPLIFY + m_skipped++; +#endif continue; } @@ -252,7 +264,7 @@ { if (m_clipped) { - m_queue.push_back(item(agg::path_cmd_move_to, m_lastx, m_lasty)); + m_queue.push(item(agg::path_cmd_move_to, m_lastx, m_lasty)); m_clipped = false; } @@ -277,6 +289,9 @@ // set the last point seen m_lastx = *x; m_lasty = *y; +#if DEBUG_SIMPLIFY + m_skipped++; +#endif continue; } @@ -339,6 +354,9 @@ m_lastx = *x; m_lasty = *y; +#if DEBUG_SIMPLIFY + m_skipped++; +#endif continue; } @@ -350,14 +368,14 @@ //direction we are drawing in, move back to we start drawing from //back there. if (m_haveMin) - m_queue.push_back(item(agg::path_cmd_line_to, m_minX, m_minY)); - m_queue.push_back(item(agg::path_cmd_line_to, m_maxX, m_maxY)); + m_queue.push(item(agg::path_cmd_line_to, m_minX, m_minY)); + m_queue.push(item(agg::path_cmd_line_to, m_maxX, m_maxY)); //if we clipped some segments between this line and the next line //we are starting, we also need to move to the last point. if (m_clipped) { - m_queue.push_back(item(agg::path_cmd_move_to, m_lastx, m_lasty)); + m_queue.push(item(agg::path_cmd_move_to, m_lastx, m_lasty)); } else if (!m_lastMax) { @@ -367,11 +385,10 @@ //the line just drawn. //Would be move_to if not for the artifacts - m_queue.push_back(item(agg::path_cmd_line_to, m_lastx, m_lasty)); + m_queue.push(item(agg::path_cmd_line_to, m_lastx, m_lasty)); } //now reset all the variables to get ready for the next line - m_origdx = *x - m_lastx; m_origdy = *y - m_lasty; m_origdNorm2 = m_origdx*m_origdx + m_origdy*m_origdy; @@ -393,7 +410,7 @@ m_lastx = *x; m_lasty = *y; #if DEBUG_SIMPLIFY - m_pushed++; + m_pushed += m_queue.size(); #endif break; } @@ -406,8 +423,8 @@ if (m_origdNorm2 != 0) { if (m_haveMin) - m_queue.push_back(item(agg::path_cmd_line_to, m_minX, m_minY)); - m_queue.push_back(item(agg::path_cmd_line_to, m_maxX, m_maxY)); + m_queue.push(item(agg::path_cmd_line_to, m_minX, m_minY)); + m_queue.push(item(agg::path_cmd_line_to, m_maxX, m_maxY)); } m_done = true; } @@ -420,11 +437,17 @@ unsigned cmd = front.cmd; *x = front.x; *y = front.y; - m_queue.pop_front(); + m_queue.pop(); +#if DEBUG_SIMPLIFY + printf((cmd == agg::path_cmd_move_to) ? "|" : "-"); +#endif return cmd; } else { +#if DEBUG_SIMPLIFY + printf(".\n"); +#endif return agg::path_cmd_stop; } } @@ -443,7 +466,7 @@ double x; double y; }; - typedef std::deque<item> ItemQueue; + typedef std::queue<item> ItemQueue; ItemQueue m_queue; bool m_moveto; double m_lastx, m_lasty; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4882 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4882&view=rev Author: mdboom Date: 2008年01月21日 11:03:48 -0800 (2008年1月21日) Log Message: ----------- Fix bug with pie chart slices less than 2.5 degrees. Modified Paths: -------------- branches/v0_91_maint/lib/matplotlib/patches.py Modified: branches/v0_91_maint/lib/matplotlib/patches.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/patches.py 2008年01月21日 18:32:57 UTC (rev 4881) +++ branches/v0_91_maint/lib/matplotlib/patches.py 2008年01月21日 19:03:48 UTC (rev 4882) @@ -526,7 +526,9 @@ theta1 = float(theta1) theta2 = float(theta2) dtheta = float(dtheta) - num_points = abs(theta2 - theta1) / dtheta + num_points = (abs(theta2 - theta1) / dtheta) + if num_points < 2.0: + num_points = 2.0 rads = (npy.pi/180.) * npy.linspace(theta1, theta2, num_points, endpoint=True) xs = r*npy.cos(rads)+xc ys = r*npy.sin(rads)+yc This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4881 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4881&view=rev Author: mdboom Date: 2008年01月21日 10:32:57 -0800 (2008年1月21日) Log Message: ----------- Fix memory leak in pcolor and pcolormesh. (Thanks Rob Hetland) Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp trunk/matplotlib/src/_path.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008年01月18日 18:21:14 UTC (rev 4880) +++ trunk/matplotlib/src/_backend_agg.cpp 2008年01月21日 18:32:57 UTC (rev 4881) @@ -1001,6 +1001,7 @@ for (i = 0; i < N; ++i) { typename PathGenerator::path_iterator path = path_generator(i); + if (Ntransforms) { trans = transforms[i % Ntransforms]; } else { @@ -1070,15 +1071,18 @@ } } } + + Py_XDECREF(offsets); + Py_XDECREF(facecolors); + Py_XDECREF(edgecolors); + return Py::Object(); } catch (...) { + printf("Exception!\n"); Py_XDECREF(offsets); Py_XDECREF(facecolors); Py_XDECREF(edgecolors); throw; } - - Py_XDECREF(offsets); - return Py::Object(); } @@ -1186,9 +1190,9 @@ public: typedef QuadMeshPathIterator path_iterator; - inline QuadMeshGenerator(size_t meshWidth, size_t meshHeight, const Py::Object& coordinates) : + inline QuadMeshGenerator(size_t meshWidth, size_t meshHeight, PyObject* coordinates) : m_meshWidth(meshWidth), m_meshHeight(meshHeight), m_coordinates(NULL) { - PyArrayObject* coordinates_array = (PyArrayObject*)PyArray_FromObject(coordinates.ptr(), PyArray_DOUBLE, 3, 3); + PyArrayObject* coordinates_array = (PyArrayObject*)PyArray_FromObject(coordinates, PyArray_DOUBLE, 3, 3); if (!coordinates_array) { throw Py::ValueError("Invalid coordinates array."); } @@ -1214,6 +1218,7 @@ _VERBOSE("RendererAgg::draw_quad_mesh"); args.verify_length(12); + //segments, trans, clipbox, colors, linewidths, antialiaseds agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0]); Py::Object cliprect = args[1]; @@ -1221,12 +1226,13 @@ agg::trans_affine clippath_trans = py_to_agg_transformation_matrix(args[3], false); size_t mesh_width = Py::Int(args[4]); size_t mesh_height = Py::Int(args[5]); - Py::Object coordinates = args[6]; + PyObject* coordinates = args[6].ptr(); Py::Object offsets_obj = args[7]; agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[8]); Py::Object facecolors_obj = args[9]; bool antialiased = (bool)Py::Int(args[10]); bool showedges = (bool)Py::Int(args[11]); + bool free_edgecolors = false; QuadMeshGenerator path_generator(mesh_width, mesh_height, coordinates); @@ -1242,12 +1248,14 @@ npy_intp dims[] = { 1, 4, 0 }; double data[] = { 0, 0, 0, 1 }; edgecolors_obj = PyArray_SimpleNewFromData(2, dims, PyArray_DOUBLE, (char*)data); + free_edgecolors = true; } else { if (antialiased) { edgecolors_obj = facecolors_obj; } else { npy_intp dims[] = { 0, 0 }; edgecolors_obj = PyArray_SimpleNew(1, dims, PyArray_DOUBLE); + free_edgecolors = true; } } @@ -1266,6 +1274,9 @@ linestyles_obj, antialiaseds); + if (free_edgecolors) + Py_XDECREF(edgecolors_obj.ptr()); + return Py::Object(); } Modified: trunk/matplotlib/src/_path.cpp =================================================================== --- trunk/matplotlib/src/_path.cpp 2008年01月18日 18:21:14 UTC (rev 4880) +++ trunk/matplotlib/src/_path.cpp 2008年01月21日 18:32:57 UTC (rev 4881) @@ -294,11 +294,17 @@ agg::trans_affine trans = py_to_agg_transformation_matrix(args[1], false); npy_intp extent_dims[] = { 2, 2, 0 }; - double* extents_data = new double[4]; + double* extents_data = NULL; double xm, ym; PyArrayObject* extents = NULL; try { + extents = (PyArrayObject*)PyArray_SimpleNew + (2, extent_dims, PyArray_DOUBLE); + if (extents == NULL) + throw Py::MemoryError("Could not allocate result array"); + extents_data = (double*)PyArray_DATA(extents); + extents_data[0] = std::numeric_limits<double>::infinity(); extents_data[1] = std::numeric_limits<double>::infinity(); extents_data[2] = -std::numeric_limits<double>::infinity(); @@ -307,16 +313,10 @@ ::get_path_extents(path, trans, &extents_data[0], &extents_data[1], &extents_data[2], &extents_data[3], &xm, &ym); - - extents = (PyArrayObject*)PyArray_SimpleNewFromData - (2, extent_dims, PyArray_DOUBLE, extents_data); } catch (...) { - if (extents) - Py_XDECREF(extents); - else - delete[] extents_data; + Py_XDECREF(extents); throw; } @@ -357,15 +357,27 @@ Py_XDECREF(input_minpos); npy_intp extent_dims[] = { 2, 2, 0 }; - double* extents_data = new double[4]; + double* extents_data = NULL; npy_intp minpos_dims[] = { 2, 0 }; - double* minpos_data = new double[2]; + double* minpos_data = NULL; PyArrayObject* extents = NULL; PyArrayObject* minpos = NULL; bool changed = false; try { + extents = (PyArrayObject*)PyArray_SimpleNew + (2, extent_dims, PyArray_DOUBLE); + if (extents == NULL) + throw Py::MemoryError("Could not allocate result array"); + minpos = (PyArrayObject*)PyArray_SimpleNew + (1, minpos_dims, PyArray_DOUBLE); + if (minpos == NULL) + throw Py::MemoryError("Could not allocate result array"); + + extents_data = (double*)PyArray_DATA(extents); + minpos_data = (double*)PyArray_DATA(minpos); + if (ignore) { extents_data[0] = std::numeric_limits<double>::infinity(); @@ -396,21 +408,11 @@ minpos_data[0] != xm || minpos_data[1] != ym); - extents = (PyArrayObject*)PyArray_SimpleNewFromData - (2, extent_dims, PyArray_DOUBLE, extents_data); - minpos = (PyArrayObject*)PyArray_SimpleNewFromData - (1, minpos_dims, PyArray_DOUBLE, minpos_data); } catch (...) { - if (extents) - Py_XDECREF(extents); - else - delete[] extents_data; - if (minpos) - Py_XDECREF(minpos); - else - delete[] minpos_data; + Py_XDECREF(extents); + Py_XDECREF(minpos); throw; } @@ -419,6 +421,9 @@ result[1] = Py::Object((PyObject*) minpos); result[2] = Py::Int(changed ? 1 : 0); + Py_XDECREF(extents); + Py_XDECREF(minpos); + return result; } @@ -964,7 +969,7 @@ { args.verify_length(2); - Py::Object bbox = args[0]; + Py::Object bbox = args[0]; Py::SeqBase<Py::Object> bboxes = args[1]; double ax0, ay0, ax1, ay1; @@ -1086,16 +1091,15 @@ if (polygon.size() == 0) return; npy_intp polygon_dims[] = { polygon.size() / 2, 2, 0 }; - double* polygon_data = new double[polygon.size()]; - memcpy(polygon_data, &polygon[0], polygon.size() * sizeof(double)); PyArrayObject* polygon_array = NULL; - polygon_array = (PyArrayObject*)PyArray_SimpleNewFromData - (2, polygon_dims, PyArray_DOUBLE, polygon_data); + polygon_array = (PyArrayObject*)PyArray_SimpleNew + (2, polygon_dims, PyArray_DOUBLE); if (!polygon_array) { - delete[] polygon_data; - throw Py::RuntimeError("Error creating polygon array"); + throw Py::MemoryError("Error creating polygon array"); } + double* polygon_data = (double*)PyArray_DATA(polygon_array); + memcpy(polygon_data, &polygon[0], polygon.size() * sizeof(double)); polygons.append(Py::Object((PyObject*)polygon_array)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4880 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4880&view=rev Author: sameerd Date: 2008年01月18日 10:21:14 -0800 (2008年1月18日) Log Message: ----------- rec_join now returns an array that has its rows in the same order as the first record array passed to it. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mlab.py Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2008年01月18日 17:59:51 UTC (rev 4879) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2008年01月18日 18:21:14 UTC (rev 4880) @@ -1990,11 +1990,6 @@ 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)]) @@ -2003,12 +1998,14 @@ keys = r1keys & r2keys - r1ind = [r1d[k] for k in keys] - r2ind = [r2d[k] for k in keys] + r1ind = npy.array([r1d[k] for k in keys]) + r2ind = npy.array([r2d[k] for k in keys]) + # Make sure that the output rows have the same relative order as r1 + sortind = r1ind.argsort() - r1 = r1[r1ind] - r2 = r2[r2ind] + r1 = r1[r1ind[sortind]] + r2 = r2[r2ind[sortind]] r2 = rec_drop_fields(r2, r1.dtype.names) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4879 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4879&view=rev Author: mdboom Date: 2008年01月18日 09:59:51 -0800 (2008年1月18日) Log Message: ----------- Fix poly_editor.py Modified Paths: -------------- branches/v0_91_maint/examples/poly_editor.py Modified: branches/v0_91_maint/examples/poly_editor.py =================================================================== --- branches/v0_91_maint/examples/poly_editor.py 2008年01月18日 17:57:23 UTC (rev 4878) +++ branches/v0_91_maint/examples/poly_editor.py 2008年01月18日 17:59:51 UTC (rev 4879) @@ -37,6 +37,7 @@ x, y = zip(*self.poly.xy) self.line = Line2D(x,y,marker='o', markerfacecolor='r', animated=True) + self.ax.add_line(self.line) #self._update_line(poly) cid = self.poly.add_callback(self.poly_changed) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4878 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4878&view=rev Author: mdboom Date: 2008年01月18日 09:57:23 -0800 (2008年1月18日) Log Message: ----------- Fix poly_editor.py Modified Paths: -------------- trunk/matplotlib/examples/poly_editor.py Modified: trunk/matplotlib/examples/poly_editor.py =================================================================== --- trunk/matplotlib/examples/poly_editor.py 2008年01月18日 17:27:35 UTC (rev 4877) +++ trunk/matplotlib/examples/poly_editor.py 2008年01月18日 17:57:23 UTC (rev 4878) @@ -37,6 +37,7 @@ x, y = zip(*self.poly.xy) self.line = Line2D(x,y,marker='o', markerfacecolor='r', animated=True) + self.ax.add_line(self.line) #self._update_line(poly) cid = self.poly.add_callback(self.poly_changed) @@ -106,14 +107,17 @@ self.poly.xy = [tup for i,tup in enumerate(self.poly.xy) if i!=ind] self.line.set_data(zip(*self.poly.xy)) elif event.key=='i': - xys = self.poly.get_transform().seq_xy_tups(self.poly.xy) + xys = self.poly.get_transform().transform(self.poly.xy) p = event.x, event.y # display coords for i in range(len(xys)-1): s0 = xys[i] s1 = xys[i+1] d = dist_point_to_segment(p, s0, s1) if d<=self.epsilon: - self.poly.xy.insert(i+1, (event.xdata, event.ydata)) + self.poly.xy = npy.array( + list(self.poly.xy[:i]) + + [(event.xdata, event.ydata)] + + list(self.poly.xy[i:])) self.line.set_data(zip(*self.poly.xy)) break @@ -130,7 +134,7 @@ self.poly.xy[self._ind] = x,y self.line.set_data(zip(*self.poly.xy)) - + self.canvas.restore_region(self.background) self.ax.draw_artist(self.poly) self.ax.draw_artist(self.line) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4877 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4877&view=rev Author: mdboom Date: 2008年01月18日 09:27:35 -0800 (2008年1月18日) Log Message: ----------- Fix lasso_demo.py Modified Paths: -------------- trunk/matplotlib/examples/lasso_demo.py trunk/matplotlib/lib/matplotlib/collections.py Modified: trunk/matplotlib/examples/lasso_demo.py =================================================================== --- trunk/matplotlib/examples/lasso_demo.py 2008年01月18日 15:04:52 UTC (rev 4876) +++ trunk/matplotlib/examples/lasso_demo.py 2008年01月18日 17:27:35 UTC (rev 4877) @@ -35,12 +35,12 @@ self.Nxy = len(data) - self.facecolors = [d.color for d in data] + facecolors = [d.color for d in data] self.xys = [(d.x, d.y) for d in data] self.collection = RegularPolyCollection( fig.dpi, 6, sizes=(100,), - facecolors=self.facecolors, + facecolors=facecolors, offsets = self.xys, transOffset = ax.transData) @@ -49,12 +49,13 @@ self.cid = self.canvas.mpl_connect('button_press_event', self.onpress) def callback(self, verts): + facecolors = self.collection.get_facecolors() ind = nonzero(points_inside_poly(self.xys, verts))[0] for i in range(self.Nxy): if i in ind: - self.facecolors[i] = Datum.colorin + facecolors[i] = Datum.colorin else: - self.facecolors[i] = Datum.colorout + facecolors[i] = Datum.colorout self.canvas.draw_idle() self.canvas.widgetlock.release(self.lasso) Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2008年01月18日 15:04:52 UTC (rev 4876) +++ trunk/matplotlib/lib/matplotlib/collections.py 2008年01月18日 17:27:35 UTC (rev 4877) @@ -275,6 +275,10 @@ set_facecolors = set_facecolor + def get_facecolor(self): + return self._facecolors + get_facecolors = get_facecolor + def set_edgecolor(self, c): """ Set the edgecolor(s) of the collection. c can be a matplotlib color This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4876 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4876&view=rev Author: mdboom Date: 2008年01月18日 07:04:52 -0800 (2008年1月18日) Log Message: ----------- Bugfig for last commit. Don't do simplifications on filled paths ever. (Until we can work out the difficulties). Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008年01月18日 14:44:10 UTC (rev 4875) +++ trunk/matplotlib/src/_backend_agg.cpp 2008年01月18日 15:04:52 UTC (rev 4876) @@ -887,7 +887,7 @@ trans *= agg::trans_affine_scaling(1.0, -1.0); trans *= agg::trans_affine_translation(0.0, (double)height); bool snap = should_snap(path, trans); - bool simplify = should_simplify(path); + bool simplify = should_simplify(path) && !face.first; transformed_path_t tpath(path, trans); simplify_t simplified(tpath, snap, simplify, width, height); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4875 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4875&view=rev Author: mdboom Date: 2008年01月18日 06:44:10 -0800 (2008年1月18日) Log Message: ----------- Add line simplification, to cut down on the number of line segments that need to be stroked. Affects *Agg and Gdk backends. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py trunk/matplotlib/lib/matplotlib/path.py trunk/matplotlib/src/_backend_agg.cpp trunk/matplotlib/src/_path.cpp trunk/matplotlib/src/agg_py_path_iterator.h Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py 2008年01月17日 04:13:27 UTC (rev 4874) +++ trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py 2008年01月18日 14:44:10 UTC (rev 4875) @@ -84,7 +84,7 @@ def draw_path(self, gc, path, transform, rgbFace=None): transform = transform + Affine2D(). \ scale(1.0, -1.0).translate(0, self.height) - polygons = path.to_polygons(transform) + polygons = path.to_polygons(transform, self.width, self.height) for polygon in polygons: # draw_polygon won't take an arbitrary sequence -- it must be a list # of tuples Modified: trunk/matplotlib/lib/matplotlib/path.py =================================================================== --- trunk/matplotlib/lib/matplotlib/path.py 2008年01月17日 04:13:27 UTC (rev 4874) +++ trunk/matplotlib/lib/matplotlib/path.py 2008年01月18日 14:44:10 UTC (rev 4875) @@ -283,7 +283,7 @@ new_codes = None return Path(vertices, new_codes) - def to_polygons(self, transform=None): + def to_polygons(self, transform=None, width=0, height=0): """ Convert this path to a list of polygons. Each polygon is an Nx2 array of vertices. In other words, each polygon has no @@ -292,13 +292,13 @@ if transform is not None: transform = transform.frozen() # Deal with the common and simple case - if self.codes is None: + if self.codes is None and len(self.vertices) < 100: if len(self.vertices): return [transform.transform(self.vertices)] return [] # Deal with the case where there are curves and/or multiple # subpaths (using extension code) - return convert_path_to_polygons(self, transform) + return convert_path_to_polygons(self, transform, width, height) _unit_rectangle = None #@classmethod Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008年01月17日 04:13:27 UTC (rev 4874) +++ trunk/matplotlib/src/_backend_agg.cpp 2008年01月18日 14:44:10 UTC (rev 4875) @@ -20,6 +20,7 @@ #include "agg_span_image_filter_gray.h" #include "agg_span_image_filter_rgba.h" #include "agg_span_interpolator_linear.h" +#include "agg_conv_shorten_path.h" #include "util/agg_color_conv_rgb8.h" #include "ft2font.h" @@ -84,31 +85,6 @@ return Py::String(PyString_FromStringAndSize((const char*)data, height*stride), true); } -template<class VertexSource> class conv_quantize -{ -public: - conv_quantize(VertexSource& source, bool quantize) : - m_source(&source), m_quantize(quantize) {} - - void rewind(unsigned path_id) { - m_source->rewind(path_id); - } - - unsigned vertex(double* x, double* y) { - unsigned cmd = m_source->vertex(x, y); - if (m_quantize && agg::is_vertex(cmd)) { - *x = round(*x) + 0.5; - *y = round(*y) + 0.5; - } - return cmd; - } - -private: - VertexSource* m_source; - bool m_quantize; -}; - - GCAgg::GCAgg(const Py::Object &gc, double dpi) : dpi(dpi), isaa(true), linewidth(1.0), alpha(1.0), dashOffset(0.0) @@ -358,8 +334,8 @@ template<class Path> bool should_snap(Path& path, const agg::trans_affine& trans) { - // If this contains only straight horizontal or vertical lines, quantize to nearest - // pixels + // If this contains only straight horizontal or vertical lines, it should be + // quantized to the nearest pixels double x0, y0, x1, y1; unsigned code; @@ -392,6 +368,11 @@ return true; } +template<class Path> +bool should_simplify(Path& path) { + return !path.has_curves() && path.total_vertices() > 5; +} + Py::Object RendererAgg::copy_from_bbox(const Py::Tuple& args) { //copy region in bbox to buffer and return swig/agg buffer object @@ -479,7 +460,7 @@ Py::Object RendererAgg::draw_markers(const Py::Tuple& args) { typedef agg::conv_transform<PathIterator> transformed_path_t; - typedef conv_quantize<transformed_path_t> quantize_t; + typedef SimplifyPath<transformed_path_t> simplify_t; typedef agg::conv_curve<transformed_path_t> curve_t; typedef agg::conv_stroke<curve_t> stroke_t; typedef agg::pixfmt_amask_adaptor<pixfmt, alpha_mask_type> pixfmt_amask_type; @@ -510,8 +491,8 @@ bool snap = should_snap(path, trans); transformed_path_t path_transformed(path, trans); GCAgg gc = GCAgg(gc_obj, dpi); - quantize_t path_quantized(path_transformed, snap); - path_quantized.rewind(0); + simplify_t path_simplified(path_transformed, snap, false, width, height); + path_simplified.rewind(0); facepair_t face = _get_rgba_face(face_obj, gc.alpha); @@ -564,7 +545,7 @@ agg::serialized_scanlines_adaptor_aa8::embedded_scanline sl; if (has_clippath) { - while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) { + while (path_simplified.vertex(&x, &y) != agg::path_cmd_stop) { pixfmt_amask_type pfa(*pixFmt, *alphaMask); amask_ren_type r(pfa); amask_aa_renderer_type ren(r); @@ -579,7 +560,7 @@ agg::render_scanlines(sa, sl, ren); } } else { - while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) { + while (path_simplified.vertex(&x, &y) != agg::path_cmd_stop) { if (face.first) { rendererAA->color(face.second); sa.init(fillCache, fillSize, x, y); @@ -881,8 +862,8 @@ Py::Object RendererAgg::draw_path(const Py::Tuple& args) { typedef agg::conv_transform<PathIterator> transformed_path_t; - typedef conv_quantize<transformed_path_t> quantize_t; - typedef agg::conv_curve<quantize_t> curve_t; + typedef SimplifyPath<transformed_path_t> simplify_t; + typedef agg::conv_curve<simplify_t> curve_t; _VERBOSE("RendererAgg::draw_path"); args.verify_length(3, 4); @@ -906,9 +887,11 @@ trans *= agg::trans_affine_scaling(1.0, -1.0); trans *= agg::trans_affine_translation(0.0, (double)height); bool snap = should_snap(path, trans); + bool simplify = should_simplify(path); + transformed_path_t tpath(path, trans); - quantize_t quantized(tpath, snap); - curve_t curve(quantized); + simplify_t simplified(tpath, snap, simplify, width, height); + curve_t curve(simplified); if (snap) gc.isaa = false; @@ -934,8 +917,8 @@ const Py::SeqBase<Py::Object>& linestyles_obj, const Py::SeqBase<Py::Int>& antialiaseds) { typedef agg::conv_transform<typename PathGenerator::path_iterator> transformed_path_t; - typedef conv_quantize<transformed_path_t> quantize_t; - typedef agg::conv_curve<quantize_t> quantized_curve_t; + typedef SimplifyPath<transformed_path_t> simplify_t; + typedef agg::conv_curve<simplify_t> simplified_curve_t; typedef agg::conv_curve<transformed_path_t> curve_t; GCAgg gc(dpi); @@ -1068,12 +1051,12 @@ gc.isaa = bool(Py::Int(antialiaseds[i % Naa])); transformed_path_t tpath(path, trans); - quantize_t quantized(tpath, snap); + simplify_t simplified(tpath, snap, false, width, height); if (has_curves) { - quantized_curve_t curve(quantized); + simplified_curve_t curve(simplified); _draw_path(curve, has_clippath, face, gc); } else { - _draw_path(quantized, has_clippath, face, gc); + _draw_path(simplified, has_clippath, face, gc); } } else { gc.isaa = bool(Py::Int(antialiaseds[i % Naa])); Modified: trunk/matplotlib/src/_path.cpp =================================================================== --- trunk/matplotlib/src/_path.cpp 2008年01月17日 04:13:27 UTC (rev 4874) +++ trunk/matplotlib/src/_path.cpp 2008年01月18日 14:44:10 UTC (rev 4875) @@ -1102,17 +1102,23 @@ Py::Object _path_module::convert_path_to_polygons(const Py::Tuple& args) { typedef agg::conv_transform<PathIterator> transformed_path_t; - typedef agg::conv_curve<transformed_path_t> curve_t; + typedef SimplifyPath<transformed_path_t> simplify_t; + typedef agg::conv_curve<simplify_t> curve_t; typedef std::vector<double> vertices_t; - args.verify_length(2); + args.verify_length(4); PathIterator path(args[0]); agg::trans_affine trans = py_to_agg_transformation_matrix(args[1], false); + double width = Py::Float(args[2]); + double height = Py::Float(args[3]); + bool simplify = !path.has_curves(); + transformed_path_t tpath(path, trans); - curve_t curve(tpath); + simplify_t simplified(tpath, false, simplify, width, height); + curve_t curve(simplified); Py::List polygons; vertices_t polygon; Modified: trunk/matplotlib/src/agg_py_path_iterator.h =================================================================== --- trunk/matplotlib/src/agg_py_path_iterator.h 2008年01月17日 04:13:27 UTC (rev 4874) +++ trunk/matplotlib/src/agg_py_path_iterator.h 2008年01月18日 14:44:10 UTC (rev 4875) @@ -6,6 +6,7 @@ #include "numpy/arrayobject.h" #include "agg_path_storage.h" #include "MPL_isnan.h" +#include <deque> class PathIterator { @@ -46,11 +47,16 @@ static const unsigned code_map[]; private: - inline unsigned vertex(unsigned idx, double* x, double* y) + inline void vertex(const unsigned idx, double* x, double* y) { char* pair = (char*)PyArray_GETPTR2(m_vertices, idx, 0); *x = *(double*)pair; *y = *(double*)(pair + PyArray_STRIDE(m_vertices, 1)); + } + + inline unsigned vertex_with_code(const unsigned idx, double* x, double* y) + { + vertex(idx, x, y); if (m_codes) { return code_map[(int)*(char *)PyArray_GETPTR1(m_codes, idx)]; @@ -65,11 +71,12 @@ inline unsigned vertex(double* x, double* y) { if (m_iterator >= m_total_vertices) return agg::path_cmd_stop; - unsigned code = vertex(m_iterator++, x, y); + unsigned code = vertex_with_code(m_iterator++, x, y); while ((MPL_isnan64(*x) || MPL_isnan64(*y)) && - m_iterator < m_total_vertices) { - vertex(m_iterator++, x, y); - code = agg::path_cmd_move_to; + m_iterator < m_total_vertices) + { + vertex(m_iterator++, x, y); + code = agg::path_cmd_move_to; } return code; } @@ -100,4 +107,368 @@ agg::path_cmd_end_poly | agg::path_flags_close }; +#define DEBUG_SIMPLIFY 0 + +template<class VertexSource> +class SimplifyPath +{ +public: + SimplifyPath(VertexSource& source, bool quantize, bool simplify, + double width = 0.0, double height = 0.0) : + m_source(&source), m_quantize(quantize), m_simplify(simplify), + m_width(width), m_height(height), + m_moveto(true), m_lastx(0.0), m_lasty(0.0), m_clipped(false), + m_do_clipping(width > 0.0 && height > 0.0), + m_origdx(0.0), m_origdy(0.0), + m_origdNorm2(0.0), m_dnorm2Max(0.0), m_dnorm2Min(0.0), + m_haveMin(false), m_lastMax(false), m_maxX(0.0), m_maxY(0.0), + m_minX(0.0), m_minY(0.0), m_lastWrittenX(0.0), m_lastWrittenY(0.0), + m_done(false) +#if DEBUG_SIMPLIFY + , m_pushed(0), m_skipped(0) +#endif + { + // empty + } + +#if DEBUG_SIMPLIFY + ~SimplifyPath() + { + printf("%d %d\n", m_pushed, m_skipped); + } +#endif + + void rewind(unsigned path_id) + { + m_source->rewind(path_id); + } + + unsigned vertex(double* x, double* y) + { + unsigned cmd; + + // The simplification algorithm doesn't support curves or compound paths + // so we just don't do it at all in that case... + if (!m_simplify) + { + cmd = m_source->vertex(x, y); + if (m_quantize && agg::is_vertex(cmd)) + { + *x = round(*x) + 0.5; + *y = round(*y) + 0.5; + } + return cmd; + } + + //idea: we can skip drawing many lines: lines < 1 pixel in length, lines + //outside of the drawing area, and we can combine sequential parallel lines + //into a single line instead of redrawing lines over the same points. + //The loop below works a bit like a state machine, where what it does depends + //on what it did in the last looping. To test whether sequential lines + //are close to parallel, I calculate the distance moved perpendicular to the + //last line. Once it gets too big, the lines cannot be combined. + + // This code was originally written by someone else (John Hunter?) and I + // have modified to work in-place -- meaning not creating an entirely + // new path list each time. In order to do that without too much + // additional code complexity, it keeps a small queue around so that + // multiple points can be emitted in a single call, and those points + // will be popped from the queue in subsequent calls. The following + // block will empty the queue before proceeding to the main loop below. + if (m_queue.size()) + { + const item& front = m_queue.front(); + unsigned cmd = front.cmd; + *x = front.x; + *y = front.y; + m_queue.pop_front(); + return cmd; + } + + // If the queue is now empty, and the path was fully consumed + // in the last call to the main loop, return agg::path_cmd_stop to + // signal that there are no more points to emit. + if (m_done) + return agg::path_cmd_stop; + + // The main simplification loop. The point is consume only as many + // points as necessary until some have been added to the outbound + // queue, not to run through the entire path in one go. This + // eliminates the need to allocate and fill an entire additional path + // array on each draw. + while ((cmd = m_source->vertex(x, y)) != agg::path_cmd_stop) + { + // Do any quantization if requested + if (m_quantize && agg::is_vertex(cmd)) + { + *x = round(*x) + 0.5; + *y = round(*y) + 0.5; + } + + //if we are starting a new path segment, move to the first point + // + init + if (m_moveto) + { + m_queue.push_back(item(agg::path_cmd_move_to, *x, *y)); + m_lastx = *x; + m_lasty = *y; + m_moveto = false; + m_origdNorm2 = 0.0; +#if DEBUG_SIMPLIFY + m_pushed++; +#endif + break; + } + + // Don't render line segments less than one pixel long + if (fabs(*x - m_lastx) < 1.0 && fabs(*y - m_lasty) < 1.0) + { +#if DEBUG_SIMPLIFY + m_skipped++; +#endif + continue; + } + + //skip any lines that are outside the drawing area. Note: More lines + //could be clipped, but a more involved calculation would be needed + if (m_do_clipping && + ((*x < -1 && m_lastx < -1) || + (*x > m_width + 1 && m_lastx > m_width + 1) || + (*y < -1 && m_lasty < -1) || + (*y > m_height + 1 && m_lasty > m_height + 1))) + { + m_lastx = *x; + m_lasty = *y; + m_clipped = true; + continue; + } + + // if we have no orig vector, set it to this vector and + // continue. + // this orig vector is the reference vector we will build + // up the line to + + if (m_origdNorm2 == 0) + { + if (m_clipped) + { + m_queue.push_back(item(agg::path_cmd_move_to, m_lastx, m_lasty)); + m_clipped = false; + } + + m_origdx = *x - m_lastx; + m_origdy = *y - m_lasty; + m_origdNorm2 = m_origdx*m_origdx + m_origdy+m_origdy; + + //set all the variables to reflect this new orig vecor + m_dnorm2Max = m_origdNorm2; + m_dnorm2Min = 0; + m_haveMin = false; + m_lastMax = true; + + m_maxX = *x; + m_maxY = *y; + m_minX = m_lastx; + m_minY = m_lasty; + + m_lastWrittenX = m_lastx; + m_lastWrittenY = m_lasty; + + // set the last point seen + m_lastx = *x; + m_lasty = *y; + continue; + } + + //if got to here, then we have an orig vector and we just got + //a vector in the sequence. + + //check that the perpendicular distance we have moved from the + //last written point compared to the line we are building is not too + //much. If o is the orig vector (we are building on), and v is the + //vector from the last written point to the current point, then the + //perpendicular vector is p = v - (o.v)o, and we normalize o (by + //dividing the second term by o.o). + + // get the v vector + double totdx = *x - m_lastWrittenX; + double totdy = *y - m_lastWrittenY; + double totdot = m_origdx*totdx + m_origdy*totdy; + + // get the para vector ( = (o.v)o/(o.o)) + double paradx = totdot*m_origdx/m_origdNorm2; + double parady = totdot*m_origdy/m_origdNorm2; + double paradNorm2 = paradx*paradx + parady*parady; + + // get the perp vector ( = v - para) + double perpdx = totdx - paradx; + double perpdy = totdy - parady; + double perpdNorm2 = perpdx*perpdx + perpdy*perpdy; + + //if the perp vector is less than some number of (squared) + //pixels in size, then merge the current vector + if (perpdNorm2 < 0.25) + { + //check if the current vector is parallel or + //anti-parallel to the orig vector. If it is parallel, test + //if it is the longest of the vectors we are merging in that + //direction. If anti-p, test if it is the longest in the + //opposite direction (the min of our final line) + + m_lastMax = false; + if (totdot >= 0) + { + if (paradNorm2 > m_dnorm2Max) + { + m_lastMax = true; + m_dnorm2Max = paradNorm2; + m_maxX = m_lastWrittenX + paradx; + m_maxY = m_lastWrittenY + parady; + } + } + else + { + m_haveMin = true; + if (paradNorm2 > m_dnorm2Min) + { + m_dnorm2Min = paradNorm2; + m_minX = m_lastWrittenX + paradx; + m_minY = m_lastWrittenY + parady; + } + } + + m_lastx = *x; + m_lasty = *y; + continue; + } + + //if we get here, then this vector was not similar enough to the + //line we are building, so we need to draw that line and start the + //next one. + + //if the line needs to extend in the opposite direction from the + //direction we are drawing in, move back to we start drawing from + //back there. + if (m_haveMin) + m_queue.push_back(item(agg::path_cmd_line_to, m_minX, m_minY)); + m_queue.push_back(item(agg::path_cmd_line_to, m_maxX, m_maxY)); + + //if we clipped some segments between this line and the next line + //we are starting, we also need to move to the last point. + if (m_clipped) + { + m_queue.push_back(item(agg::path_cmd_move_to, m_lastx, m_lasty)); + } + else if (!m_lastMax) + { + //if the last line was not the longest line, then move back to + //the end point of the last line in the sequence. Only do this + //if not clipped, since in that case lastx,lasty is not part of + //the line just drawn. + + //Would be move_to if not for the artifacts + m_queue.push_back(item(agg::path_cmd_line_to, m_lastx, m_lasty)); + } + + //now reset all the variables to get ready for the next line + + m_origdx = *x - m_lastx; + m_origdy = *y - m_lasty; + m_origdNorm2 = m_origdx*m_origdx + m_origdy*m_origdy; + + m_dnorm2Max = m_origdNorm2; + m_dnorm2Min = 0; + m_haveMin = false; + m_lastMax = true; + m_maxX = *x; + m_maxY = *y; + m_minX = m_lastx; + m_minY = m_lasty; + + m_lastWrittenX = m_lastx; + m_lastWrittenY = m_lasty; + + m_clipped = false; + + m_lastx = *x; + m_lasty = *y; +#if DEBUG_SIMPLIFY + m_pushed++; +#endif + break; + } + + // Fill the queue with the remaining vertices if we've finished the + // path in the above loop. Mark the path as done, so we don't call + // m_source->vertex again and segfault. + if (cmd == agg::path_cmd_stop) + { + if (m_origdNorm2 != 0) + { + if (m_haveMin) + m_queue.push_back(item(agg::path_cmd_line_to, m_minX, m_minY)); + m_queue.push_back(item(agg::path_cmd_line_to, m_maxX, m_maxY)); + } + m_done = true; + } + + // Return the first item in the queue, if any, otherwise + // indicate that we're done. + if (m_queue.size()) + { + const item& front = m_queue.front(); + unsigned cmd = front.cmd; + *x = front.x; + *y = front.y; + m_queue.pop_front(); + return cmd; + } + else + { + return agg::path_cmd_stop; + } + } + +private: + VertexSource* m_source; + bool m_quantize; + bool m_simplify; + double m_width, m_height; + + struct item + { + item(unsigned cmd_, const double& x_, double& y_) : + cmd(cmd_), x(x_), y(y_) {} + unsigned cmd; + double x; + double y; + }; + typedef std::deque<item> ItemQueue; + ItemQueue m_queue; + bool m_moveto; + double m_lastx, m_lasty; + bool m_clipped; + bool m_do_clipping; + + double m_origdx; + double m_origdy; + double m_origdNorm2; + double m_dnorm2Max; + double m_dnorm2Min; + bool m_haveMin; + bool m_lastMax; + double m_maxX; + double m_maxY; + double m_minX; + double m_minY; + double m_lastWrittenX; + double m_lastWrittenY; + bool m_done; + +#if DEBUG_SIMPLIFY + unsigned m_pushed; + unsigned m_skipped; +#endif +}; + #endif // __AGG_PY_PATH_ITERATOR_H__ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4874 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4874&view=rev Author: jdh2358 Date: 2008年01月16日 20:13:27 -0800 (2008年1月16日) Log Message: ----------- forced nonunicode fname for save in agg Modified Paths: -------------- branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py Modified: branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py 2008年01月17日 04:12:58 UTC (rev 4873) +++ branches/v0_91_maint/lib/matplotlib/backends/backend_agg.py 2008年01月17日 04:13:27 UTC (rev 4874) @@ -394,5 +394,6 @@ def print_png(self, filename, *args, **kwargs): self.draw() + filename = str(filename) # until we figure out unicode handling self.get_renderer()._renderer.write_png(filename, self.figure.dpi.get()) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4873 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4873&view=rev Author: jdh2358 Date: 2008年01月16日 20:12:58 -0800 (2008年1月16日) Log Message: ----------- forced nonunicode fname for save in agg Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008年01月16日 13:04:50 UTC (rev 4872) +++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2008年01月17日 04:12:58 UTC (rev 4873) @@ -299,5 +299,6 @@ renderer = self.get_renderer() original_dpi = renderer.dpi renderer.dpi = self.figure.dpi + filename = str(filename) # until we figure out unicode handling renderer._renderer.write_png(filename, self.figure.dpi) renderer.dpi = original_dpi This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4872 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4872&view=rev Author: mdboom Date: 2008年01月16日 05:04:50 -0800 (2008年1月16日) Log Message: ----------- Fix exception when plotting legend for LineCollection (Thanks to Paul Novak). Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/legend.py Modified: trunk/matplotlib/lib/matplotlib/legend.py =================================================================== --- trunk/matplotlib/lib/matplotlib/legend.py 2008年01月15日 20:52:27 UTC (rev 4871) +++ trunk/matplotlib/lib/matplotlib/legend.py 2008年01月16日 13:04:50 UTC (rev 4872) @@ -272,7 +272,7 @@ legline.set_clip_box(None) legline.set_clip_path(None) lw = handle.get_linewidth()[0] - dashes = handle.get_dashes() + dashes = handle.get_dashes()[0] color = handle.get_colors()[0] legline.set_color(color) legline.set_linewidth(lw) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4871 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4871&view=rev Author: mdboom Date: 2008年01月15日 12:52:27 -0800 (2008年1月15日) Log Message: ----------- Make numpoints=1 work for legend handles. (Patch submitted by Paul Novak). Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/legend.py Modified: trunk/matplotlib/lib/matplotlib/legend.py =================================================================== --- trunk/matplotlib/lib/matplotlib/legend.py 2008年01月15日 20:00:50 UTC (rev 4870) +++ trunk/matplotlib/lib/matplotlib/legend.py 2008年01月15日 20:52:27 UTC (rev 4871) @@ -175,10 +175,6 @@ # make a trial box in the middle of the axes. relocate it # based on it's bbox left, top = 0.5, 0.5 - if self.numpoints == 1: - self._xdata = npy.array([left + self.handlelen*0.5]) - else: - self._xdata = npy.linspace(left, left + self.handlelen, self.numpoints) textleft = left+ self.handlelen+self.handletextsep self.texts = self._get_texts(labels, textleft, top) self.legendHandles = self._get_handles(handles, self.texts) @@ -236,15 +232,23 @@ def _get_handles(self, handles, texts): HEIGHT = self._approx_text_height() + left = 0.5 ret = [] # the returned legend lines for handle, label in zip(handles, texts): + if self.numpoints > 1: + xdata = npy.linspace(left, left + self.handlelen, self.numpoints) + elif self.numpoints == 1: + xdata = npy.linspace(left, left + self.handlelen, 2) + x, y = label.get_position() x -= self.handlelen + self.handletextsep if isinstance(handle, Line2D): - ydata = (y-HEIGHT/2)*npy.ones(self._xdata.shape, float) - legline = Line2D(self._xdata, ydata) + if self.numpoints == 1 and handle._marker != 'None': + xdata = npy.array([left + self.handlelen*0.5]) + ydata = (y-HEIGHT/2)*npy.ones(xdata.shape, float) + legline = Line2D(xdata, ydata) legline.update_from(handle) self._set_artist_props(legline) # after update legline.set_clip_box(None) @@ -253,8 +257,7 @@ ret.append(legline) elif isinstance(handle, Patch): - - p = Rectangle(xy=(min(self._xdata), y-3/4*HEIGHT), + p = Rectangle(xy=(min(xdata), y-3/4*HEIGHT), width = self.handlelen, height=HEIGHT/2, ) p.update_from(handle) @@ -263,8 +266,8 @@ p.set_clip_path(None) ret.append(p) elif isinstance(handle, LineCollection): - ydata = (y-HEIGHT/2)*npy.ones(self._xdata.shape, float) - legline = Line2D(self._xdata, ydata) + ydata = (y-HEIGHT/2)*npy.ones(xdata.shape, float) + legline = Line2D(xdata, ydata) self._set_artist_props(legline) legline.set_clip_box(None) legline.set_clip_path(None) @@ -277,7 +280,9 @@ ret.append(legline) elif isinstance(handle, RegularPolyCollection): - p = Rectangle(xy=(min(self._xdata), y-3/4*HEIGHT), + if self.numpoints == 1: + xdata = npy.array([left]) + p = Rectangle(xy=(min(xdata), y-3/4*HEIGHT), width = self.handlelen, height=HEIGHT/2, ) p.set_facecolor(handle._facecolors[0]) @@ -487,7 +492,7 @@ for handle, tup in zip(self.legendHandles, hpos): y,h = tup if isinstance(handle, Line2D): - ydata = y*npy.ones(self._xdata.shape, float) + ydata = y*npy.ones(handle.get_xdata().shape, float) handle.set_ydata(ydata+h/2) elif isinstance(handle, Rectangle): handle.set_y(y+1/4*h) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4870 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4870&view=rev Author: mdboom Date: 2008年01月15日 12:00:50 -0800 (2008年1月15日) Log Message: ----------- Fix problem with color changing in Ps backend. (Ticks were same color as line). Thanks Paul Novak. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年01月15日 19:32:47 UTC (rev 4869) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年01月15日 20:00:50 UTC (rev 4870) @@ -759,16 +759,6 @@ fill = (fill and rgbFace is not None and (len(rgbFace) <= 3 or rgbFace[3] != 0.0)) - if stroke: - 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()) - if self.linewidth > 0 and stroke: - self.set_color(*gc.get_rgb()[:3]) - cliprect = gc.get_clip_rectangle() if cliprect: x,y,w,h=cliprect.bounds @@ -782,17 +772,23 @@ write(ps.strip()) write("\n") + hatch = gc.get_hatch() + if hatch: + self.set_hatch(hatch) + if fill: #print 'rgbface', rgbFace write("gsave\n") 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 and stroke: + if stroke and gc.get_linewidth() > 0.0: + 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()) self.set_color(*gc.get_rgb()[:3]) write("stroke\n") else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4869 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4869&view=rev Author: mdboom Date: 2008年01月15日 11:32:47 -0800 (2008年1月15日) Log Message: ----------- Fix bug with alpha colors in Ps backend. Thanks Paul Novak. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年01月14日 13:21:23 UTC (rev 4868) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年01月15日 19:32:47 UTC (rev 4869) @@ -541,7 +541,7 @@ corr = 0#w/2*(fontsize-10)/10 pos = _nums_to_str(x-corr, y) thetext = 'psmarker%d' % self.textcnt - color = '%1.3f,%1.3f,%1.3f'% gc.get_rgb() + color = '%1.3f,%1.3f,%1.3f'% gc.get_rgb()[:3] fontcmd = {'sans-serif' : r'{\sffamily %s}', 'monospace' : r'{\ttfamily %s}'}.get( rcParams['font.family'], r'{\rmfamily %s}') @@ -597,7 +597,7 @@ fontname = font.get_fontname() fontsize = prop.get_size_in_points() rotate = '%1.1f rotate' % angle - setcolor = '%1.3f %1.3f %1.3f setrgbcolor' % gc.get_rgb() + setcolor = '%1.3f %1.3f %1.3f setrgbcolor' % gc.get_rgb()[:3] #h = 0 ps = """\ gsave This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 4868 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4868&view=rev Author: dsdale Date: 2008年01月14日 05:21:23 -0800 (2008年1月14日) Log Message: ----------- minor bugfix in default rcParams Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/__init__.py Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2008年01月14日 13:15:17 UTC (rev 4867) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2008年01月14日 13:21:23 UTC (rev 4868) @@ -561,8 +561,10 @@ fname = matplotlib_fname() if not os.path.exists(fname): + # this should never happen, default in mpl-data should always be found message = 'could not find rc file; returning defaults' - ret = dict([ (key, tup[0]) for key, tup in defaultParams.items()]) + ret = RcParams([ (key, default) for key, (default, converter) in \ + defaultParams.iteritems() ]) warnings.warn(message) return ret This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.