You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
| 2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
| 2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
| 2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <jd...@us...> - 2009-05-17 15:08:13
|
Revision: 7112
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7112&view=rev
Author: jdh2358
Date: 2009-05-17 15:08:07 +0000 (Sun, 17 May 2009)
Log Message:
-----------
applied Michiel's sf patch 2792742 to speed up Cairo and macosx collections
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/backend_bases.py
trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
trunk/matplotlib/lib/matplotlib/backends/backend_gtkcairo.py
trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py
trunk/matplotlib/lib/matplotlib/lines.py
trunk/matplotlib/lib/matplotlib/patches.py
trunk/matplotlib/lib/matplotlib/text.py
trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py
trunk/matplotlib/src/_macosx.m
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-05-17 14:54:57 UTC (rev 7111)
+++ trunk/matplotlib/CHANGELOG 2009-05-17 15:08:07 UTC (rev 7112)
@@ -1,4 +1,8 @@
+2009-05-19 applied Michiel's sf patch 2792742 to speed up Cairo and
+ macosx collections; speedups can be 20x
+
======================================================================
+
2008-05-17 Release 0.98.5.3 at r7107 from the branch - JDH
2009-05-13 An optional offset and bbox support in restore_bbox.
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py 2009-05-17 14:54:57 UTC (rev 7111)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2009-05-17 15:08:07 UTC (rev 7112)
@@ -277,6 +277,7 @@
gc.set_url(urls[i % Nurls])
yield xo, yo, path_id, gc, rgbFace
+ gc.restore()
def get_image_magnification(self):
"""
@@ -459,6 +460,13 @@
self._url = gc._url
self._snap = gc._snap
+ def restore(self):
+ """
+ Restore the graphics context from the stack - needed only
+ for backends that save graphics contexts on a stack
+ """
+ pass
+
def get_alpha(self):
"""
Return the alpha value used for blending - not supported on
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2009-05-17 14:54:57 UTC (rev 7111)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2009-05-17 15:08:07 UTC (rev 7112)
@@ -91,13 +91,13 @@
"""
if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name())
self.dpi = dpi
+ self.gc = GraphicsContextCairo (renderer=self)
self.text_ctx = cairo.Context (
cairo.ImageSurface (cairo.FORMAT_ARGB32,1,1))
self.mathtext_parser = MathTextParser('Cairo')
def set_ctx_from_surface (self, surface):
- self.ctx = cairo.Context (surface)
- self.ctx.save() # restore, save - when call new_gc()
+ self.gc.ctx = cairo.Context (surface)
def set_width_height(self, width, height):
@@ -109,22 +109,6 @@
# font transform?
- def _do_clip(self, ctx, cliprect, clippath):
- if cliprect is not None:
- x,y,w,h = cliprect.bounds
- # pixel-aligned clip-regions are faster
- x,y,w,h = round(x), round(y), round(w), round(h)
- ctx.new_path()
- ctx.rectangle (x, self.height - h - y, w, h)
- ctx.clip ()
-
- if clippath is not None:
- tpath, affine = clippath.get_transformed_path_and_affine()
- ctx.new_path()
- affine = affine + Affine2D().scale(1.0, -1.0).translate(0.0, self.height)
- RendererCairo.convert_path(ctx, tpath, affine)
- ctx.clip()
-
def _fill_and_stroke (self, ctx, fill_c, alpha):
if fill_c is not None:
ctx.save()
@@ -158,8 +142,6 @@
raise ValueError("The Cairo backend can not draw paths longer than 18980 points.")
ctx = gc.ctx
- ctx.save()
- self._do_clip(ctx, gc._cliprect, gc._clippath)
transform = transform + \
Affine2D().scale(1.0, -1.0).translate(0, self.height)
@@ -168,7 +150,6 @@
self.convert_path(ctx, path, transform)
self._fill_and_stroke(ctx, rgbFace, gc.get_alpha())
- ctx.restore()
def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None):
# bbox - not currently used
@@ -180,7 +161,7 @@
surface = cairo.ImageSurface.create_for_data (
buf, cairo.FORMAT_ARGB32, cols, rows, cols*4)
# function does not pass a 'gc' so use renderer.ctx
- ctx = self.ctx
+ ctx = self.gc.ctx
ctx.save()
if clippath is not None:
ctx.new_path()
@@ -297,9 +278,8 @@
def new_gc(self):
if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name())
- self.ctx.restore() # matches save() in set_ctx_from_surface()
- self.ctx.save()
- return GraphicsContextCairo (renderer=self)
+ self.gc.ctx.save()
+ return self.gc
def points_to_pixels(self, points):
@@ -324,9 +304,12 @@
def __init__(self, renderer):
GraphicsContextBase.__init__(self)
self.renderer = renderer
- self.ctx = renderer.ctx
+ def restore(self):
+ self.ctx.restore()
+
+
def set_alpha(self, alpha):
self._alpha = alpha
rgb = self._rgb
@@ -346,10 +329,23 @@
def set_clip_rectangle(self, rectangle):
- self._cliprect = rectangle
+ if not rectangle: return
+ x,y,w,h = rectangle.bounds
+ # pixel-aligned clip-regions are faster
+ x,y,w,h = round(x), round(y), round(w), round(h)
+ ctx = self.ctx
+ ctx.new_path()
+ ctx.rectangle (x, self.renderer.height - h - y, w, h)
+ ctx.clip ()
def set_clip_path(self, path):
- self._clippath = path
+ if not path: return
+ tpath, affine = path.get_transformed_path_and_affine()
+ ctx = self.ctx
+ ctx.new_path()
+ affine = affine + Affine2D().scale(1.0, -1.0).translate(0.0, self.renderer.height)
+ RendererCairo.convert_path(ctx, tpath, affine)
+ ctx.clip()
def set_dashes(self, offset, dashes):
self._dashes = offset, dashes
@@ -468,7 +464,7 @@
renderer = RendererCairo (self.figure.dpi)
renderer.set_width_height (width_in_points, height_in_points)
renderer.set_ctx_from_surface (surface)
- ctx = renderer.ctx
+ ctx = renderer.gc.ctx
if orientation == 'landscape':
ctx.rotate (npy.pi/2)
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtkcairo.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_gtkcairo.py 2009-05-17 14:54:57 UTC (rev 7111)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_gtkcairo.py 2009-05-17 15:08:07 UTC (rev 7112)
@@ -31,12 +31,10 @@
class RendererGTKCairo (backend_cairo.RendererCairo):
if gtk.pygtk_version >= (2,7,0):
def set_pixmap (self, pixmap):
- self.ctx = pixmap.cairo_create()
- self.ctx.save() # restore, save - when call new_gc()
+ self.gc.ctx = pixmap.cairo_create()
else:
def set_pixmap (self, pixmap):
- self.ctx = cairo.gtk.gdk_cairo_create (pixmap)
- self.ctx.save() # restore, save - when call new_gc()
+ self.gc.ctx = cairo.gtk.gdk_cairo_create (pixmap)
class FigureCanvasGTKCairo(backend_cairo.FigureCanvasCairo, FigureCanvasGTK):
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py 2009-05-17 14:54:57 UTC (rev 7111)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py 2009-05-17 15:08:07 UTC (rev 7112)
@@ -51,19 +51,11 @@
def draw_path(self, gc, path, transform, rgbFace=None):
if rgbFace is not None:
rgbFace = tuple(rgbFace)
- if gc!=self.gc:
- n = self.gc.level() - gc.level()
- for i in range(n): self.gc.restore()
- self.gc = gc
gc.draw_path(path, transform, rgbFace)
def draw_markers(self, gc, marker_path, marker_trans, path, trans, rgbFace=None):
if rgbFace is not None:
rgbFace = tuple(rgbFace)
- if gc!=self.gc:
- n = self.gc.level() - gc.level()
- for i in range(n): self.gc.restore()
- self.gc = gc
gc.draw_markers(marker_path, marker_trans, path, trans, rgbFace)
def draw_path_collection(self, *args):
@@ -76,7 +68,7 @@
gc.draw_quad_mesh(*args)
def new_gc(self):
- self.gc.reset()
+ self.gc.save()
self.gc.set_hatch(None)
return self.gc
@@ -87,10 +79,6 @@
im.flipud_out()
def draw_tex(self, gc, x, y, s, prop, angle):
- if gc!=self.gc:
- n = self.gc.level() - gc.level()
- for i in range(n): self.gc.restore()
- self.gc = gc
# todo, handle props, angle, origins
size = prop.get_size_in_points()
texmanager = self.get_texmanager()
@@ -103,19 +91,11 @@
gc.draw_mathtext(x, y, angle, Z)
def _draw_mathtext(self, gc, x, y, s, prop, angle):
- if gc!=self.gc:
- n = self.gc.level() - gc.level()
- for i in range(n): self.gc.restore()
- self.gc = gc
ox, oy, width, height, descent, image, used_characters = \
self.mathtext_parser.parse(s, self.dpi, prop)
gc.draw_mathtext(x, y, angle, 255 - image.as_array())
def draw_text(self, gc, x, y, s, prop, angle, ismath=False):
- if gc!=self.gc:
- n = self.gc.level() - gc.level()
- for i in range(n): self.gc.restore()
- self.gc = gc
if ismath:
self._draw_mathtext(gc, x, y, s, prop, angle)
else:
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py 2009-05-17 14:54:57 UTC (rev 7111)
+++ trunk/matplotlib/lib/matplotlib/lines.py 2009-05-17 15:08:07 UTC (rev 7112)
@@ -540,7 +540,9 @@
markerFunc = getattr(self, funcname)
markerFunc(renderer, gc, subsampled, affine.frozen())
+ gc.restore()
+ gc.restore()
renderer.close_group('line2d')
def get_antialiased(self): return self._antialiased
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py 2009-05-17 14:54:57 UTC (rev 7111)
+++ trunk/matplotlib/lib/matplotlib/patches.py 2009-05-17 15:08:07 UTC (rev 7112)
@@ -302,6 +302,7 @@
renderer.draw_path(gc, tpath, affine, rgbFace)
+ gc.restore()
renderer.close_group('patch')
def get_path(self):
@@ -3705,4 +3706,5 @@
renderer.draw_path(gc, p, affine, None)
+ gc.restore()
renderer.close_group('patch')
Modified: trunk/matplotlib/lib/matplotlib/text.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/text.py 2009-05-17 14:54:57 UTC (rev 7111)
+++ trunk/matplotlib/lib/matplotlib/text.py 2009-05-17 15:08:07 UTC (rev 7112)
@@ -507,6 +507,7 @@
self._fontproperties, angle,
ismath=ismath)
+ gc.restore()
renderer.close_group('text')
def get_color(self):
Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py
===================================================================
--- trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py 2009-05-17 14:54:57 UTC (rev 7111)
+++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/axislines.py 2009-05-17 15:08:07 UTC (rev 7112)
@@ -65,6 +65,7 @@
lineFunc = getattr(self, funcname)
lineFunc(renderer, gc, tpath, affine.frozen())
+ gc.restore()
renderer.close_group('line2d')
@@ -548,6 +549,7 @@
renderer.draw_markers(gc, self._tickvert_path, marker_transform,
Path(locs), path_trans.get_affine())
+ gc.restore()
Modified: trunk/matplotlib/src/_macosx.m
===================================================================
--- trunk/matplotlib/src/_macosx.m 2009-05-17 14:54:57 UTC (rev 7111)
+++ trunk/matplotlib/src/_macosx.m 2009-05-17 15:08:07 UTC (rev 7112)
@@ -374,6 +374,7 @@
PyObject_HEAD
CGContextRef cr;
NSSize size;
+ int level;
} GraphicsContext;
static CGMutablePathRef _create_path(void* iterator)
@@ -437,6 +438,7 @@
GraphicsContext* self = (GraphicsContext*)type->tp_alloc(type, 0);
if (!self) return NULL;
self->cr = NULL;
+ self->level = 0;
if (ngc==0)
{
@@ -467,7 +469,7 @@
}
static PyObject*
-GraphicsContext_reset (GraphicsContext* self)
+GraphicsContext_save (GraphicsContext* self)
{
CGContextRef cr = self->cr;
if (!cr)
@@ -475,9 +477,29 @@
PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL");
return NULL;
}
+ CGContextSaveGState(cr);
+ self->level++;
+ Py_INCREF(Py_None);
+ return Py_None;
+}
+static PyObject*
+GraphicsContext_restore (GraphicsContext* self)
+{
+ CGContextRef cr = self->cr;
+ if (!cr)
+ {
+ PyErr_SetString(PyExc_RuntimeError, "CGContextRef is NULL");
+ return NULL;
+ }
+ if (self->level==0)
+ {
+ PyErr_SetString(PyExc_RuntimeError,
+ "Attempting to execute CGContextRestoreGState on an empty stack");
+ return NULL;
+ }
CGContextRestoreGState(cr);
- CGContextSaveGState(cr);
+ self->level--;
Py_INCREF(Py_None);
return Py_None;
}
@@ -1543,11 +1565,15 @@
const double b = *(double*)PyArray_GETPTR2(facecolors, fi, 2);
const double a = *(double*)PyArray_GETPTR2(facecolors, fi, 3);
CGContextSetRGBFillColor(cr, r, g, b, a);
- CGContextDrawPath(cr, kCGPathFillStroke);
+ if (Nedgecolors > 0) CGContextDrawPath(cr, kCGPathFillStroke);
+ else CGContextFillPath(cr);
}
else if (Nfacecolors==1)
- CGContextDrawPath(cr, kCGPathFillStroke);
- else
+ {
+ if (Nedgecolors > 0) CGContextDrawPath(cr, kCGPathFillStroke);
+ else CGContextFillPath(cr);
+ }
+ else /* We checked Nedgecolors != 0 above */
CGContextStrokePath(cr);
CGContextRestoreGState(cr);
}
@@ -2480,11 +2506,16 @@
static PyMethodDef GraphicsContext_methods[] = {
- {"reset",
- (PyCFunction)GraphicsContext_reset,
+ {"save",
+ (PyCFunction)GraphicsContext_save,
METH_NOARGS,
- "Resets the current graphics context by restoring it from the stack and copying it back onto the stack."
+ "Saves the current graphics context onto the stack."
},
+ {"restore",
+ (PyCFunction)GraphicsContext_restore,
+ METH_NOARGS,
+ "Restores the current graphics context from the stack."
+ },
{"get_text_width_height_descent",
(PyCFunction)GraphicsContext_get_text_width_height_descent,
METH_VARARGS,
@@ -4293,17 +4324,14 @@
CGContextRef cr = (CGContextRef) [[NSGraphicsContext currentContext] graphicsPort];
gc->cr = cr;
+ gc->level = 0;
- CGContextSaveGState(cr);
- CGContextSetTextMatrix(cr, CGAffineTransformIdentity);
-
result = PyObject_CallMethod(figure, "draw", "O", renderer);
if(result)
Py_DECREF(result);
else
PyErr_Print();
- CGContextRestoreGState(cr);
gc->cr = nil;
if (!NSIsEmptyRect(rubberband)) NSFrameRect(rubberband);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-05-17 14:55:02
|
Revision: 7111
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7111&view=rev
Author: jdh2358
Date: 2009-05-17 14:54:57 +0000 (Sun, 17 May 2009)
Log Message:
-----------
Merged revisions 7106-7109 via svnmerge from
https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_98_5_maint
........
r7106 | jdh2358 | 2009-05-17 09:11:35 -0500 (Sun, 17 May 2009) | 1 line
tagging changelog for release
........
r7107 | jdh2358 | 2009-05-17 09:13:14 -0500 (Sun, 17 May 2009) | 1 line
removed some deprecation warnings from mlab
........
r7108 | jdh2358 | 2009-05-17 09:22:31 -0500 (Sun, 17 May 2009) | 1 line
tag changelog for release
........
r7109 | jdh2358 | 2009-05-17 09:51:09 -0500 (Sun, 17 May 2009) | 1 line
updated url in release doc
........
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/doc/devel/release_guide.rst
trunk/matplotlib/lib/matplotlib/mlab.py
Property Changed:
----------------
trunk/matplotlib/
Property changes on: trunk/matplotlib
___________________________________________________________________
Modified: svnmerge-integrated
- /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7082
+ /branches/v0_91_maint:1-6428 /branches/v0_98_5_maint:1-7110
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-05-17 14:52:47 UTC (rev 7110)
+++ trunk/matplotlib/CHANGELOG 2009-05-17 14:54:57 UTC (rev 7111)
@@ -1,10 +1,12 @@
======================================================================
-2009-05-13 An optional offset and bbox support in restore_bbox.
+2008-05-17 Release 0.98.5.3 at r7107 from the branch - JDH
+
+2009-05-13 An optional offset and bbox support in restore_bbox.
Add animation_blit_gtk2.py. -JJL
-2009-05-13 psfrag in backend_ps now uses baseline-alignment
+2009-05-13 psfrag in backend_ps now uses baseline-alignment
when preview.sty is used ((default is
- bottom-alignment). Also, a small api imporvement
+ bottom-alignment). Also, a small api imporvement
in OffsetBox-JJL
2009-05-13 When the x-coordinate of a line is monotonically
Modified: trunk/matplotlib/doc/devel/release_guide.rst
===================================================================
--- trunk/matplotlib/doc/devel/release_guide.rst 2009-05-17 14:52:47 UTC (rev 7110)
+++ trunk/matplotlib/doc/devel/release_guide.rst 2009-05-17 14:54:57 UTC (rev 7111)
@@ -120,7 +120,7 @@
sftp> put matplotlib-0.98.2.tar.gz
Uploading matplotlib-0.98.2.tar.gz to /incoming/j/jd/jdh2358/uploads/matplotlib-0.98.2.tar.gz
-* go https://sourceforge.net/project/admin/?group_id=80706 and do a
+* go https://sourceforge.net/project/admin/editpackages.php?group_id=80706 and do a
file release. Click on the "Admin" tab to log in as an admin, and
then the "File Releases" tab. Go to the bottom and click "add
release" and enter the package name but not the version number in
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2009-05-17 14:52:47 UTC (rev 7110)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2009-05-17 14:54:57 UTC (rev 7111)
@@ -275,11 +275,6 @@
pad_to = NFFT
if scale_by_freq is None:
- warnings.warn("psd, csd, and specgram have changed to scale their "
- "densities by the sampling frequency for better MatLab "
- "compatibility. You can pass scale_by_freq=False to disable "
- "this behavior. Also, one-sided densities are scaled by a "
- "factor of 2.")
scale_by_freq = True
# For real x, ignore the negative frequencies unless told otherwise
@@ -1884,8 +1879,6 @@
much faster.
"""
if typecode is not None:
- warnings.warn("Use dtype kwarg instead of typecode",
- DeprecationWarning)
dtype = typecode
iden = np.zeros((n,)*rank, dtype)
for i in range(n):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-05-17 14:52:48
|
Revision: 7110
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7110&view=rev
Author: jdh2358
Date: 2009-05-17 14:52:47 +0000 (Sun, 17 May 2009)
Log Message:
-----------
updated osx release num
Modified Paths:
--------------
trunk/matplotlib/release/osx/Makefile
Modified: trunk/matplotlib/release/osx/Makefile
===================================================================
--- trunk/matplotlib/release/osx/Makefile 2009-05-17 14:51:09 UTC (rev 7109)
+++ trunk/matplotlib/release/osx/Makefile 2009-05-17 14:52:47 UTC (rev 7110)
@@ -2,7 +2,7 @@
ZLIBVERSION=1.2.3
PNGVERSION=1.2.33
FREETYPEVERSION=2.3.7
-MPLVERSION=0.98.5.2
+MPLVERSION=0.98.5.3
MPLSRC=matplotlib-${MPLVERSION}
MACOSX_DEPLOYMENT_TARGET=10.4
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-05-17 14:51:17
|
Revision: 7109
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7109&view=rev
Author: jdh2358
Date: 2009-05-17 14:51:09 +0000 (Sun, 17 May 2009)
Log Message:
-----------
updated url in release doc
Modified Paths:
--------------
branches/v0_98_5_maint/doc/devel/release_guide.rst
Modified: branches/v0_98_5_maint/doc/devel/release_guide.rst
===================================================================
--- branches/v0_98_5_maint/doc/devel/release_guide.rst 2009-05-17 14:22:31 UTC (rev 7108)
+++ branches/v0_98_5_maint/doc/devel/release_guide.rst 2009-05-17 14:51:09 UTC (rev 7109)
@@ -75,7 +75,7 @@
sftp> put matplotlib-0.98.2.tar.gz
Uploading matplotlib-0.98.2.tar.gz to /incoming/j/jd/jdh2358/uploads/matplotlib-0.98.2.tar.gz
-* go https://sourceforge.net/project/admin/?group_id=80706 and do a
+* go https://sourceforge.net/project/admin/editpackages.php?group_id=80706 and do a
file release. Click on the "Admin" tab to log in as an admin, and
then the "File Releases" tab. Go to the bottom and click "add
release" and enter the package name but not the version number in
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-05-17 14:22:33
|
Revision: 7108
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7108&view=rev
Author: jdh2358
Date: 2009-05-17 14:22:31 +0000 (Sun, 17 May 2009)
Log Message:
-----------
tag changelog for release
Modified Paths:
--------------
branches/v0_98_5_maint/CHANGELOG
Modified: branches/v0_98_5_maint/CHANGELOG
===================================================================
--- branches/v0_98_5_maint/CHANGELOG 2009-05-17 14:13:14 UTC (rev 7107)
+++ branches/v0_98_5_maint/CHANGELOG 2009-05-17 14:22:31 UTC (rev 7108)
@@ -1,5 +1,5 @@
======================================================================
-2008-05-17 Release 0.98.5.3 at r7105
+2008-05-17 Release 0.98.5.3 at r7107
2009-05-04 Fix bug that Text.Annotation is still drawn while set to
not visible.-JJL
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-05-17 14:13:22
|
Revision: 7107
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7107&view=rev
Author: jdh2358
Date: 2009-05-17 14:13:14 +0000 (Sun, 17 May 2009)
Log Message:
-----------
removed some deprecation warnings from mlab
Modified Paths:
--------------
branches/v0_98_5_maint/lib/matplotlib/mlab.py
Modified: branches/v0_98_5_maint/lib/matplotlib/mlab.py
===================================================================
--- branches/v0_98_5_maint/lib/matplotlib/mlab.py 2009-05-17 14:11:35 UTC (rev 7106)
+++ branches/v0_98_5_maint/lib/matplotlib/mlab.py 2009-05-17 14:13:14 UTC (rev 7107)
@@ -272,11 +272,6 @@
pad_to = NFFT
if scale_by_freq is None:
- warnings.warn("psd, csd, and specgram have changed to scale their "
- "densities by the sampling frequency for better MatLab "
- "compatibility. You can pass scale_by_freq=False to disable "
- "this behavior. Also, one-sided densities are scaled by a "
- "factor of 2.")
scale_by_freq = True
# For real x, ignore the negative frequencies unless told otherwise
@@ -1880,8 +1875,6 @@
much faster.
"""
if typecode is not None:
- warnings.warn("Use dtype kwarg instead of typecode",
- DeprecationWarning)
dtype = typecode
iden = np.zeros((n,)*rank, dtype)
for i in range(n):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-05-17 14:11:46
|
Revision: 7106
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7106&view=rev
Author: jdh2358
Date: 2009-05-17 14:11:35 +0000 (Sun, 17 May 2009)
Log Message:
-----------
tagging changelog for release
Modified Paths:
--------------
branches/v0_98_5_maint/CHANGELOG
Modified: branches/v0_98_5_maint/CHANGELOG
===================================================================
--- branches/v0_98_5_maint/CHANGELOG 2009-05-16 12:47:27 UTC (rev 7105)
+++ branches/v0_98_5_maint/CHANGELOG 2009-05-17 14:11:35 UTC (rev 7106)
@@ -1,9 +1,9 @@
======================================================================
-2009-05-04 Fix bug that Text.Annotation is still drawn while set to
+2008-05-17 Release 0.98.5.3 at r7105
+
+2009-05-04 Fix bug that Text.Annotation is still drawn while set to
not visible.-JJL
-2008-04-12 Release 0.98.5.3 at r7038
-
2009-04-06 The pdf backend now escapes newlines and linefeeds in strings.
Fixes sf bug #2708559; thanks to Tiago Pereira for the report.
@@ -11,7 +11,7 @@
create an output file. Thanks to Joao Luis Silva for reporting
this. - JKS
-2009-04-05 _png.read_png() reads 12 bit PNGs (patch from
+2009-04-05 _png.read_png() reads 12 bit PNGs (patch from
Tobias Wood) - ADS
2009-03-17 Fix bugs in edge color handling by contourf, found
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-05-16 12:47:40
|
Revision: 7105
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7105&view=rev
Author: jdh2358
Date: 2009-05-16 12:47:27 +0000 (Sat, 16 May 2009)
Log Message:
-----------
fixed plot_date docstring
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-05-16 02:22:57 UTC (rev 7104)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-05-16 12:47:27 UTC (rev 7105)
@@ -3512,13 +3512,13 @@
may be necessary to set the formatters/locators after the call
to :meth:`plot_date` since :meth:`plot_date` will set the
default tick locator to
- :class:`matplotlib.ticker.AutoDateLocator` (if the tick
+ :class:`matplotlib.dates.AutoDateLocator` (if the tick
locator is not already set to a
- :class:`matplotlib.ticker.DateLocator` instance) and the
+ :class:`matplotlib.dates.DateLocator` instance) and the
default tick formatter to
- :class:`matplotlib.ticker.AutoDateFormatter` (if the tick
+ :class:`matplotlib.dates.AutoDateFormatter` (if the tick
formatter is not already set to a
- :class:`matplotlib.ticker.DateFormatter` instance).
+ :class:`matplotlib.dates.DateFormatter` instance).
Valid kwargs are :class:`~matplotlib.lines.Line2D` properties:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2009-05-16 02:22:59
|
Revision: 7104
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7104&view=rev
Author: efiring
Date: 2009-05-16 02:22:57 +0000 (Sat, 16 May 2009)
Log Message:
-----------
Make quiver handle nans and infs
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/quiver.py
Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py 2009-05-16 01:01:49 UTC (rev 7103)
+++ trunk/matplotlib/lib/matplotlib/quiver.py 2009-05-16 02:22:57 UTC (rev 7104)
@@ -388,9 +388,9 @@
X, Y, U, V, C = [None]*5
args = list(args)
if len(args) == 3 or len(args) == 5:
- C = ma.asarray(args.pop(-1))
- V = ma.asarray(args.pop(-1))
- U = ma.asarray(args.pop(-1))
+ C = ma.masked_invalid(args.pop(-1), copy=False)
+ V = ma.masked_invalid(args.pop(-1), copy=False)
+ U = ma.masked_invalid(args.pop(-1), copy=False)
if U.ndim == 1:
nr, nc = 1, U.shape[0]
else:
@@ -483,7 +483,8 @@
elif self.angles == 'uv':
theta = np.angle(uv.filled(0))
else:
- theta = ma.asarray(self.angles).filled(0)*np.pi/180.0
+ theta = ma.masked_invalid(self.angles, copy=False).filled(0)
+ theta *= (np.pi/180.0)
theta.shape = (theta.shape[0], 1) # for broadcasting
xy = (X+Y*1j) * np.exp(1j*theta)*self.width
xy = xy[:,:,np.newaxis]
@@ -919,9 +920,9 @@
X, Y, U, V, C = [None]*5
args = list(args)
if len(args) == 3 or len(args) == 5:
- C = ma.asarray(args.pop(-1)).ravel()
- V = ma.asarray(args.pop(-1))
- U = ma.asarray(args.pop(-1))
+ C = ma.masked_invalid(args.pop(-1), copy=False).ravel()
+ V = ma.masked_invalid(args.pop(-1), copy=False)
+ U = ma.masked_invalid(args.pop(-1), copy=False)
nn = np.shape(U)
nc = nn[0]
nr = 1
@@ -937,10 +938,10 @@
return X, Y, U, V, C
def set_UVC(self, U, V, C=None):
- self.u = ma.asarray(U).ravel()
- self.v = ma.asarray(V).ravel()
+ self.u = ma.masked_invalid(U, copy=False).ravel()
+ self.v = ma.masked_invalid(V, copy=False).ravel()
if C is not None:
- c = ma.asarray(C).ravel()
+ c = ma.masked_invalid(C, copy=False).ravel()
x,y,u,v,c = delete_masked_points(self.x.ravel(), self.y.ravel(),
self.u, self.v, c)
else:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2009-05-16 01:01:56
|
Revision: 7103
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7103&view=rev
Author: efiring
Date: 2009-05-16 01:01:49 +0000 (Sat, 16 May 2009)
Log Message:
-----------
Fixed bugs in quiver affecting angles passed in as a sequence
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/quiver.py
Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py 2009-05-14 06:27:58 UTC (rev 7102)
+++ trunk/matplotlib/lib/matplotlib/quiver.py 2009-05-16 01:01:49 UTC (rev 7103)
@@ -479,11 +479,12 @@
length = a/(self.scale*self.width)
X, Y = self._h_arrows(length)
if self.angles == 'xy':
- theta = self._angles(U, V).filled(0)[:,np.newaxis]
+ theta = self._angles(U, V).filled(0)
elif self.angles == 'uv':
- theta = np.angle(ma.asarray(uv[..., np.newaxis]).filled(0))
+ theta = np.angle(uv.filled(0))
else:
- theta = ma.asarray(self.angles*np.pi/180.0).filled(0)
+ theta = ma.asarray(self.angles).filled(0)*np.pi/180.0
+ theta.shape = (theta.shape[0], 1) # for broadcasting
xy = (X+Y*1j) * np.exp(1j*theta)*self.width
xy = xy[:,:,np.newaxis]
XY = ma.concatenate((xy.real, xy.imag), axis=2)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-05-14 06:28:11
|
Revision: 7102
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7102&view=rev
Author: leejjoon
Date: 2009-05-14 06:27:58 +0000 (Thu, 14 May 2009)
Log Message:
-----------
An optional offset and bbox support in restore_bbox
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
trunk/matplotlib/src/_backend_agg.cpp
trunk/matplotlib/src/_backend_agg.h
Added Paths:
-----------
trunk/matplotlib/examples/animation/animation_blit_gtk2.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-05-14 04:00:38 UTC (rev 7101)
+++ trunk/matplotlib/CHANGELOG 2009-05-14 06:27:58 UTC (rev 7102)
@@ -1,4 +1,7 @@
======================================================================
+2009-05-13 An optional offset and bbox support in restore_bbox.
+ Add animation_blit_gtk2.py. -JJL
+
2009-05-13 psfrag in backend_ps now uses baseline-alignment
when preview.sty is used ((default is
bottom-alignment). Also, a small api imporvement
Added: trunk/matplotlib/examples/animation/animation_blit_gtk2.py
===================================================================
--- trunk/matplotlib/examples/animation/animation_blit_gtk2.py (rev 0)
+++ trunk/matplotlib/examples/animation/animation_blit_gtk2.py 2009-05-14 06:27:58 UTC (rev 7102)
@@ -0,0 +1,167 @@
+#!/usr/bin/env python
+
+"""
+This example utlizes restore_region with optional bbox and xy
+arguments. The plot is continuously shifted to the left. Instead of
+drawing everything again, the plot is saved (copy_from_bbox) and
+restored with offset by the amount of the shift. And only newly
+exposed area is drawn. This technique may reduce drawing time for some cases.
+"""
+
+import time
+
+import gtk, gobject
+
+import matplotlib
+matplotlib.use('GTKAgg')
+
+import numpy as np
+import matplotlib.pyplot as plt
+
+class UpdateLine(object):
+ def get_bg_bbox(self):
+
+ return self.ax.bbox.padded(-3)
+
+ def __init__(self, canvas, ax):
+ self.cnt = 0
+ self.canvas = canvas
+ self.ax = ax
+
+ self.prev_time = time.time()
+ self.start_time = self.prev_time
+ self.prev_pixel_offset = 0.
+
+
+ self.x0 = 0
+ self.phases = np.random.random_sample((20,)) * np.pi * 2
+ self.line, = ax.plot([], [], "-", animated=True, lw=2)
+
+ self.point, = ax.plot([], [], "ro", animated=True, lw=2)
+
+ self.ax.set_ylim(-1.1, 1.1)
+
+ self.background1 = None
+
+ cmap = plt.cm.jet
+ from itertools import cycle
+ self.color_cycle = cycle(cmap(np.arange(cmap.N)))
+
+
+ def save_bg(self):
+ self.background1 = self.canvas.copy_from_bbox(self.ax.get_figure().bbox)
+
+ self.background2 = self.canvas.copy_from_bbox(self.get_bg_bbox())
+
+
+ def get_dx_data(self, dx_pixel):
+ tp = self.ax.transData.inverted().transform_point
+ x0, y0 = tp((0, 0))
+ x1, y1 = tp((dx_pixel, 0))
+ return (x1-x0)
+
+
+ def restore_background_shifted(self, dx_pixel):
+ """
+ restore bacground shifted by dx in data coordinate. This only
+ works if the data coordinate system is linear.
+ """
+
+ # restore the clean slate background
+ self.canvas.restore_region(self.background1)
+
+ # restore subregion (x1+dx, y1, x2, y2) of the second bg
+ # in a offset position (x1-dx, y1)
+ x1, y1, x2, y2 = self.background2.get_extents()
+ self.canvas.restore_region(self.background2,
+ bbox=(x1+dx_pixel, y1, x2, y2),
+ xy=(x1-dx_pixel, y1))
+
+ return dx_pixel
+
+ def on_draw(self, *args):
+ self.save_bg()
+ return False
+
+ def update_line(self, *args):
+
+ if self.background1 is None:
+ return True
+
+ cur_time = time.time()
+ pixel_offset = int((cur_time - self.start_time)*100.)
+ dx_pixel = pixel_offset - self.prev_pixel_offset
+ self.prev_pixel_offset = pixel_offset
+ dx_data = self.get_dx_data(dx_pixel) #cur_time - self.prev_time)
+
+ x0 = self.x0
+ self.x0 += dx_data
+ self.prev_time = cur_time
+
+ self.ax.set_xlim(self.x0-2, self.x0+0.1)
+
+
+ # restore background which will plot lines from previous plots
+ self.restore_background_shifted(dx_pixel) #x0, self.x0)
+ # This restores lines between [x0-2, x0]
+
+
+
+ self.line.set_color(self.color_cycle.next())
+
+ # now plot line segment within [x0, x0+dx_data],
+ # Note that we're only plotting a line between [x0, x0+dx_data].
+ xx = np.array([x0, self.x0])
+ self.line.set_xdata(xx)
+
+ # the for loop below could be improved by using collection.
+ [(self.line.set_ydata(np.sin(xx+p)),
+ self.ax.draw_artist(self.line)) \
+ for p in self.phases]
+
+ self.background2 = canvas.copy_from_bbox(self.get_bg_bbox())
+
+ self.point.set_xdata([self.x0])
+
+ [(self.point.set_ydata(np.sin([self.x0+p])),
+ self.ax.draw_artist(self.point)) \
+ for p in self.phases]
+
+
+ self.ax.draw_artist(self.ax.xaxis)
+ self.ax.draw_artist(self.ax.yaxis)
+
+ self.canvas.blit(self.ax.get_figure().bbox)
+
+
+ dt = (time.time()-tstart)
+ if dt>15:
+ # print the timing info and quit
+ print 'FPS:' , self.cnt/dt
+ gtk.main_quit()
+ raise SystemExit
+
+ self.cnt += 1
+ return True
+
+
+plt.rcParams["text.usetex"] = False
+fig = plt.figure()
+
+ax = fig.add_subplot(111)
+ax.xaxis.set_animated(True)
+ax.yaxis.set_animated(True)
+canvas = fig.canvas
+
+fig.subplots_adjust(left=0.2, bottom=0.2)
+canvas.draw()
+
+# for profiling
+tstart = time.time()
+
+ul = UpdateLine(canvas, ax)
+gobject.idle_add(ul.update_line)
+
+canvas.mpl_connect('draw_event', ul.on_draw)
+
+plt.show()
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2009-05-14 04:00:38 UTC (rev 7101)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2009-05-14 06:27:58 UTC (rev 7102)
@@ -33,7 +33,7 @@
from matplotlib.ft2font import FT2Font, LOAD_FORCE_AUTOHINT
from matplotlib.mathtext import MathTextParser
from matplotlib.path import Path
-from matplotlib.transforms import Bbox
+from matplotlib.transforms import Bbox, BboxBase
from _backend_agg import RendererAgg as _RendererAgg
from matplotlib import _png
@@ -65,7 +65,6 @@
self.draw_quad_mesh = self._renderer.draw_quad_mesh
self.draw_image = self._renderer.draw_image
self.copy_from_bbox = self._renderer.copy_from_bbox
- self.restore_region = self._renderer.restore_region
self.tostring_rgba_minimized = self._renderer.tostring_rgba_minimized
self.mathtext_parser = MathTextParser('Agg')
@@ -239,7 +238,39 @@
# with the Agg backend
return True
+ def restore_region(self, region, bbox=None, xy=None):
+ """
+ restore the saved region. if bbox (instance of BboxBase, or
+ its extents) is given, only the region specified by the bbox
+ will be restored. *xy* (a tuple of two floasts) optionally
+ specify the new position (of the LLC of the originally region,
+ not the LLC of the bbox) that the region will be restored.
+ >>> region = renderer.copy_from_bbox()
+ >>> x1, y1, x2, y2 = region.get_extents()
+ >>> renderer.restore_region(region, bbox=(x1+dx, y1, x2, y2),
+ xy=(x1-dx, y1))
+
+ """
+ if bbox is not None or xy is not None:
+ if bbox is None:
+ x1, y1, x2, y2 = region.get_extents()
+ elif isinstance(bbox, BboxBase):
+ x1, y1, x2, y2 = bbox.extents
+ else:
+ x1, y1, x2, y2 = bbox
+
+ if xy is None:
+ ox, oy = x1, y1
+ else:
+ ox, oy = xy
+
+ self._renderer.restore_region2(region, x1, y1, x2, y2, ox, oy)
+
+ else:
+ self._renderer.restore_region(region)
+
+
def new_figure_manager(num, *args, **kwargs):
"""
Create a new figure manager instance
@@ -269,9 +300,9 @@
renderer = self.get_renderer()
return renderer.copy_from_bbox(bbox)
- def restore_region(self, region):
+ def restore_region(self, region, bbox=None, xy=None):
renderer = self.get_renderer()
- return renderer.restore_region(region)
+ return renderer.restore_region(region, bbox, xy)
def draw(self):
"""
@@ -334,3 +365,4 @@
renderer.width, renderer.height,
filename_or_obj, self.figure.dpi)
renderer.dpi = original_dpi
+
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2009-05-14 04:00:38 UTC (rev 7101)
+++ trunk/matplotlib/src/_backend_agg.cpp 2009-05-14 06:27:58 UTC (rev 7102)
@@ -104,6 +104,18 @@
return Py::Object();
}
+Py::Object BufferRegion::get_extents(const Py::Tuple &args) {
+ args.verify_length(0);
+
+ Py::Tuple extents(4);
+ extents[0] = Py::Int(rect.x1);
+ extents[1] = Py::Int(rect.y1);
+ extents[2] = Py::Int(rect.x2);
+ extents[3] = Py::Int(rect.y2);
+
+ return extents;
+}
+
Py::Object BufferRegion::to_string_argb(const Py::Tuple &args) {
// owned=true to prevent memory leak
Py_ssize_t length;
@@ -426,6 +438,49 @@
return Py::Object();
}
+// Restore the part of the saved region with offsets
+Py::Object
+RendererAgg::restore_region2(const Py::Tuple& args) {
+ //copy BufferRegion to buffer
+ args.verify_length(7);
+
+
+
+ int x(0),y(0), xx1(0),yy1(0), xx2(0), yy2(0);
+ try {
+ xx1 = Py::Int( args[1] );
+ yy1 = Py::Int( args[2] );
+ xx2 = Py::Int( args[3] );
+ yy2 = Py::Int( args[4] );
+ x = Py::Int( args[5] );
+ y = Py::Int( args[6] );
+ }
+ catch (Py::TypeError) {
+ throw Py::TypeError("Invalid input arguments to draw_text_image");
+ }
+
+
+ BufferRegion* region = static_cast<BufferRegion*>(args[0].ptr());
+
+ if (region->data==NULL)
+ throw Py::ValueError("Cannot restore_region from NULL data");
+
+ agg::rect_i rect(xx1-region->rect.x1, (yy1-region->rect.y1),
+ xx2-region->rect.x1, (yy2-region->rect.y1));
+
+
+ agg::rendering_buffer rbuf;
+ rbuf.attach(region->data,
+ region->width,
+ region->height,
+ region->stride);
+
+ rendererBase.copy_from(rbuf, &rect, x, y);
+
+ return Py::Object();
+}
+
+
bool RendererAgg::render_clippath(const Py::Object& clippath, const agg::trans_affine& clippath_trans) {
typedef agg::conv_transform<PathIterator> transformed_path_t;
typedef agg::conv_curve<transformed_path_t> curve_t;
@@ -1717,6 +1772,9 @@
add_varargs_method("set_y", &BufferRegion::set_y,
"set_y(y)");
+ add_varargs_method("get_extents", &BufferRegion::get_extents,
+ "get_extents()");
+
add_varargs_method("to_string", &BufferRegion::to_string,
"to_string()");
add_varargs_method("to_string_argb", &BufferRegion::to_string_argb,
@@ -1759,6 +1817,8 @@
"copy_from_bbox(bbox)");
add_varargs_method("restore_region", &RendererAgg::restore_region,
"restore_region(region)");
+ add_varargs_method("restore_region2", &RendererAgg::restore_region2,
+ "restore_region(region, x1, y1, x2, y2, x3, y3)");
}
extern "C"
Modified: trunk/matplotlib/src/_backend_agg.h
===================================================================
--- trunk/matplotlib/src/_backend_agg.h 2009-05-14 04:00:38 UTC (rev 7101)
+++ trunk/matplotlib/src/_backend_agg.h 2009-05-14 06:27:58 UTC (rev 7102)
@@ -87,6 +87,8 @@
Py::Object set_x(const Py::Tuple &args);
Py::Object set_y(const Py::Tuple &args);
+ Py::Object get_extents(const Py::Tuple &args);
+
Py::Object to_string(const Py::Tuple &args);
Py::Object to_string_argb(const Py::Tuple &args);
static void init_type(void);
@@ -174,6 +176,7 @@
Py::Object copy_from_bbox(const Py::Tuple & args);
Py::Object restore_region(const Py::Tuple & args);
+ Py::Object restore_region2(const Py::Tuple & args);
virtual ~RendererAgg();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-05-14 04:00:41
|
Revision: 7101
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7101&view=rev
Author: leejjoon
Date: 2009-05-14 04:00:38 +0000 (Thu, 14 May 2009)
Log Message:
-----------
psfrag in backend_ps now uses baseline-alignment when preview.sty is used
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
trunk/matplotlib/lib/matplotlib/offsetbox.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-05-13 19:59:16 UTC (rev 7100)
+++ trunk/matplotlib/CHANGELOG 2009-05-14 04:00:38 UTC (rev 7101)
@@ -1,4 +1,9 @@
======================================================================
+2009-05-13 psfrag in backend_ps now uses baseline-alignment
+ when preview.sty is used ((default is
+ bottom-alignment). Also, a small api imporvement
+ in OffsetBox-JJL
+
2009-05-13 When the x-coordinate of a line is monotonically
increasing, it is now automatically clipped at
the stage of generating the transformed path in
@@ -6,7 +11,7 @@
panning when one is looking at a short segment of
a long time series, for example. - EF
-2009-05-11 aspect=1 in log-log plot gives square decades.
+2009-05-11 aspect=1 in log-log plot gives square decades. -JJL
2009-05-08 clabel takes new kwarg, rightside_up; if False, labels
will not be flipped to keep them rightside-up. This
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2009-05-13 19:59:16 UTC (rev 7100)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2009-05-14 04:00:38 UTC (rev 7101)
@@ -537,8 +537,6 @@
"""
w, h, bl = self.get_text_width_height_descent(s, prop, ismath)
fontsize = prop.get_size_in_points()
- 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()[:3]
fontcmd = {'sans-serif' : r'{\sffamily %s}',
@@ -546,7 +544,17 @@
rcParams['font.family'], r'{\rmfamily %s}')
s = fontcmd % s
tex = r'\color[rgb]{%s} %s' % (color, s)
- self.psfrag.append(r'\psfrag{%s}[bl][bl][1][%f]{\fontsize{%f}{%f}%s}'%(thetext, angle, fontsize, fontsize*1.25, tex))
+
+ corr = 0#w/2*(fontsize-10)/10
+ if rcParams['text.latex.preview']:
+ # use baseline alignment!
+ pos = _nums_to_str(x-corr, y+bl)
+ self.psfrag.append(r'\psfrag{%s}[Bl][Bl][1][%f]{\fontsize{%f}{%f}%s}'%(thetext, angle, fontsize, fontsize*1.25, tex))
+ else:
+ # stick to the bottom alignment, but this may give incorrect baseline some times.
+ pos = _nums_to_str(x-corr, y)
+ self.psfrag.append(r'\psfrag{%s}[bl][bl][1][%f]{\fontsize{%f}{%f}%s}'%(thetext, angle, fontsize, fontsize*1.25, tex))
+
ps = """\
gsave
%(pos)s moveto
Modified: trunk/matplotlib/lib/matplotlib/offsetbox.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/offsetbox.py 2009-05-13 19:59:16 UTC (rev 7100)
+++ trunk/matplotlib/lib/matplotlib/offsetbox.py 2009-05-14 04:00:38 UTC (rev 7101)
@@ -782,11 +782,14 @@
explicitly specify the bbox_to_anchor.
"""
+ zorder = 5 # zorder of the legend
+
def __init__(self, loc,
pad=0.4, borderpad=0.5,
child=None, prop=None, frameon=True,
bbox_to_anchor=None,
- bbox_transform=None):
+ bbox_transform=None,
+ **kwargs):
"""
loc is a string or an integer specifying the legend location.
The valid location codes are::
@@ -819,7 +822,7 @@
"""
- super(AnchoredOffsetbox, self).__init__()
+ super(AnchoredOffsetbox, self).__init__(**kwargs)
self.set_bbox_to_anchor(bbox_to_anchor, bbox_transform)
self.set_child(child)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2009-05-13 19:59:28
|
Revision: 7100
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7100&view=rev
Author: efiring
Date: 2009-05-13 19:59:16 +0000 (Wed, 13 May 2009)
Log Message:
-----------
Experimental clipping of Line _transformed_path to speed zoom and pan.
This can be modified to work with x monotonically decreasing, but
for a first try it works only with x monotonically increasing.
The intention is to greatly speed up zooming and panning into
a small segment of a very long time series (e.g., 10^6 points)
without incurring any significant speed penalty in other situations.
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/lines.py
trunk/matplotlib/lib/matplotlib/path.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-05-12 19:35:25 UTC (rev 7099)
+++ trunk/matplotlib/CHANGELOG 2009-05-13 19:59:16 UTC (rev 7100)
@@ -1,4 +1,11 @@
======================================================================
+2009-05-13 When the x-coordinate of a line is monotonically
+ increasing, it is now automatically clipped at
+ the stage of generating the transformed path in
+ the draw method; this greatly speeds up zooming and
+ panning when one is looking at a short segment of
+ a long time series, for example. - EF
+
2009-05-11 aspect=1 in log-log plot gives square decades.
2009-05-08 clabel takes new kwarg, rightside_up; if False, labels
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-05-12 19:35:25 UTC (rev 7099)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-05-13 19:59:16 UTC (rev 7100)
@@ -765,7 +765,10 @@
self.xaxis.get_transform(), self.yaxis.get_transform()))
if hasattr(self, "lines"):
for line in self.lines:
- line._transformed_path.invalidate()
+ try:
+ line._transformed_path.invalidate()
+ except AttributeError:
+ pass
def get_position(self, original=False):
'Return the a copy of the axes rectangle as a Bbox'
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py 2009-05-12 19:35:25 UTC (rev 7099)
+++ trunk/matplotlib/lib/matplotlib/lines.py 2009-05-13 19:59:16 UTC (rev 7100)
@@ -440,12 +440,22 @@
self._x = self._xy[:, 0] # just a view
self._y = self._xy[:, 1] # just a view
- # Masked arrays are now handled by the Path class itself
+ self._subslice = False
+ if len(x) > 100 and self._is_sorted(x):
+ self._subslice = True
self._path = Path(self._xy)
- self._transformed_path = TransformedPath(self._path, self.get_transform())
-
+ self._transformed_path = None
self._invalid = False
+ def _transform_path(self, subslice=None):
+ # Masked arrays are now handled by the Path class itself
+ if subslice is not None:
+ _path = Path(self._xy[subslice,:])
+ else:
+ _path = self._path
+ self._transformed_path = TransformedPath(_path, self.get_transform())
+
+
def set_transform(self, t):
"""
set the Transformation instance used by this artist
@@ -454,7 +464,6 @@
"""
Artist.set_transform(self, t)
self._invalid = True
- # self._transformed_path = TransformedPath(self._path, self.get_transform())
def _is_sorted(self, x):
"return true if x is sorted"
@@ -465,7 +474,15 @@
def draw(self, renderer):
if self._invalid:
self.recache()
-
+ if self._subslice:
+ # Need to handle monotonically decreasing case also...
+ x0, x1 = self.axes.get_xbound()
+ i0, = self._x.searchsorted([x0], 'left')
+ i1, = self._x.searchsorted([x1], 'right')
+ subslice = slice(max(i0-1, 0), i1+1)
+ self._transform_path(subslice)
+ if self._transformed_path is None:
+ self._transform_path()
renderer.open_group('line2d', self.get_gid())
if not self._visible: return
Modified: trunk/matplotlib/lib/matplotlib/path.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/path.py 2009-05-12 19:35:25 UTC (rev 7099)
+++ trunk/matplotlib/lib/matplotlib/path.py 2009-05-13 19:59:16 UTC (rev 7100)
@@ -118,7 +118,10 @@
(len(vertices) >= 128 and
(codes is None or np.all(codes <= Path.LINETO))))
self.simplify_threshold = rcParams['path.simplify_threshold']
- self.has_nonfinite = not np.isfinite(vertices).all()
+ # The following operation takes most of the time in this
+ # initialization, and it does not appear to be used anywhere;
+ # if it is occasionally needed, it could be made a property.
+ #self.has_nonfinite = not np.isfinite(vertices).all()
self.codes = codes
self.vertices = vertices
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-05-12 19:35:36
|
Revision: 7099
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7099&view=rev
Author: leejjoon
Date: 2009-05-12 19:35:25 +0000 (Tue, 12 May 2009)
Log Message:
-----------
fixed a few bugs introduced in r7098(aspect for log-log plot).
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/axes.py
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-05-12 04:12:07 UTC (rev 7098)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-05-12 19:35:25 UTC (rev 7099)
@@ -524,6 +524,8 @@
self.set_label(label)
self.set_figure(fig)
+ self.set_axes_locator(kwargs.get("axes_locator", None))
+
# this call may differ for non-sep axes, eg polar
self._init_axis()
@@ -548,7 +550,6 @@
self.set_navigate(True)
self.set_navigate_mode(None)
- self._axes_locator = None
if xscale:
self.set_xscale(xscale)
@@ -1085,7 +1086,7 @@
raise ValueError('argument must be among %s' %
', '.join(mtransforms.BBox.coefs.keys()))
- def get_data_ratio(self, mode="linear"):
+ def get_data_ratio(self):
"""
Returns the aspect ratio of the raw data.
@@ -1095,16 +1096,26 @@
xmin,xmax = self.get_xbound()
ymin,ymax = self.get_ybound()
- if mode == "log":
- xsize = max(math.fabs(math.log10(xmax)-math.log10(xmin)), 1e-30)
- ysize = max(math.fabs(math.log10(ymax)-math.log10(ymin)), 1e-30)
- else:
- xsize = max(math.fabs(xmax-xmin), 1e-30)
- ysize = max(math.fabs(ymax-ymin), 1e-30)
+ xsize = max(math.fabs(xmax-xmin), 1e-30)
+ ysize = max(math.fabs(ymax-ymin), 1e-30)
return ysize/xsize
+ def get_data_ratio_log(self):
+ """
+ Returns the aspect ratio of the raw data in log scale.
+ Will be used when both axis scales are in log.
+ """
+ xmin,xmax = self.get_xbound()
+ ymin,ymax = self.get_ybound()
+
+ xsize = max(math.fabs(math.log10(xmax)-math.log10(xmin)), 1e-30)
+ ysize = max(math.fabs(math.log10(ymax)-math.log10(ymin)), 1e-30)
+
+ return ysize/xsize
+
+
def apply_aspect(self, position=None):
'''
Use :meth:`_aspect` and :meth:`_adjustable` to modify the
@@ -1121,11 +1132,14 @@
aspect_scale_mode = "linear"
elif xscale == "log" and yscale == "log":
aspect_scale_mode = "log"
- else:
+ elif (xscale == "linear" and yscale == "log") or \
+ (xscale == "log" and yscale == "linear"):
warnings.warn(
'aspect is not supported for Axes with xscale=%s, yscale=%s' \
% (xscale, yscale))
aspect = "auto"
+ else: # some custom projections have their own scales.
+ pass
if aspect == 'auto':
self.set_position( position , which='active')
@@ -1147,7 +1161,10 @@
figW,figH = self.get_figure().get_size_inches()
fig_aspect = figH/figW
if self._adjustable == 'box':
- box_aspect = A * self.get_data_ratio(mode=aspect_scale_mode)
+ if aspect_scale_mode == "log":
+ box_aspect = A * self.get_data_ratio_log()
+ else:
+ box_aspect = A * self.get_data_ratio()
pb = position.frozen()
pb1 = pb.shrunk_to_aspect(box_aspect, pb, fig_aspect)
self.set_position(pb1.anchored(self.get_anchor(), pb), 'active')
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-05-12 04:12:11
|
Revision: 7098
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7098&view=rev
Author: leejjoon
Date: 2009-05-12 04:12:07 +0000 (Tue, 12 May 2009)
Log Message:
-----------
aspect for log-log plot
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/axes.py
Added Paths:
-----------
trunk/matplotlib/examples/pylab_examples/aspect_loglog.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-05-08 19:04:34 UTC (rev 7097)
+++ trunk/matplotlib/CHANGELOG 2009-05-12 04:12:07 UTC (rev 7098)
@@ -1,4 +1,6 @@
======================================================================
+2009-05-11 aspect=1 in log-log plot gives square decades.
+
2009-05-08 clabel takes new kwarg, rightside_up; if False, labels
will not be flipped to keep them rightside-up. This
allows the use of clabel to make streamfunction arrows,
Added: trunk/matplotlib/examples/pylab_examples/aspect_loglog.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/aspect_loglog.py (rev 0)
+++ trunk/matplotlib/examples/pylab_examples/aspect_loglog.py 2009-05-12 04:12:07 UTC (rev 7098)
@@ -0,0 +1,22 @@
+import matplotlib.pyplot as plt
+
+ax1 = plt.subplot(121)
+ax1.set_xscale("log")
+ax1.set_yscale("log")
+ax1.set_xlim(1e1, 1e3)
+ax1.set_ylim(1e2, 1e3)
+ax1.set_aspect(1)
+ax1.set_title("adjustable = box")
+
+ax2 = plt.subplot(122)
+ax2.set_xscale("log")
+ax2.set_yscale("log")
+ax2.set_adjustable("datalim")
+ax2.plot([1,3, 10], [1, 9, 100], "o-")
+ax2.set_xlim(1e-1, 1e2)
+ax2.set_ylim(1e-1, 1e3)
+ax2.set_aspect(1)
+ax2.set_title("adjustable = datalim")
+
+plt.draw()
+plt.show()
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-05-08 19:04:34 UTC (rev 7097)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-05-12 04:12:07 UTC (rev 7098)
@@ -1085,7 +1085,7 @@
raise ValueError('argument must be among %s' %
', '.join(mtransforms.BBox.coefs.keys()))
- def get_data_ratio(self):
+ def get_data_ratio(self, mode="linear"):
"""
Returns the aspect ratio of the raw data.
@@ -1093,11 +1093,18 @@
types.
"""
xmin,xmax = self.get_xbound()
- xsize = max(math.fabs(xmax-xmin), 1e-30)
ymin,ymax = self.get_ybound()
- ysize = max(math.fabs(ymax-ymin), 1e-30)
+
+ if mode == "log":
+ xsize = max(math.fabs(math.log10(xmax)-math.log10(xmin)), 1e-30)
+ ysize = max(math.fabs(math.log10(ymax)-math.log10(ymin)), 1e-30)
+ else:
+ xsize = max(math.fabs(xmax-xmin), 1e-30)
+ ysize = max(math.fabs(ymax-ymin), 1e-30)
+
return ysize/xsize
+
def apply_aspect(self, position=None):
'''
Use :meth:`_aspect` and :meth:`_adjustable` to modify the
@@ -1106,7 +1113,20 @@
if position is None:
position = self.get_position(original=True)
+
aspect = self.get_aspect()
+
+ xscale, yscale = self.get_xscale(), self.get_yscale()
+ if xscale == "linear" and yscale == "linear":
+ aspect_scale_mode = "linear"
+ elif xscale == "log" and yscale == "log":
+ aspect_scale_mode = "log"
+ else:
+ warnings.warn(
+ 'aspect is not supported for Axes with xscale=%s, yscale=%s' \
+ % (xscale, yscale))
+ aspect = "auto"
+
if aspect == 'auto':
self.set_position( position , which='active')
return
@@ -1127,7 +1147,7 @@
figW,figH = self.get_figure().get_size_inches()
fig_aspect = figH/figW
if self._adjustable == 'box':
- box_aspect = A * self.get_data_ratio()
+ box_aspect = A * self.get_data_ratio(mode=aspect_scale_mode)
pb = position.frozen()
pb1 = pb.shrunk_to_aspect(box_aspect, pb, fig_aspect)
self.set_position(pb1.anchored(self.get_anchor(), pb), 'active')
@@ -1137,11 +1157,18 @@
# by prior use of 'box'
self.set_position(position, which='active')
+
xmin,xmax = self.get_xbound()
+ ymin,ymax = self.get_ybound()
+
+ if aspect_scale_mode == "log":
+ xmin, xmax = math.log10(xmin), math.log10(xmax)
+ ymin, ymax = math.log10(ymin), math.log10(ymax)
+
xsize = max(math.fabs(xmax-xmin), 1e-30)
- ymin,ymax = self.get_ybound()
ysize = max(math.fabs(ymax-ymin), 1e-30)
+
l,b,w,h = position.bounds
box_aspect = fig_aspect * (h/w)
data_ratio = box_aspect / A
@@ -1152,9 +1179,18 @@
if abs(y_expander) < 0.005:
#print 'good enough already'
return
- dL = self.dataLim
- xr = 1.05 * dL.width
- yr = 1.05 * dL.height
+
+ if aspect_scale_mode == "log":
+ dL = self.dataLim
+ dL_width = math.log10(dL.x1) - math.log10(dL.x0)
+ dL_height = math.log10(dL.y1) - math.log10(dL.y0)
+ xr = 1.05 * dL_width
+ yr = 1.05 * dL_height
+ else:
+ dL = self.dataLim
+ xr = 1.05 * dL.width
+ yr = 1.05 * dL.height
+
xmarg = xsize - xr
ymarg = ysize - yr
Ysize = data_ratio * xsize
@@ -1189,14 +1225,20 @@
yc = 0.5*(ymin+ymax)
y0 = yc - Ysize/2.0
y1 = yc + Ysize/2.0
- self.set_ybound((y0, y1))
+ if aspect_scale_mode == "log":
+ self.set_ybound((10.**y0, 10.**y1))
+ else:
+ self.set_ybound((y0, y1))
#print 'New y0, y1:', y0, y1
#print 'New ysize, ysize/xsize', y1-y0, (y1-y0)/xsize
else:
xc = 0.5*(xmin+xmax)
x0 = xc - Xsize/2.0
x1 = xc + Xsize/2.0
- self.set_xbound((x0, x1))
+ if aspect_scale_mode == "log":
+ self.set_xbound((10.**x0, 10.**x1))
+ else:
+ self.set_xbound((x0, x1))
#print 'New x0, x1:', x0, x1
#print 'New xsize, ysize/xsize', x1-x0, ysize/(x1-x0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2009-05-08 19:04:42
|
Revision: 7097
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7097&view=rev
Author: efiring
Date: 2009-05-08 19:04:34 +0000 (Fri, 08 May 2009)
Log Message:
-----------
clabel takes new kwarg, rightside_up (defaults to True)
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/contour.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-05-07 19:33:33 UTC (rev 7096)
+++ trunk/matplotlib/CHANGELOG 2009-05-08 19:04:34 UTC (rev 7097)
@@ -1,4 +1,9 @@
======================================================================
+2009-05-08 clabel takes new kwarg, rightside_up; if False, labels
+ will not be flipped to keep them rightside-up. This
+ allows the use of clabel to make streamfunction arrows,
+ as requested by Evan Mason. - EF
+
2009-05-07 'labelpad' can now be passed when setting x/y labels. This
allows controlling the spacing between the label and its
axis. - RMM
Modified: trunk/matplotlib/lib/matplotlib/contour.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/contour.py 2009-05-07 19:33:33 UTC (rev 7096)
+++ trunk/matplotlib/lib/matplotlib/contour.py 2009-05-08 19:04:34 UTC (rev 7097)
@@ -91,6 +91,10 @@
placement, delete or backspace act like the third mouse button,
and any other key will select a label location).
+ *rightside_up*:
+ if *True* (default), label rotations will always be plus
+ or minus 90 degrees from level.
+
.. plot:: mpl_examples/pylab_examples/contour_demo.py
"""
@@ -116,6 +120,8 @@
# Detect if manual selection is desired and remove from argument list
self.labelManual=kwargs.get('manual',False)
+ self.rightside_up = kwargs.get('rightside_up', True)
+
if len(args) == 0:
levels = self.levels
indices = range(len(self.levels))
@@ -381,11 +387,12 @@
else:
rotation = np.arctan2(dd[1], dd[0]) * 180.0 / np.pi
- # Fix angle so text is never upside-down
- if rotation > 90:
- rotation = rotation - 180.0
- if rotation < -90:
- rotation = 180.0 + rotation
+ if self.rightside_up:
+ # Fix angle so text is never upside-down
+ if rotation > 90:
+ rotation = rotation - 180.0
+ if rotation < -90:
+ rotation = 180.0 + rotation
# Break contour if desired
nlc = []
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2009-05-07 19:33:43
|
Revision: 7096
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7096&view=rev
Author: ryanmay
Date: 2009-05-07 19:33:33 +0000 (Thu, 07 May 2009)
Log Message:
-----------
Move from LABELPAD class attribute on an Axis to a labelpad instance attribute. Add a label argument to Axes.set_[xy]label to control the spacing between a label and its axis.
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/axis.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-05-07 18:14:01 UTC (rev 7095)
+++ trunk/matplotlib/CHANGELOG 2009-05-07 19:33:33 UTC (rev 7096)
@@ -1,4 +1,8 @@
======================================================================
+2009-05-07 'labelpad' can now be passed when setting x/y labels. This
+ allows controlling the spacing between the label and its
+ axis. - RMM
+
2009-05-06 print_ps now uses mixed-mode renderer. Axes.draw rasterize
artists whose zorder smaller than rasterization_zorder.
-JJL
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-05-07 18:14:01 UTC (rev 7095)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-05-07 19:33:33 UTC (rev 7096)
@@ -1579,7 +1579,7 @@
"""
Get zorder value below which artists will be rasterized
"""
- return self._rasterization_zorder
+ return self._rasterization_zorder
def autoscale_view(self, tight=False, scalex=True, scaley=True):
@@ -1678,8 +1678,8 @@
dsu = [l for l in dsu if l[0] >= rasterization_zorder]
else:
dsu_rasterized = []
-
-
+
+
# the patch draws the background rectangle -- the frame below
# will draw the edges
if self.axison and self._frameon:
@@ -2721,14 +2721,16 @@
label = self.xaxis.get_label()
return label.get_text()
- def set_xlabel(self, xlabel, fontdict=None, **kwargs):
+ def set_xlabel(self, xlabel, fontdict=None, labelpad=None, **kwargs):
"""
call signature::
- set_xlabel(xlabel, fontdict=None, **kwargs)
+ set_xlabel(xlabel, fontdict=None, labelpad=None, **kwargs)
Set the label for the xaxis.
+ *labelpad* is the spacing in points between the label and the x-axis
+
Valid kwargs are Text properties:
%(Text)s
ACCEPTS: str
@@ -2738,6 +2740,7 @@
:meth:`text`
for information on how override and the optional args work
"""
+ if labelpad is not None: self.xaxis.labelpad = labelpad
return self.xaxis.set_label_text(xlabel, fontdict, **kwargs)
set_xlabel.__doc__ = cbook.dedent(set_xlabel.__doc__) % martist.kwdocd
@@ -2748,14 +2751,16 @@
label = self.yaxis.get_label()
return label.get_text()
- def set_ylabel(self, ylabel, fontdict=None, **kwargs):
+ def set_ylabel(self, ylabel, fontdict=None, labelpad=None, **kwargs):
"""
call signature::
- set_ylabel(ylabel, fontdict=None, **kwargs)
+ set_ylabel(ylabel, fontdict=None, labelpad=None, **kwargs)
Set the label for the yaxis
+ *labelpad* is the spacing in points between the label and the y-axis
+
Valid kwargs are Text properties:
%(Text)s
ACCEPTS: str
@@ -2765,6 +2770,7 @@
:meth:`text`
for information on how override and the optional args work
"""
+ if labelpad is not None: self.yaxis.labelpad = labelpad
return self.yaxis.set_label_text(ylabel, fontdict, **kwargs)
set_ylabel.__doc__ = cbook.dedent(set_ylabel.__doc__) % martist.kwdocd
@@ -3816,7 +3822,7 @@
h, l = ax.get_legend_handles_labels()
ax.legend(h, l)
-
+
"""
handles = []
Modified: trunk/matplotlib/lib/matplotlib/axis.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axis.py 2009-05-07 18:14:01 UTC (rev 7095)
+++ trunk/matplotlib/lib/matplotlib/axis.py 2009-05-07 19:33:33 UTC (rev 7096)
@@ -500,9 +500,8 @@
* :attr:`transData` - transform data coords to display coords
* :attr:`transAxis` - transform axis coords to display coords
-
+ * :attr:`labelpad` - number of points between the axis and its label
"""
- LABELPAD = 5
OFFSETTEXTPAD = 3
def __str__(self):
@@ -538,6 +537,7 @@
self._autolabelpos = True
self.label = self._get_label()
+ self.labelpad = 5
self.offsetText = self._get_offset_text()
self.majorTicks = []
self.minorTicks = []
@@ -1267,7 +1267,7 @@
else:
bbox = mtransforms.Bbox.union(bboxes)
bottom = bbox.y0
- self.label.set_position( (x, bottom - self.LABELPAD*self.figure.dpi / 72.0))
+ self.label.set_position( (x, bottom - self.labelpad*self.figure.dpi / 72.0))
else:
if not len(bboxes2):
@@ -1275,7 +1275,7 @@
else:
bbox = mtransforms.Bbox.union(bboxes2)
top = bbox.y1
- self.label.set_position( (x, top+self.LABELPAD*self.figure.dpi / 72.0))
+ self.label.set_position( (x, top+self.labelpad*self.figure.dpi / 72.0))
def _update_offset_text_position(self, bboxes, bboxes2):
"""
@@ -1506,7 +1506,7 @@
bbox = mtransforms.Bbox.union(bboxes)
left = bbox.x0
- self.label.set_position( (left-self.LABELPAD*self.figure.dpi/72.0, y))
+ self.label.set_position( (left-self.labelpad*self.figure.dpi/72.0, y))
else:
if not len(bboxes2):
@@ -1515,7 +1515,7 @@
bbox = mtransforms.Bbox.union(bboxes2)
right = bbox.x1
- self.label.set_position( (right+self.LABELPAD*self.figure.dpi/72.0, y))
+ self.label.set_position( (right+self.labelpad*self.figure.dpi/72.0, y))
def _update_offset_text_position(self, bboxes, bboxes2):
"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ry...@us...> - 2009-05-07 18:14:20
|
Revision: 7095
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7095&view=rev
Author: ryanmay
Date: 2009-05-07 18:14:01 +0000 (Thu, 07 May 2009)
Log Message:
-----------
Clean up multiprocess a little. Remove unused import, ensure Gtk backend is used, and replace pylab with pyplot.
Modified Paths:
--------------
trunk/matplotlib/examples/misc/multiprocess.py
Modified: trunk/matplotlib/examples/misc/multiprocess.py
===================================================================
--- trunk/matplotlib/examples/misc/multiprocess.py 2009-05-07 15:10:42 UTC (rev 7094)
+++ trunk/matplotlib/examples/misc/multiprocess.py 2009-05-07 18:14:01 UTC (rev 7095)
@@ -8,9 +8,11 @@
from multiprocessing import Process, Pipe
except ImportError:
from processing import Process, Pipe
-from Queue import Empty
import numpy as np
-import pylab
+
+import matplotlib
+matplotlib.use('GtkAgg')
+import matplotlib.pyplot as plt
import gobject
class ProcessPlotter(object):
@@ -20,7 +22,7 @@
self.y = []
def terminate(self):
- pylab.close('all')
+ plt.close('all')
def poll_draw(self):
@@ -49,13 +51,13 @@
print 'starting plotter...'
self.pipe = pipe
- self.fig = pylab.figure()
+ self.fig = plt.figure()
self.ax = self.fig.add_subplot(111)
self.gid = gobject.timeout_add(1000, self.poll_draw())
print '...done'
- pylab.show()
+ plt.show()
class NBPlot(object):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jd...@us...> - 2009-05-07 15:10:54
|
Revision: 7094
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7094&view=rev
Author: jdh2358
Date: 2009-05-07 15:10:42 +0000 (Thu, 07 May 2009)
Log Message:
-----------
remove reserved word as from example
Modified Paths:
--------------
trunk/matplotlib/examples/pylab_examples/anchored_artists.py
Modified: trunk/matplotlib/examples/pylab_examples/anchored_artists.py
===================================================================
--- trunk/matplotlib/examples/pylab_examples/anchored_artists.py 2009-05-07 04:09:12 UTC (rev 7093)
+++ trunk/matplotlib/examples/pylab_examples/anchored_artists.py 2009-05-07 15:10:42 UTC (rev 7094)
@@ -77,7 +77,7 @@
if __name__ == "__main__":
import matplotlib.pyplot as plt
-
+
ax = plt.gca()
ax.set_aspect(1.)
@@ -101,13 +101,13 @@
# draw a horizontal bar with length of 0.1 in Data coordinate
# (ax.transData) with a label underneath.
- as = AnchoredSizeBar(ax.transData,
+ asb = AnchoredSizeBar(ax.transData,
0.1,
r"1$^{\prime}$",
loc=8,
pad=0.1, borderpad=0.5, sep=5,
frameon=False)
- ax.add_artist(as)
+ ax.add_artist(asb)
plt.draw()
plt.show()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-05-07 04:09:21
|
Revision: 7093
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7093&view=rev
Author: leejjoon
Date: 2009-05-07 04:09:12 +0000 (Thu, 07 May 2009)
Log Message:
-----------
spelling corrections in legend-guide
Modified Paths:
--------------
trunk/matplotlib/doc/users/plotting/legend.rst
Modified: trunk/matplotlib/doc/users/plotting/legend.rst
===================================================================
--- trunk/matplotlib/doc/users/plotting/legend.rst 2009-05-07 03:59:28 UTC (rev 7092)
+++ trunk/matplotlib/doc/users/plotting/legend.rst 2009-05-07 04:09:12 UTC (rev 7093)
@@ -20,7 +20,7 @@
len(args) is 0, it automatically generate the legend from label
properties of the child artists by calling
:meth:`~matplotlib.axes.Axes.get_legend_handles_labels` method.
-For example, *ax.legend()* is equivalaent to::
+For example, *ax.legend()* is equivalent to::
handles, labels = ax.get_legend_handles_labels()
ax.legend(handles, labels)
@@ -53,7 +53,7 @@
* Remember that some *pyplot* commands return artist not supported by
legend, e.g., :func:`~matplotlib.pyplot.fill_between` returns
:class:`~matplotlib.collections.PolyCollection` that is not
- supported. Or some return mupltiple artists. For example,
+ supported. Or some return multiple artists. For example,
:func:`~matplotlib.pyplot.plot` returns list of
:class:`~matplotlib.lines.Line2D` instances, and
:func:`~matplotlib.pyplot.errorbar` returns a length 3 tuple of
@@ -68,7 +68,8 @@
When you want to customize the list of artists to be displayed in the
legend, or their order of appearance. There are a two options. First,
-you can keep lists of artists and labels, and explicitly use these for the first two argument of the legend call.::
+you can keep lists of artists and labels, and explicitly use these for
+the first two argument of the legend call.::
p1, = plot([1,2,3])
p2, = plot([3,2,1])
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-05-07 03:59:41
|
Revision: 7092
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7092&view=rev
Author: leejjoon
Date: 2009-05-07 03:59:28 +0000 (Thu, 07 May 2009)
Log Message:
-----------
add legend guide in documnetation
Modified Paths:
--------------
trunk/matplotlib/doc/users/plotting.rst
Added Paths:
-----------
trunk/matplotlib/doc/users/plotting/
trunk/matplotlib/doc/users/plotting/examples/
trunk/matplotlib/doc/users/plotting/examples/simple_legend01.py
trunk/matplotlib/doc/users/plotting/examples/simple_legend02.py
trunk/matplotlib/doc/users/plotting/legend.rst
Added: trunk/matplotlib/doc/users/plotting/examples/simple_legend01.py
===================================================================
--- trunk/matplotlib/doc/users/plotting/examples/simple_legend01.py (rev 0)
+++ trunk/matplotlib/doc/users/plotting/examples/simple_legend01.py 2009-05-07 03:59:28 UTC (rev 7092)
@@ -0,0 +1,15 @@
+from matplotlib.pyplot import *
+
+subplot(211)
+plot([1,2,3], label="test1")
+plot([3,2,1], label="test2")
+legend(bbox_to_anchor=(0., 1.02, 1., .102), loc=3,
+ ncol=2, mode="expand", borderaxespad=0.)
+
+subplot(223)
+plot([1,2,3], label="test1")
+plot([3,2,1], label="test2")
+legend(bbox_to_anchor=(1.05, 1), loc=2, borderaxespad=0.)
+
+
+show()
Added: trunk/matplotlib/doc/users/plotting/examples/simple_legend02.py
===================================================================
--- trunk/matplotlib/doc/users/plotting/examples/simple_legend02.py (rev 0)
+++ trunk/matplotlib/doc/users/plotting/examples/simple_legend02.py 2009-05-07 03:59:28 UTC (rev 7092)
@@ -0,0 +1,10 @@
+from matplotlib.pyplot import *
+
+p1, = plot([1,2,3], label="test1")
+p2, = plot([3,2,1], label="test2")
+
+l1 = legend([p1], ["Label 1"], loc=1)
+l2 = legend([p2], ["Label 2"], loc=4) # this removes l1 from the axes.
+gca().add_artist(l1) # add l1 as a separate artist to the axes
+
+show()
Added: trunk/matplotlib/doc/users/plotting/legend.rst
===================================================================
--- trunk/matplotlib/doc/users/plotting/legend.rst (rev 0)
+++ trunk/matplotlib/doc/users/plotting/legend.rst 2009-05-07 03:59:28 UTC (rev 7092)
@@ -0,0 +1,181 @@
+.. _plotting-guide-legend:
+
+************
+Legend guide
+************
+
+Do not proceed unless you already have read :func:`~matplotlib.pyplot.legend` and
+:class:`matplotlib.legend.Legend`!
+
+
+What to be displayed
+====================
+
+The legend command has a following call signature::
+
+ legend(*args, **kwargs)
+
+If len(args) is 2, the first argument should be a list of artist to be
+labeled, and the second argument should a list of string labels. If
+len(args) is 0, it automatically generate the legend from label
+properties of the child artists by calling
+:meth:`~matplotlib.axes.Axes.get_legend_handles_labels` method.
+For example, *ax.legend()* is equivalaent to::
+
+ handles, labels = ax.get_legend_handles_labels()
+ ax.legend(handles, labels)
+
+The :meth:`~matplotlib.axes.Axes.get_legend_handles_labels` method
+returns a tuple of two lists, i.e., list of artists and list of labels
+(python string). However, it does not return all of its child
+artists. It returns all artists in *ax.lines* and *ax.patches* and
+some artists in *ax.collection* which are instance of
+:class:`~matplotlib.collections.LineCollection` or
+:class:`~matplotlib.collections.RegularPolyCollection`. The label
+attributes (returned by get_label() method) of collected artists are
+used as text labels. If label attribute is empty string or starts with
+"_", that artist will be ignored.
+
+
+ * Note that not all kind of artists are supported by the legend. The
+ following is the list of artists that are currently supported.
+
+ * :class:`~matplotlib.lines.Line2D`
+ * :class:`~matplotlib.patches.Patch`
+ * :class:`~matplotlib.collections.LineCollection`
+ * :class:`~matplotlib.collections.RegularPolyCollection`
+
+ Unfortunately, there is no easy workaround when you need legend for
+ an artist not in the above list (You may use one of the supported
+ artist as a proxy. See below), or customize it beyond what is
+ supported by :class:`matplotlib.legend.Legend`.
+
+ * Remember that some *pyplot* commands return artist not supported by
+ legend, e.g., :func:`~matplotlib.pyplot.fill_between` returns
+ :class:`~matplotlib.collections.PolyCollection` that is not
+ supported. Or some return mupltiple artists. For example,
+ :func:`~matplotlib.pyplot.plot` returns list of
+ :class:`~matplotlib.lines.Line2D` instances, and
+ :func:`~matplotlib.pyplot.errorbar` returns a length 3 tuple of
+ :class:`~matplotlib.lines.Line2D` instances.
+
+ * The legend does not care about the axes that given artists belongs,
+ i.e., the artists may belong to other axes or even none.
+
+
+Adjusting the Order of Legend items
+-----------------------------------
+
+When you want to customize the list of artists to be displayed in the
+legend, or their order of appearance. There are a two options. First,
+you can keep lists of artists and labels, and explicitly use these for the first two argument of the legend call.::
+
+ p1, = plot([1,2,3])
+ p2, = plot([3,2,1])
+ p3, = plot([2,3,1])
+ legend([p2, p1], ["line 2", "line 1"])
+
+Or you may use :meth:`~matplotlib.axes.Axes.get_legend_handles_labels`
+to retrieve list of artist and labels and manipulate them before
+feeding them to legend call.::
+
+ ax = subplot(1,1,1)
+ p1, = ax.plot([1,2,3], label="line 1")
+ p2, = ax.plot([3,2,1], label="line 2")
+ p3, = ax.plot([2,3,1], label="line 3")
+
+ handles, labels = ax.get_legend_handles_labels()
+
+ # reverse the order
+ ax.legend(handles[::-1], labels[::-1])
+
+ # or sort them by labels
+ import operator
+ hl = sorted(zip(handles, labels),
+ key=operator.itemgetter(1))
+ handles2, labels2 = zip(*hl)
+
+ ax.legend(handles2, labels2)
+
+
+Using Proxy Artist
+------------------
+
+When you want to display legend for an artist not supported by the
+matplotlib, you may use other supported artist as a proxy. For
+example, you may creates an proxy artist without adding it to the axes
+(so the proxy artist will not be drawn in the main axes) and feet it
+to the legend function.::
+
+ p = Rectangle((0, 0), 1, 1, fc="r")
+ legend([p], ["Red Rectangle"])
+
+
+Multicolumn Legend
+==================
+
+By specifying the keyword argument *ncol*, you can have a multi-column
+legend. Also, mode="expand" horizontally expand the legend to fill the
+axes area. See `legend_demo3.py
+<http://matplotlib.sourceforge.net/examples/pylab_examples/legend_demo3.html>`_
+for example.
+
+
+Legend location
+===============
+
+The location of the legend can be specified by the keyword argument
+*loc*, either by string or a integer number.
+
+============= ======
+ String Number
+============= ======
+ upper right 1
+ upper left 2
+ lower left 3
+ lower right 4
+ right 5
+ center left 6
+ center right 7
+ lower center 8
+ upper center 9
+ center 10
+============= ======
+
+By default, the legend will anchor to the bbox of the axes
+(for legend) or the bbox of the figure (figlegend). You can specify
+your own bbox using *bbox_to_anchor* argument. *bbox_to_anchor* can be an
+instance of :class:`~matplotlib.transforms.BboxBase`, a tuple of 4
+floats (x, y, width, height of the bbox), or a tuple of 2 floats (x, y
+with width=height=0). Unless *bbox_transform* argument is given, the
+coordinates (even for the bbox instance) are considered as normalized
+axes coordinates.
+
+For example, if you want your axes legend located at the figure corner
+(instead of the axes corner)::
+
+ l = legend(bbox_to_anchor=(0, 0, 1, 1), transform=gcf().transFigure)
+
+Also, you can place above or outer right-hand side of the axes,
+
+.. plot:: users/plotting/examples/simple_legend01.py
+ :include-source:
+
+
+Multiple Legend
+===============
+
+Sometime, you want to split the legend into multiple ones.::
+
+ p1, = plot([1,2,3])
+ p2, = plot([3,2,1])
+ legend([p1], ["Test1"], loc=1)
+ legend([p2], ["Test2"], loc=4)
+
+However, the above code only shows the second legend. When the legend
+command is called, a new legend instance is created and old ones are
+removed from the axes. Thus, you need to manually add the removed
+legend.
+
+.. plot:: users/plotting/examples/simple_legend02.py
+ :include-source:
Modified: trunk/matplotlib/doc/users/plotting.rst
===================================================================
--- trunk/matplotlib/doc/users/plotting.rst 2009-05-07 03:51:41 UTC (rev 7091)
+++ trunk/matplotlib/doc/users/plotting.rst 2009-05-07 03:59:28 UTC (rev 7092)
@@ -144,8 +144,7 @@
==================================
:func:`~matplotlib.pyplot.legend` and :func:`~matplotlib.pyplot.figlegend`
+:ref:`plotting-guide-legend`
+
TODO; see :ref:`how-to-contribute-docs`.
-
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-05-07 03:52:03
|
Revision: 7091
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7091&view=rev
Author: leejjoon
Date: 2009-05-07 03:51:41 +0000 (Thu, 07 May 2009)
Log Message:
-----------
added examples/misc/rasterization_demo.py
Added Paths:
-----------
trunk/matplotlib/examples/misc/rasterization_demo.py
Added: trunk/matplotlib/examples/misc/rasterization_demo.py
===================================================================
--- trunk/matplotlib/examples/misc/rasterization_demo.py (rev 0)
+++ trunk/matplotlib/examples/misc/rasterization_demo.py 2009-05-07 03:51:41 UTC (rev 7091)
@@ -0,0 +1,53 @@
+import numpy as np
+import matplotlib.pyplot as plt
+
+d = np.arange(100).reshape(10, 10)
+x, y = np.meshgrid(np.arange(11), np.arange(11))
+
+theta = 0.25*np.pi
+xx = x*np.cos(theta) - y*np.sin(theta)
+yy = x*np.sin(theta) + y*np.cos(theta)
+
+ax1 = plt.subplot(221)
+ax1.set_aspect(1)
+ax1.pcolormesh(xx, yy, d)
+ax1.set_title("No Rasterization")
+
+ax2 = plt.subplot(222)
+ax2.set_aspect(1)
+ax2.set_title("Rasterization")
+
+m = ax2.pcolormesh(xx, yy, d)
+m.set_rasterized(True)
+
+ax3 = plt.subplot(223)
+ax3.set_aspect(1)
+ax3.pcolormesh(xx, yy, d)
+ax3.text(0.5, 0.5, "Text", alpha=0.2,
+ va="center", ha="center", size=50, transform=ax3.transAxes)
+
+ax3.set_title("No Rasterization")
+
+
+ax4 = plt.subplot(224)
+ax4.set_aspect(1)
+m = ax4.pcolormesh(xx, yy, d)
+m.set_zorder(-20)
+
+ax4.text(0.5, 0.5, "Text", alpha=0.2,
+ zorder=-15,
+ va="center", ha="center", size=50, transform=ax4.transAxes)
+
+ax4.set_rasterization_zorder(-10)
+
+ax4.set_title("Rasterization z$<-10$")
+
+
+# ax2.title.set_rasterized(True) # should display a warning
+
+plt.savefig("test_rasterization.pdf", dpi=150)
+plt.savefig("test_rasterization.eps", dpi=150)
+
+if not plt.rcParams["text.usetex"]:
+ plt.savefig("test_rasterization.svg", dpi=150)
+ # svg backend currently ignores the dpi
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-05-07 03:51:04
|
Revision: 7090
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7090&view=rev
Author: leejjoon
Date: 2009-05-07 03:50:55 +0000 (Thu, 07 May 2009)
Log Message:
-----------
print_ps with mixed-renderer
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/backend_bases.py
trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-05-07 03:40:40 UTC (rev 7089)
+++ trunk/matplotlib/CHANGELOG 2009-05-07 03:50:55 UTC (rev 7090)
@@ -1,4 +1,8 @@
======================================================================
+2009-05-06 print_ps now uses mixed-mode renderer. Axes.draw rasterize
+ artists whose zorder smaller than rasterization_zorder.
+ -JJL
+
2009-05-06 Per-artist Rasterization, originally by Eric Bruning. -JJ
2009-05-05 Add an example that shows how to make a plot that updates
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-05-07 03:40:40 UTC (rev 7089)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-05-07 03:50:55 UTC (rev 7090)
@@ -8,6 +8,7 @@
rcParams = matplotlib.rcParams
import matplotlib.artist as martist
+from matplotlib.artist import allow_rasterization
import matplotlib.axis as maxis
import matplotlib.cbook as cbook
import matplotlib.collections as mcoll
@@ -531,6 +532,8 @@
self._frameon = frameon
self._axisbelow = rcParams['axes.axisbelow']
+ self._rasterization_zorder = -30000
+
self._hold = rcParams['axes.hold']
self._connected = {} # a dict from events to (id, func)
self.cla()
@@ -1566,6 +1569,19 @@
"""
self._autoscaleYon = b
+ def set_rasterization_zorder(self, z):
+ """
+ Set zorder value below which artists will be rasterized
+ """
+ self._rasterization_zorder = z
+
+ def get_rasterization_zorder(self):
+ """
+ Get zorder value below which artists will be rasterized
+ """
+ return self._rasterization_zorder
+
+
def autoscale_view(self, tight=False, scalex=True, scaley=True):
"""
autoscale the view limits using the data limits. You can
@@ -1620,15 +1636,55 @@
else:
self.apply_aspect()
+
+ artists = []
+
+ artists.extend(self.collections)
+ artists.extend(self.patches)
+ artists.extend(self.lines)
+ artists.extend(self.texts)
+ artists.extend(self.artists)
+ if self.axison and not inframe:
+ if self._axisbelow:
+ self.xaxis.set_zorder(0.5)
+ self.yaxis.set_zorder(0.5)
+ else:
+ self.xaxis.set_zorder(2.5)
+ self.yaxis.set_zorder(2.5)
+ artists.extend([self.xaxis, self.yaxis])
+ if not inframe: artists.append(self.title)
+ artists.extend(self.tables)
+ if self.legend_ is not None:
+ artists.append(self.legend_)
+
+ # the frame draws the edges around the axes patch -- we
+ # decouple these so the patch can be in the background and the
+ # frame in the foreground.
+ if self.axison and self._frameon:
+ artists.append(self.frame)
+
+
+ dsu = [ (a.zorder, i, a) for i, a in enumerate(artists)
+ if not a.get_animated() ]
+ dsu.sort()
+
+
+ # rasterze artists with negative zorder
+ # if the minimum zorder is negative, start rasterization
+ rasterization_zorder = self._rasterization_zorder
+ if len(dsu) > 0 and dsu[0][0] < rasterization_zorder:
+ renderer.start_rasterizing()
+ dsu_rasterized = [l for l in dsu if l[0] < rasterization_zorder]
+ dsu = [l for l in dsu if l[0] >= rasterization_zorder]
+ else:
+ dsu_rasterized = []
+
+
# the patch draws the background rectangle -- the frame below
# will draw the edges
if self.axison and self._frameon:
self.patch.draw(renderer)
- artists = []
-
-
-
if len(self.images)<=1 or renderer.option_image_nocomposite():
for im in self.images:
im.draw(renderer)
@@ -1657,35 +1713,13 @@
self.patch.get_path(),
self.patch.get_transform())
- artists.extend(self.collections)
- artists.extend(self.patches)
- artists.extend(self.lines)
- artists.extend(self.texts)
- artists.extend(self.artists)
- if self.axison and not inframe:
- if self._axisbelow:
- self.xaxis.set_zorder(0.5)
- self.yaxis.set_zorder(0.5)
- else:
- self.xaxis.set_zorder(2.5)
- self.yaxis.set_zorder(2.5)
- artists.extend([self.xaxis, self.yaxis])
- if not inframe: artists.append(self.title)
- artists.extend(self.tables)
- if self.legend_ is not None:
- artists.append(self.legend_)
- # the frame draws the edges around the axes patch -- we
- # decouple these so the patch can be in the background and the
- # frame in the foreground.
- if self.axison and self._frameon:
- artists.append(self.frame)
+ if dsu_rasterized:
+ for zorder, i, a in dsu_rasterized:
+ a.draw(renderer)
+ renderer.stop_rasterizing()
- dsu = [ (a.zorder, i, a) for i, a in enumerate(artists)
- if not a.get_animated() ]
- dsu.sort()
-
for zorder, i, a in dsu:
a.draw(renderer)
Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backend_bases.py 2009-05-07 03:40:40 UTC (rev 7089)
+++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2009-05-07 03:50:55 UTC (rev 7090)
@@ -1443,6 +1443,7 @@
facecolor=facecolor,
edgecolor=edgecolor,
orientation=orientation,
+ dryrun=True,
**kwargs)
renderer = self.figure._cachedRenderer
bbox_inches = self.figure.get_tightbbox(renderer)
Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2009-05-07 03:40:40 UTC (rev 7089)
+++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2009-05-07 03:50:55 UTC (rev 7090)
@@ -33,6 +33,9 @@
from matplotlib.path import Path
from matplotlib.transforms import Affine2D
+from matplotlib.backends.backend_mixed import MixedModeRenderer
+
+
import numpy as npy
import binascii
import re
@@ -843,8 +846,13 @@
def print_eps(self, outfile, *args, **kwargs):
return self._print_ps(outfile, 'eps', *args, **kwargs)
+
+
+
+
+
def _print_ps(self, outfile, format, *args, **kwargs):
- papertype = kwargs.get("papertype", rcParams['ps.papersize'])
+ papertype = kwargs.pop("papertype", rcParams['ps.papersize'])
papertype = papertype.lower()
if papertype == 'auto':
pass
@@ -852,25 +860,28 @@
raise RuntimeError( '%s is not a valid papertype. Use one \
of %s'% (papertype, ', '.join( papersize.keys() )) )
- orientation = kwargs.get("orientation", "portrait").lower()
+ orientation = kwargs.pop("orientation", "portrait").lower()
if orientation == 'landscape': isLandscape = True
elif orientation == 'portrait': isLandscape = False
else: raise RuntimeError('Orientation must be "portrait" or "landscape"')
self.figure.set_dpi(72) # Override the dpi kwarg
- imagedpi = kwargs.get("dpi", 72)
- facecolor = kwargs.get("facecolor", "w")
- edgecolor = kwargs.get("edgecolor", "w")
+ imagedpi = kwargs.pop("dpi", 72)
+ facecolor = kwargs.pop("facecolor", "w")
+ edgecolor = kwargs.pop("edgecolor", "w")
if rcParams['text.usetex']:
self._print_figure_tex(outfile, format, imagedpi, facecolor, edgecolor,
- orientation, isLandscape, papertype)
+ orientation, isLandscape, papertype,
+ **kwargs)
else:
self._print_figure(outfile, format, imagedpi, facecolor, edgecolor,
- orientation, isLandscape, papertype)
+ orientation, isLandscape, papertype,
+ **kwargs)
def _print_figure(self, outfile, format, dpi=72, facecolor='w', edgecolor='w',
- orientation='portrait', isLandscape=False, papertype=None):
+ orientation='portrait', isLandscape=False, papertype=None,
+ **kwargs):
"""
Render the figure to hardcopy. Set the figure patch face and
edge colors. This is useful because some of the GUIs have a
@@ -939,10 +950,30 @@
self.figure.set_facecolor(facecolor)
self.figure.set_edgecolor(edgecolor)
- self._pswriter = StringIO()
- renderer = RendererPS(width, height, self._pswriter, imagedpi=dpi)
+
+ dryrun = kwargs.get("dryrun", False)
+ if dryrun:
+ class NullWriter(object):
+ def write(self, *kl, **kwargs):
+ pass
+
+ self._pswriter = NullWriter()
+ else:
+ self._pswriter = StringIO()
+
+
+ # mixed mode rendering
+ _bbox_inches_restore = kwargs.pop("bbox_inches_restore", None)
+ ps_renderer = RendererPS(width, height, self._pswriter, imagedpi=dpi)
+ renderer = MixedModeRenderer(self.figure,
+ width, height, dpi, ps_renderer,
+ bbox_inches_restore=_bbox_inches_restore)
+
self.figure.draw(renderer)
+ if dryrun: # return immediately if dryrun (tightbbox=True)
+ return
+
self.figure.set_facecolor(origfacecolor)
self.figure.set_edgecolor(origedgecolor)
@@ -962,7 +993,7 @@
Ndict = len(psDefs)
print >>fh, "%%BeginProlog"
if not rcParams['ps.useafm']:
- Ndict += len(renderer.used_characters)
+ Ndict += len(ps_renderer.used_characters)
print >>fh, "/mpldict %d dict def"%Ndict
print >>fh, "mpldict begin"
for d in psDefs:
@@ -970,7 +1001,7 @@
for l in d.split('\n'):
print >>fh, l.strip()
if not rcParams['ps.useafm']:
- for font_filename, chars in renderer.used_characters.values():
+ for font_filename, chars in ps_renderer.used_characters.values():
if len(chars):
font = FT2Font(font_filename)
cmap = font.get_charmap()
@@ -1019,7 +1050,8 @@
shutil.move(tmpfile, outfile)
def _print_figure_tex(self, outfile, format, dpi, facecolor, edgecolor,
- orientation, isLandscape, papertype):
+ orientation, isLandscape, papertype,
+ **kwargs):
"""
If text.usetex is True in rc, a temporary pair of tex/eps files
are created to allow tex to manage the text layout via the PSFrags
@@ -1051,10 +1083,29 @@
self.figure.set_facecolor(facecolor)
self.figure.set_edgecolor(edgecolor)
- self._pswriter = StringIO()
- renderer = RendererPS(width, height, self._pswriter, imagedpi=dpi)
+ dryrun = kwargs.get("dryrun", False)
+ if dryrun:
+ class NullWriter(object):
+ def write(self, *kl, **kwargs):
+ pass
+
+ self._pswriter = NullWriter()
+ else:
+ self._pswriter = StringIO()
+
+
+ # mixed mode rendering
+ _bbox_inches_restore = kwargs.pop("bbox_inches_restore", None)
+ ps_renderer = RendererPS(width, height, self._pswriter, imagedpi=dpi)
+ renderer = MixedModeRenderer(self.figure,
+ width, height, dpi, ps_renderer,
+ bbox_inches_restore=_bbox_inches_restore)
+
self.figure.draw(renderer)
+ if dryrun: # return immediately if dryrun (tightbbox=True)
+ return
+
self.figure.set_facecolor(origfacecolor)
self.figure.set_edgecolor(origedgecolor)
@@ -1117,11 +1168,11 @@
paper will be used to prevent clipping.'%(papertype, temp_papertype), 'helpful')
- texmanager = renderer.get_texmanager()
+ texmanager = ps_renderer.get_texmanager()
font_preamble = texmanager.get_font_preamble()
custom_preamble = texmanager.get_custom_preamble()
- convert_psfrags(tmpfile, renderer.psfrag, font_preamble,
+ convert_psfrags(tmpfile, ps_renderer.psfrag, font_preamble,
custom_preamble, paperWidth, paperHeight,
orientation)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <lee...@us...> - 2009-05-07 03:40:46
|
Revision: 7089
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7089&view=rev
Author: leejjoon
Date: 2009-05-07 03:40:40 +0000 (Thu, 07 May 2009)
Log Message:
-----------
per-artist rasterization
Modified Paths:
--------------
trunk/matplotlib/CHANGELOG
trunk/matplotlib/lib/matplotlib/artist.py
trunk/matplotlib/lib/matplotlib/axes.py
trunk/matplotlib/lib/matplotlib/axis.py
trunk/matplotlib/lib/matplotlib/collections.py
trunk/matplotlib/lib/matplotlib/figure.py
trunk/matplotlib/lib/matplotlib/image.py
trunk/matplotlib/lib/matplotlib/legend.py
trunk/matplotlib/lib/matplotlib/lines.py
trunk/matplotlib/lib/matplotlib/patches.py
trunk/matplotlib/lib/matplotlib/quiver.py
trunk/matplotlib/lib/matplotlib/table.py
Modified: trunk/matplotlib/CHANGELOG
===================================================================
--- trunk/matplotlib/CHANGELOG 2009-05-06 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/CHANGELOG 2009-05-07 03:40:40 UTC (rev 7089)
@@ -1,4 +1,6 @@
======================================================================
+2009-05-06 Per-artist Rasterization, originally by Eric Bruning. -JJ
+
2009-05-05 Add an example that shows how to make a plot that updates
using data from another process. Thanks to Robert
Cimrman - RMM
Modified: trunk/matplotlib/lib/matplotlib/artist.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/artist.py 2009-05-06 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/artist.py 2009-05-07 03:40:40 UTC (rev 7089)
@@ -22,6 +22,38 @@
# http://groups.google.com/groups?hl=en&lr=&threadm=mailman.5090.1098044946.5135.python-list%40python.org&rnum=1&prev=/groups%3Fq%3D__doc__%2Bauthor%253Ajdhunter%2540ace.bsd.uchicago.edu%26hl%3Den%26btnG%3DGoogle%2BSearch
+
+
+def allow_rasterization(draw):
+ """
+ Decorator for Artist.draw method. Provides routines
+ that run before and after the draw call. The before and after functions
+ are useful for changing artist-dependant renderer attributes or making
+ other setup function calls, such as starting and flushing a mixed-mode
+ renderer.
+ """
+ def before(artist, renderer):
+ if artist.get_rasterized():
+ renderer.start_rasterizing()
+
+ def after(artist, renderer):
+ if artist.get_rasterized():
+ renderer.stop_rasterizing()
+
+ # the axes class has a second argument inframe for its draw method.
+ def draw_wrapper(artist, renderer, *kl):
+ before(artist, renderer)
+ draw(artist, renderer, *kl)
+ after(artist, renderer)
+
+ # "safe wrapping" to exactly replicate anything we haven't overridden above
+ draw_wrapper.__name__ = draw.__name__
+ draw_wrapper.__dict__ = draw.__dict__
+ draw_wrapper.__doc__ = draw.__doc__
+ draw_wrapper._supports_rasterization = True
+ return draw_wrapper
+
+
class Artist(object):
"""
Abstract base class for someone who renders into a
@@ -45,6 +77,7 @@
self._label = ''
self._picker = None
self._contains = None
+ self._rasterized = None
self.eventson = False # fire events only if eventson
self._oid = 0 # an observer id
@@ -510,7 +543,23 @@
else:
gc.set_clip_rectangle(None)
gc.set_clip_path(None)
+
+ def get_rasterized(self):
+ return self._rasterized
+
+ def set_rasterized(self, rasterized):
+ """
+ Force rasterized (bitmap) drawing in vector backend output.
+
+ Defaults to None, which implies the backend's default behavior
+
+ ACCEPTS: [True | False | None]
+ """
+ if rasterized and not hasattr(self.draw, "_supports_rasterization"):
+ warnings.warn("Rasterization of '%s' will be ignored" % self)
+ self._rasterized = rasterized
+
def draw(self, renderer, *args, **kwargs):
'Derived classes drawing method'
if not self.get_visible(): return
Modified: trunk/matplotlib/lib/matplotlib/axes.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axes.py 2009-05-06 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/axes.py 2009-05-07 03:40:40 UTC (rev 7089)
@@ -1602,6 +1602,7 @@
#### Drawing
+ @allow_rasterization
def draw(self, renderer=None, inframe=False):
"Draw everything (plot lines, axes, labels)"
if renderer is None:
Modified: trunk/matplotlib/lib/matplotlib/axis.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/axis.py 2009-05-06 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/axis.py 2009-05-07 03:40:40 UTC (rev 7089)
@@ -5,6 +5,7 @@
from matplotlib import rcParams
import matplotlib.artist as artist
+from matplotlib.artist import allow_rasterization
import matplotlib.cbook as cbook
import matplotlib.font_manager as font_manager
import matplotlib.lines as mlines
@@ -176,6 +177,7 @@
'Return the tick location (data coords) as a scalar'
return self._loc
+ @allow_rasterization
def draw(self, renderer):
if not self.get_visible(): return
renderer.open_group(self.__name__)
@@ -719,6 +721,7 @@
bbox2 = mtransforms.Bbox.from_extents(0, 0, 0, 0)
return bbox, bbox2
+ @allow_rasterization
def draw(self, renderer, *args, **kwargs):
'Draw the axis lines, grid lines, tick lines and labels'
ticklabelBoxes = []
Modified: trunk/matplotlib/lib/matplotlib/collections.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/collections.py 2009-05-06 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/collections.py 2009-05-07 03:40:40 UTC (rev 7089)
@@ -17,6 +17,7 @@
import matplotlib.cm as cm
import matplotlib.transforms as transforms
import matplotlib.artist as artist
+from matplotlib.artist import allow_rasterization
import matplotlib.backend_bases as backend_bases
import matplotlib.path as mpath
import matplotlib.mlab as mlab
@@ -190,6 +191,7 @@
return transform, transOffset, offsets, paths
+ @allow_rasterization
def draw(self, renderer):
if not self.get_visible(): return
renderer.open_group(self.__class__.__name__)
@@ -594,6 +596,7 @@
def get_datalim(self, transData):
return self._bbox
+ @allow_rasterization
def draw(self, renderer):
if not self.get_visible(): return
renderer.open_group(self.__class__.__name__)
@@ -781,6 +784,7 @@
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
+ @allow_rasterization
def draw(self, renderer):
self._transforms = [
transforms.Affine2D().rotate(-self._rotation).scale(
Modified: trunk/matplotlib/lib/matplotlib/figure.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/figure.py 2009-05-06 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/figure.py 2009-05-07 03:40:40 UTC (rev 7089)
@@ -15,7 +15,7 @@
import time
import artist
-from artist import Artist
+from artist import Artist, allow_rasterization
from axes import Axes, SubplotBase, subplot_class_factory
from cbook import flatten, allequal, Stack, iterable, dedent
import _image
@@ -727,6 +727,7 @@
"""
self.clf()
+ @allow_rasterization
def draw(self, renderer):
"""
Render the figure using :class:`matplotlib.backend_bases.RendererBase` instance renderer
Modified: trunk/matplotlib/lib/matplotlib/image.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/image.py 2009-05-06 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/image.py 2009-05-07 03:40:40 UTC (rev 7089)
@@ -11,6 +11,7 @@
from matplotlib import rcParams
import matplotlib.artist as martist
+from matplotlib.artist import allow_rasterization
import matplotlib.colors as mcolors
import matplotlib.cm as cm
import matplotlib.cbook as cbook
@@ -225,7 +226,7 @@
norm=self._filternorm, radius=self._filterrad)
return im
-
+ @allow_rasterization
def draw(self, renderer, *args, **kwargs):
if not self.get_visible(): return
if (self.axes.get_xscale() != 'linear' or
@@ -571,6 +572,7 @@
im.is_grayscale = self.is_grayscale
return im
+ @allow_rasterization
def draw(self, renderer, *args, **kwargs):
if not self.get_visible(): return
im = self.make_image(renderer.get_image_magnification())
@@ -723,6 +725,7 @@
return im
+ @allow_rasterization
def draw(self, renderer, *args, **kwargs):
if not self.get_visible(): return
# todo: we should be able to do some cacheing here
Modified: trunk/matplotlib/lib/matplotlib/legend.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/legend.py 2009-05-06 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/legend.py 2009-05-07 03:40:40 UTC (rev 7089)
@@ -26,7 +26,7 @@
import numpy as np
from matplotlib import rcParams
-from matplotlib.artist import Artist
+from matplotlib.artist import Artist, allow_rasterization
from matplotlib.cbook import is_string_like, iterable, silent_list, safezip
from matplotlib.font_manager import FontProperties
from matplotlib.lines import Line2D
@@ -323,6 +323,7 @@
return x+xdescent, y+ydescent
+ @allow_rasterization
def draw(self, renderer):
"Draw everything that belongs to the legend"
if not self.get_visible(): return
Modified: trunk/matplotlib/lib/matplotlib/lines.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/lines.py 2009-05-06 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/lines.py 2009-05-07 03:40:40 UTC (rev 7089)
@@ -18,6 +18,8 @@
from transforms import Affine2D, Bbox, TransformedPath, IdentityTransform
from matplotlib import rcParams
+from artist import allow_rasterization
+
# special-purpose marker identifiers:
(TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN,
CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN) = range(8)
@@ -459,6 +461,7 @@
if len(x)<2: return 1
return np.alltrue(x[1:]-x[0:-1]>=0)
+ @allow_rasterization
def draw(self, renderer):
if self._invalid:
self.recache()
Modified: trunk/matplotlib/lib/matplotlib/patches.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/patches.py 2009-05-06 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/patches.py 2009-05-07 03:40:40 UTC (rev 7089)
@@ -7,6 +7,7 @@
import numpy as np
import matplotlib.cbook as cbook
import matplotlib.artist as artist
+from matplotlib.artist import allow_rasterization
import matplotlib.colors as colors
import matplotlib.transforms as transforms
from matplotlib.path import Path
@@ -260,7 +261,7 @@
'Return the current hatching pattern'
return self._hatch
-
+ @allow_rasterization
def draw(self, renderer):
'Draw the :class:`Patch` to the given *renderer*.'
if not self.get_visible(): return
@@ -1176,6 +1177,7 @@
self.theta2 = theta2
__init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd
+ @allow_rasterization
def draw(self, renderer):
"""
Ellipses are normally drawn using an approximation that uses
Modified: trunk/matplotlib/lib/matplotlib/quiver.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/quiver.py 2009-05-06 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/quiver.py 2009-05-07 03:40:40 UTC (rev 7089)
@@ -21,6 +21,7 @@
import matplotlib.transforms as transforms
import matplotlib.text as mtext
import matplotlib.artist as martist
+from matplotlib.artist import allow_rasterization
import matplotlib.font_manager as font_manager
from matplotlib.cbook import delete_masked_points
from matplotlib.patches import CirclePolygon
@@ -282,6 +283,7 @@
else:
return y
+ @allow_rasterization
def draw(self, renderer):
self._init()
self.vector.draw(renderer)
@@ -418,6 +420,7 @@
if self.width is None:
self.width = 0.06 * self.span / sn
+ @allow_rasterization
def draw(self, renderer):
self._init()
if self._new_UV or self.angles == 'xy':
Modified: trunk/matplotlib/lib/matplotlib/table.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/table.py 2009-05-06 23:02:57 UTC (rev 7088)
+++ trunk/matplotlib/lib/matplotlib/table.py 2009-05-07 03:40:40 UTC (rev 7089)
@@ -23,7 +23,7 @@
import warnings
import artist
-from artist import Artist
+from artist import Artist, allow_rasterization
from patches import Rectangle
from cbook import is_string_like
from text import Text
@@ -90,6 +90,7 @@
return fontsize
+ @allow_rasterization
def draw(self, renderer):
if not self.get_visible(): return
# draw the rectangle
@@ -215,6 +216,7 @@
def _approx_text_height(self):
return self.FONTSIZE/72.0*self.figure.dpi/self._axes.bbox.height * 1.2
+ @allow_rasterization
def draw(self, renderer):
# Need a renderer to do hit tests on mouseevent; assume the last one will do
if renderer is None:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ef...@us...> - 2009-05-06 23:03:06
|
Revision: 7088
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7088&view=rev
Author: efiring
Date: 2009-05-06 23:02:57 +0000 (Wed, 06 May 2009)
Log Message:
-----------
Spelling correction and other minor cleanups in mlab
Modified Paths:
--------------
trunk/matplotlib/lib/matplotlib/mlab.py
Modified: trunk/matplotlib/lib/matplotlib/mlab.py
===================================================================
--- trunk/matplotlib/lib/matplotlib/mlab.py 2009-05-06 20:52:55 UTC (rev 7087)
+++ trunk/matplotlib/lib/matplotlib/mlab.py 2009-05-06 23:02:57 UTC (rev 7088)
@@ -175,14 +175,7 @@
import matplotlib.nxutils as nxutils
import matplotlib.cbook as cbook
-# set is a new builtin function in 2.4; delete the following when
-# support for 2.3 is dropped.
-try:
- set
-except NameError:
- from sets import Set as set
-
def linspace(*args, **kw):
warnings.warn("use numpy.linspace", DeprecationWarning)
return np.linspace(*args, **kw)
@@ -617,12 +610,10 @@
:func:`polyval`
polyval function
"""
- warnings.warn("use numpy.poyfit", DeprecationWarning)
+ warnings.warn("use numpy.polyfit", DeprecationWarning)
return np.polyfit(*args, **kwargs)
-
-
def polyval(*args, **kwargs):
"""
*y* = polyval(*p*, *x*)
@@ -899,14 +890,8 @@
"""
warnings.warn("Use numpy.trapz(y,x) instead of trapz(x,y)", DeprecationWarning)
return np.trapz(y, x)
- #if len(x)!=len(y):
- # raise ValueError, 'x and y must have the same length'
- #if len(x)<2:
- # raise ValueError, 'x and y must have > 1 element'
- #return np.sum(0.5*np.diff(x)*(y[1:]+y[:-1]))
-
def longest_contiguous_ones(x):
"""
Return the indices of the longest stretch of contiguous ones in *x*,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|