From: <jd...@us...> - 2009-08-04 16:48:17
|
Revision: 7347 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7347&view=rev Author: jdh2358 Date: 2009-08-04 16:48:04 +0000 (Tue, 04 Aug 2009) Log Message: ----------- enabled legend picking Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/legend.py Added Paths: ----------- trunk/matplotlib/examples/event_handling/legend_picking.py Added: trunk/matplotlib/examples/event_handling/legend_picking.py =================================================================== --- trunk/matplotlib/examples/event_handling/legend_picking.py (rev 0) +++ trunk/matplotlib/examples/event_handling/legend_picking.py 2009-08-04 16:48:04 UTC (rev 7347) @@ -0,0 +1,36 @@ +""" +Enable picking on the legend to toggle the legended line on and off +""" +import numpy as np +import matplotlib.pyplot as plt + +t = np.arange(0.0, 0.2, 0.1) +y1 = 2*np.sin(2*np.pi*t) +y2 = 4*np.sin(2*np.pi*2*t) + +fig = plt.figure() +ax = fig.add_subplot(111) + +line1, = ax.plot(t, y1, lw=2, color='red', label='1 hz') +line2, = ax.plot(t, y2, lw=2, color='blue', label='2 hz') + +leg = ax.legend(loc='upper left', fancybox=True, shadow=True) +leg.get_frame().set_alpha(0.4) + + +lines = [line1, line2] +lined = dict() +for legline, realine in zip(leg.get_lines(), lines): + legline.set_picker(5) # 5 pts tolerance + lined[legline] = realine + +def onpick(event): + legline = event.artist + realline = lined[legline] + vis = realline.get_visible() + realline.set_visible(not vis) + fig.canvas.draw() + +fig.canvas.mpl_connect('pick_event', onpick) + +plt.show() Modified: trunk/matplotlib/lib/matplotlib/legend.py =================================================================== --- trunk/matplotlib/lib/matplotlib/legend.py 2009-08-04 13:20:29 UTC (rev 7346) +++ trunk/matplotlib/lib/matplotlib/legend.py 2009-08-04 16:48:04 UTC (rev 7347) @@ -177,6 +177,10 @@ propnames=['numpoints', 'markerscale', 'shadow', "columnspacing", "scatterpoints"] + self.texts = [] + self.legendHandles = [] + self._legend_title_box = None + localdict = locals() for name in propnames: @@ -240,6 +244,7 @@ if isinstance(parent,Axes): self.isaxes = True + self.set_axes(parent) self.set_figure(parent.figure) elif isinstance(parent,Figure): self.isaxes = False @@ -313,10 +318,8 @@ set the boilerplate props for artists added to axes """ a.set_figure(self.figure) - - for c in self.get_children(): - c.set_figure(self.figure) - + if self.isaxes: + a.set_axes(self.axes) a.set_transform(self.get_transform()) @@ -432,6 +435,7 @@ textbox = TextArea(l, textprops=label_prop, multilinebaseline=True, minimumdescent=True) text_list.append(textbox._text) + labelboxes.append(textbox) handleboxes = [] @@ -688,6 +692,13 @@ children = [] if self._legend_box: children.append(self._legend_box) + children.extend(self.get_lines()) + children.extend(self.get_patches()) + children.extend(self.get_texts()) + children.append(self.get_frame()) + + if self._legend_title_box: + children.append(self.get_title()) return children def get_frame(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-08-04 18:40:22
|
Revision: 7352 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7352&view=rev Author: efiring Date: 2009-08-04 18:40:10 +0000 (Tue, 04 Aug 2009) Log Message: ----------- Disable contourf slit line removal until problems are fixed. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/contour.py trunk/matplotlib/src/cntr.c Modified: trunk/matplotlib/lib/matplotlib/contour.py =================================================================== --- trunk/matplotlib/lib/matplotlib/contour.py 2009-08-04 18:21:59 UTC (rev 7351) +++ trunk/matplotlib/lib/matplotlib/contour.py 2009-08-04 18:40:10 UTC (rev 7352) @@ -652,7 +652,8 @@ codes = np.zeros(kind.shape, dtype=mpath.Path.code_type) codes.fill(mpath.Path.LINETO) codes[0] = mpath.Path.MOVETO - codes[kind >= _cntr._slitkind] = mpath.Path.MOVETO + # Attempted slit removal is disabled until we get it right. + #codes[kind >= _cntr._slitkind] = mpath.Path.MOVETO paths.append(mpath.Path(seg, codes)) return paths Modified: trunk/matplotlib/src/cntr.c =================================================================== --- trunk/matplotlib/src/cntr.c 2009-08-04 18:21:59 UTC (rev 7351) +++ trunk/matplotlib/src/cntr.c 2009-08-04 18:40:10 UTC (rev 7352) @@ -326,12 +326,14 @@ int z0, z1, z2, z3; int keep_left = 0; /* flag to try to minimize curvature in saddles */ int done = 0; + int n_kind; if (level) level = 2; for (;;) { + n_kind = 0; /* set edge endpoints */ p0 = POINT0 (edge, fwd); p1 = POINT1 (edge, fwd); @@ -344,6 +346,7 @@ xcp[n] = zcp * (x[p1] - x[p0]) + x[p0]; ycp[n] = zcp * (y[p1] - y[p0]) + y[p0]; kcp[n] = kind_zone; + n_kind = n; } if (!done && !jedge) { @@ -497,9 +500,9 @@ { return done; } - if (pass2 && n > 0) + if (pass2 && n_kind) { - kcp[n-1] += kind_start_slit; + kcp[n_kind] += kind_start_slit; } return slit_cutter (site, done - 5, pass2); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jo...@us...> - 2009-08-04 19:35:22
|
Revision: 7354 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7354&view=rev Author: jouni Date: 2009-08-04 19:35:13 +0000 (Tue, 04 Aug 2009) Log Message: ----------- Made cbook.get_mpl_data make use of the ETag and Last-Modified headers of mod_dav_svn. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/cbook.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-08-04 18:46:41 UTC (rev 7353) +++ trunk/matplotlib/CHANGELOG 2009-08-04 19:35:13 UTC (rev 7354) @@ -1,3 +1,5 @@ +2009-08-04 Made cbook.get_mpl_data make use of the ETag and Last-Modified + headers of mod_dav_svn. - JKS 2009-08-03 Add PathCollection; modify contourf to use complex paths instead of simple paths with cuts. - EF Modified: trunk/matplotlib/lib/matplotlib/cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-04 18:46:41 UTC (rev 7353) +++ trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-04 19:35:13 UTC (rev 7354) @@ -9,6 +9,10 @@ import numpy as np import numpy.ma as ma from weakref import ref +import cPickle +import os.path +import random +import urllib2 import matplotlib @@ -340,8 +344,120 @@ def is_scalar_or_string(val): return is_string_like(val) or not iterable(val) +class _CacheProcessor(urllib2.BaseHandler): + """ + Urllib2 handler that takes care of caching files. + The file cache.pck holds the directory of files to be cached. + """ + def __init__(self, cache_dir): + self.cache_dir = cache_dir + self.read_cache() + self.remove_stale_files() + def in_cache_dir(self, fn): + return os.path.join(self.cache_dir, fn) + + def read_cache(self): + """ + Read the cache file from the cache directory. + """ + fn = self.in_cache_dir('cache.pck') + if not os.path.exists(fn): + self.cache = {} + return + f = open(fn, 'rb') + cache = cPickle.load(f) + f.close() + + # If any files are deleted, drop them from the cache + for url, (fn, _, _) in cache.items(): + if not os.path.exists(self.in_cache_dir(fn)): + del cache[url] + + self.cache = cache + + def remove_stale_files(self): + """ + Remove files from the cache directory that are not listed in + cache.pck. + """ + listed = set([fn for (_, (fn, _, _)) in self.cache.items()]) + for path in os.listdir(self.cache_dir): + if path not in listed and path != 'cache.pck': + os.remove(os.path.join(self.cache_dir, path)) + + def write_cache(self): + """ + Write the cache data structure into the cache directory. + """ + fn = self.in_cache_dir('cache.pck') + f = open(fn, 'wb') + cPickle.dump(self.cache, f, -1) + f.close() + + def cache_file(self, url, data, headers): + """ + Store a received file in the cache directory. + """ + # Pick a filename + rightmost = url.rstrip('/').split('/')[-1] + fn = rightmost + while os.path.exists(self.in_cache_dir(fn)): + fn = rightmost + '.' + str(random.randint(0,9999999)) + + # Write out the data + f = open(self.in_cache_dir(fn), 'wb') + f.write(data) + f.close() + + # Update the cache + self.cache[url] = (fn, headers.get('ETag'), headers.get('Last-Modified')) + self.write_cache() + + # These urllib2 entry points are used: + # http_request for preprocessing requests + # http_error_304 for handling 304 Not Modified responses + # http_response for postprocessing requests + + def http_request(self, req): + """ + Make the request conditional if we have a cached file. + """ + url = req.get_full_url() + if url in self.cache: + _, etag, lastmod = self.cache[url] + req.add_header("If-None-Match", etag) + req.add_header("If-Modified-Since", lastmod) + return req + + def http_error_304(self, req, fp, code, msg, hdrs): + """ + Read the file from the cache since the server has no newer version. + """ + url = req.get_full_url() + fn, _, _ = self.cache[url] + file = open(self.in_cache_dir(fn), 'rb') + handle = urllib2.addinfourl(file, hdrs, url) + handle.code = 304 + return handle + + def http_response(self, req, response): + """ + Update the cache with the returned file. + """ + if response.code != 200: + return response + else: + data = response.read() + self.cache_file(req.get_full_url(), data, response.headers) + result = urllib2.addinfourl(StringIO.StringIO(data), + response.headers, + req.get_full_url()) + result.code = response.code + result.msg = response.msg + return result + def get_mpl_data(fname, asfileobj=True): """ Check the cachedirectory ~/.matplotlib/mpl_data for an mpl_data @@ -363,32 +479,25 @@ intended for use in mpl examples that need custom data """ - # TODO: how to handle stale data in the cache that has been - # updated from svn -- is there a clean http way to get the current - # revision number that will not leave us at the mercy of html - # changes at sf? + if not hasattr(get_mpl_data, 'opener'): + configdir = matplotlib.get_configdir() + cachedir = os.path.join(configdir, 'mpl_data') + if not os.path.exists(cachedir): + os.mkdir(cachedir) + # Store the cache processor and url opener as attributes of this function + get_mpl_data.processor = _CacheProcessor(cachedir) + get_mpl_data.opener = urllib2.build_opener(get_mpl_data.processor) - - configdir = matplotlib.get_configdir() - cachedir = os.path.join(configdir, 'mpl_data') - if not os.path.exists(cachedir): - os.mkdir(cachedir) - - cachefile = os.path.join(cachedir, fname) - - if not os.path.exists(cachefile): - import urllib - url = 'http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/mpl_data/%s'%urllib.quote(fname) - matplotlib.verbose.report('Attempting to download %s to %s'%(url, cachefile)) - urllib.urlretrieve(url, filename=cachefile) - else: - matplotlib.verbose.report('Aleady have mpl_data %s'%fname) - + url = 'http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/mpl_data/' + \ + urllib2.quote(fname) + response = get_mpl_data.opener.open(url) if asfileobj: - return to_filehandle(cachefile) + return response else: - return cachefile - + response.close() + p = get_mpl_data.processor + return p.in_cache_dir(p.cache[url][0]) + def flatten(seq, scalarp=is_scalar_or_string): """ this generator flattens nested containers such as This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-08-05 00:05:49
|
Revision: 7356 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7356&view=rev Author: efiring Date: 2009-08-05 00:05:37 +0000 (Wed, 05 Aug 2009) Log Message: ----------- Elimination of contourf cut strokes: second try Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/contour.py trunk/matplotlib/src/cntr.c Modified: trunk/matplotlib/lib/matplotlib/contour.py =================================================================== --- trunk/matplotlib/lib/matplotlib/contour.py 2009-08-04 19:51:08 UTC (rev 7355) +++ trunk/matplotlib/lib/matplotlib/contour.py 2009-08-05 00:05:37 UTC (rev 7356) @@ -606,7 +606,6 @@ segs = nlist[:nseg] kinds = nlist[nseg:] - paths = self._make_paths(segs, kinds) col = collections.PathCollection(paths, @@ -652,8 +651,10 @@ codes = np.zeros(kind.shape, dtype=mpath.Path.code_type) codes.fill(mpath.Path.LINETO) codes[0] = mpath.Path.MOVETO - # Attempted slit removal is disabled until we get it right. - #codes[kind >= _cntr._slitkind] = mpath.Path.MOVETO + # points that begin a slit or are in it: + in_slit = kind[:-1] >= _cntr._slitkind + # use moveto for any point *following* such a point + codes[1:][in_slit] = mpath.Path.MOVETO paths.append(mpath.Path(seg, codes)) return paths Modified: trunk/matplotlib/src/cntr.c =================================================================== --- trunk/matplotlib/src/cntr.c 2009-08-04 19:51:08 UTC (rev 7355) +++ trunk/matplotlib/src/cntr.c 2009-08-05 00:05:37 UTC (rev 7356) @@ -1326,7 +1326,7 @@ /* Build a list of XY 2-D arrays, shape (N,2), to which a list of K arrays - is concatenated concatenated. */ + is concatenated. */ static PyObject * build_cntr_list_v2(long *np, double *xp, double *yp, short *kp, int nparts, long ntotal) @@ -1653,6 +1653,29 @@ return cntr_trace(self->site, levels, nlevels, nchunk); } +/* The following will not normally be called. It is experimental, + and intended for future debugging. It may go away at any time. +*/ +static PyObject * +Cntr_get_cdata(Cntr *self) +{ + PyArrayObject *Cdata; + npy_intp dims[2]; + int i, j; + int ni, nj; + + dims[0] = ni = self->site->imax; + dims[1] = nj = self->site->jmax; + + Cdata = (PyArrayObject *) PyArray_SimpleNew(2, dims, PyArray_SHORT); + for (j=0; j<nj; j++) + for (i=0; i<ni; i++) + Cdata->data[j + i*nj] = self->site->data[i + j*ni]; + /* output is C-order, input is F-order */ + /* for now we are ignoring the last ni+1 values */ + return (PyObject *)Cdata; +} + static PyMethodDef Cntr_methods[] = { {"trace", (PyCFunction)Cntr_trace, METH_VARARGS | METH_KEYWORDS, "Return a list of contour line segments or polygons.\n\n" @@ -1665,6 +1688,12 @@ " Optional argument: nchunk; approximate number of grid points\n" " per chunk. 0 (default) for no chunking.\n" }, + {"get_cdata", (PyCFunction)Cntr_get_cdata, METH_NOARGS, + "Returns a copy of the mesh array with contour calculation codes.\n\n" + "Experimental and incomplete; we are not returning quite all of\n" + "the array.\n" + "Don't call this unless you are exploring the dark recesses of cntr.c\n" + }, {0, 0, 0, 0} /* Sentinel */ }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2009-08-05 12:04:47
|
Revision: 7362 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7362&view=rev Author: jdh2358 Date: 2009-08-05 12:04:36 +0000 (Wed, 05 Aug 2009) Log Message: ----------- added a new mpl data example script to test svn commits on the data Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/__init__.py trunk/matplotlib/lib/matplotlib/cbook.py Added Paths: ----------- trunk/matplotlib/examples/misc/mpl_data_test.py Added: trunk/matplotlib/examples/misc/mpl_data_test.py =================================================================== --- trunk/matplotlib/examples/misc/mpl_data_test.py (rev 0) +++ trunk/matplotlib/examples/misc/mpl_data_test.py 2009-08-05 12:04:36 UTC (rev 7362) @@ -0,0 +1,13 @@ +""" +Demonstrate how get_mpl_data works with svn revisions in the data. + + svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/mpl_data + +and edit testdata.csv to add a new row. After committing the changes, +when you rerun this script you will get the updated data (and the new +svn version will be cached in ~/.matplotlib/mpl_data) +""" + +import matplotlib.cbook as cbook +fh = cbook.get_mpl_data("testdata.csv") +print fh.read() Modified: trunk/matplotlib/lib/matplotlib/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/__init__.py 2009-08-05 11:39:37 UTC (rev 7361) +++ trunk/matplotlib/lib/matplotlib/__init__.py 2009-08-05 12:04:36 UTC (rev 7362) @@ -89,7 +89,7 @@ """ from __future__ import generators -__version__ = '0.99.0.rc1' +__version__ = '1.0.svn' __revision__ = '$Revision$' __date__ = '$Date$' Modified: trunk/matplotlib/lib/matplotlib/cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 11:39:37 UTC (rev 7361) +++ trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 12:04:36 UTC (rev 7362) @@ -356,7 +356,7 @@ def in_cache_dir(self, fn): return os.path.join(self.cache_dir, fn) - + def read_cache(self): """ Read the cache file from the cache directory. @@ -386,7 +386,7 @@ for path in os.listdir(self.cache_dir): if path not in listed and path != 'cache.pck': os.remove(os.path.join(self.cache_dir, path)) - + def write_cache(self): """ Write the cache data structure into the cache directory. @@ -419,7 +419,7 @@ # http_request for preprocessing requests # http_error_304 for handling 304 Not Modified responses # http_response for postprocessing requests - + def http_request(self, req): """ Make the request conditional if we have a cached file. @@ -441,7 +441,7 @@ handle = urllib2.addinfourl(file, hdrs, url) handle.code = 304 return handle - + def http_response(self, req, response): """ Update the cache with the returned file. @@ -473,7 +473,7 @@ To add a datafile to this directory, you need to check out mpl_data from matplotlib svn:: - svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/mpl_data + svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/mpl_data and svn add the data file you want to support. This is primarily intended for use in mpl examples that need custom data @@ -497,7 +497,7 @@ response.close() p = get_mpl_data.processor return p.in_cache_dir(p.cache[url][0]) - + def flatten(seq, scalarp=is_scalar_or_string): """ this generator flattens nested containers such as This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2009-08-05 14:35:16
|
Revision: 7363 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7363&view=rev Author: jdh2358 Date: 2009-08-05 14:35:06 +0000 (Wed, 05 Aug 2009) Log Message: ----------- Merged revisions 7353,7358-7359 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint ........ r7353 | jdh2358 | 2009-08-04 13:46:41 -0500 (Tue, 04 Aug 2009) | 1 line attach gtk events to mpl events -- fixes sf bug 2816580 ........ r7358 | jdh2358 | 2009-08-04 21:29:12 -0500 (Tue, 04 Aug 2009) | 1 line some fixes for osx builds on rc2 ........ r7359 | jdh2358 | 2009-08-05 06:06:13 -0500 (Wed, 05 Aug 2009) | 1 line remove dup gui event in enter/leave events in gtk ........ Modified Paths: -------------- trunk/matplotlib/doc/_templates/indexsidebar.html trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py trunk/matplotlib/release/osx/Makefile trunk/matplotlib/release/osx/README.txt Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7345 + /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7362 Modified: trunk/matplotlib/doc/_templates/indexsidebar.html =================================================================== --- trunk/matplotlib/doc/_templates/indexsidebar.html 2009-08-05 12:04:36 UTC (rev 7362) +++ trunk/matplotlib/doc/_templates/indexsidebar.html 2009-08-05 14:35:06 UTC (rev 7363) @@ -4,7 +4,7 @@ <p>Please <a href="http://sourceforge.net/project/project_donations.php?group_id=80706">donate</a> to support matplotlib development.</p> -<p>A release candidate rc1 of matplotlib-0.99.0 is <a href="http://drop.io/xortel1#">available</a> for testing. Please post any bugs to the <a href="http://sourceforge.net/tracker2/?group_id=80706">tracker</a> +<p>A release candidate rc2 of matplotlib-0.99.0 is <a href="http://drop.io/xortel1#">available</a> for testing. Please post any bugs to the <a href="http://sourceforge.net/tracker2/?group_id=80706">tracker</a> </p> <p>Watch a <a href="http://videolectures.net/mloss08_hunter_mat">video lecture</a> about matplotlib presented at <a href="http://videolectures.net/mloss08_whistler">NIPS 08 Workshop</a> <i>Machine Learning Open Source Software</i></a>. Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2009-08-05 12:04:36 UTC (rev 7362) +++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2009-08-05 14:35:06 UTC (rev 7363) @@ -197,7 +197,7 @@ step = 1 else: step = -1 - FigureCanvasBase.scroll_event(self, x, y, step) + FigureCanvasBase.scroll_event(self, x, y, step, guiEvent=event) return False # finish event propagation? def button_press_event(self, widget, event): @@ -205,7 +205,7 @@ x = event.x # flipy so y=0 is bottom of canvas y = self.allocation.height - event.y - FigureCanvasBase.button_press_event(self, x, y, event.button) + FigureCanvasBase.button_press_event(self, x, y, event.button, guiEvent=event) return False # finish event propagation? def button_release_event(self, widget, event): @@ -213,21 +213,21 @@ x = event.x # flipy so y=0 is bottom of canvas y = self.allocation.height - event.y - FigureCanvasBase.button_release_event(self, x, y, event.button) + FigureCanvasBase.button_release_event(self, x, y, event.button, guiEvent=event) return False # finish event propagation? def key_press_event(self, widget, event): if _debug: print 'FigureCanvasGTK.%s' % fn_name() key = self._get_key(event) if _debug: print "hit", key - FigureCanvasBase.key_press_event(self, key) + FigureCanvasBase.key_press_event(self, key, guiEvent=event) return False # finish event propagation? def key_release_event(self, widget, event): if _debug: print 'FigureCanvasGTK.%s' % fn_name() key = self._get_key(event) if _debug: print "release", key - FigureCanvasBase.key_release_event(self, key) + FigureCanvasBase.key_release_event(self, key, guiEvent=event) return False # finish event propagation? def motion_notify_event(self, widget, event): @@ -239,7 +239,7 @@ # flipy so y=0 is bottom of canvas y = self.allocation.height - y - FigureCanvasBase.motion_notify_event(self, x, y) + FigureCanvasBase.motion_notify_event(self, x, y, guiEvent=event) return False # finish event propagation? def leave_notify_event(self, widget, event): Modified: trunk/matplotlib/release/osx/Makefile =================================================================== --- trunk/matplotlib/release/osx/Makefile 2009-08-05 12:04:36 UTC (rev 7362) +++ trunk/matplotlib/release/osx/Makefile 2009-08-05 14:35:06 UTC (rev 7363) @@ -1,10 +1,10 @@ -PYVERSION=2.6 +PYVERSION=2.5 PYTHON=python${PYVERSION} SRCDIR=${PWD} ZLIBVERSION=1.2.3 PNGVERSION=1.2.33 FREETYPEVERSION=2.3.7 -MPLVERSION=0.99.0.rc1 +MPLVERSION=0.99.0.rc2 BDISTMPKGVERSION=0.4.4 MPLSRC=matplotlib-${MPLVERSION} MACOSX_DEPLOYMENT_TARGET=10.4 @@ -88,7 +88,7 @@ cp ../data/setup.cfg . &&\ export CFLAGS=${CFLAGS} &&\ export LDFLAGS=${LDFLAGS} &&\ - bdist_mpkg &&\ + /Library/Frameworks/Python.framework/Versions/${PYVERSION}/bin/bdist_mpkg &&\ ${PYTHON} setupegg.py bdist_egg &&\ cd dist && \ zip -ro matplotlib-${MPLVERSION}-py${PYVERSION}-macosx10.5_mpkg.zip matplotlib-${MPLVERSION}-py${PYVERSION}-macosx10.5.mpkg Modified: trunk/matplotlib/release/osx/README.txt =================================================================== --- trunk/matplotlib/release/osx/README.txt 2009-08-05 12:04:36 UTC (rev 7362) +++ trunk/matplotlib/release/osx/README.txt 2009-08-05 14:35:06 UTC (rev 7363) @@ -7,7 +7,7 @@ ------------- * :file:`bdist_mkpg` - the distutils.extension to build Installer.app - mpkg installers. + mpkg installers. * :file:`data` - some config files and patches needed for the build @@ -19,16 +19,22 @@ How to build -------------- -* You need a python framework build , numpy and wxpython to build the +* You need a python framework build, numpy and wxpython to build the mpl installers (wx requires this and we need wx to build the wxagg - extension). You can get the three required dependencies as - Installer apps, eg: + extension). I recommend building python from src as a framework build:: + ./configure --enable-universalsdk --enable-framework + sudo make install - http://www.python.org/ftp/python/2.6.2/python-2.6.2-macosx2009-04-16.dmg - http://downloads.sourceforge.net/project/numpy/NumPy/1.3.0/numpy-1.3.0-py2.6-macosx10.5.dmg?use_mirror=voxel - http://downloads.sourceforge.net/project/wxpython/wxPython/2.8.10.1/wxPython2.8-osx-unicode-2.8.10.1-universal-py2.6.dmg?use_mirror=voxel + and build numpy from src too since the 2.5 numpy installer doesn't work + with a python built from src:: + sudo python setup.py install + + you can use the pre-built installer for wx:: + + http://downloads.sourceforge.net/project/wxpython/wxPython/2.8.10.1/wxPython2.8-osx-unicode-2.8.10.1-universal-py2.6.dmg?use_mirror=voxel + * You need to make sure to unset PKG_CONFIG_PATH to make sure the static linking below is respected. Otherwise the mpl build script will dynamically link using the libs from pkgconfig if you have this This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2009-08-05 14:38:54
|
Revision: 7365 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7365&view=rev Author: jdh2358 Date: 2009-08-05 14:38:44 +0000 (Wed, 05 Aug 2009) Log Message: ----------- rename mpl_data to sample_data to avoid ambiguity with lib/matplotlib/mpl-data Modified Paths: -------------- trunk/matplotlib/examples/misc/mpl_data_demo.py trunk/matplotlib/examples/misc/mpl_data_test.py trunk/matplotlib/lib/matplotlib/cbook.py Modified: trunk/matplotlib/examples/misc/mpl_data_demo.py =================================================================== --- trunk/matplotlib/examples/misc/mpl_data_demo.py 2009-08-05 14:36:27 UTC (rev 7364) +++ trunk/matplotlib/examples/misc/mpl_data_demo.py 2009-08-05 14:38:44 UTC (rev 7365) @@ -1,10 +1,10 @@ """ -Grab mpl data from the ~/.matplotlib/mpl_data cache if it exists, else +Grab mpl data from the ~/.matplotlib/sample_data cache if it exists, else fetch it from svn and cache it """ import matplotlib.cbook as cbook import matplotlib.pyplot as plt -fname = cbook.get_mpl_data('lena.png', asfileobj=False) +fname = cbook.get_sample_data('lena.png', asfileobj=False) print 'fname', fname im = plt.imread(fname) Modified: trunk/matplotlib/examples/misc/mpl_data_test.py =================================================================== --- trunk/matplotlib/examples/misc/mpl_data_test.py 2009-08-05 14:36:27 UTC (rev 7364) +++ trunk/matplotlib/examples/misc/mpl_data_test.py 2009-08-05 14:38:44 UTC (rev 7365) @@ -1,13 +1,13 @@ """ -Demonstrate how get_mpl_data works with svn revisions in the data. +Demonstrate how get_sample_data works with svn revisions in the data. - svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/mpl_data + svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data and edit testdata.csv to add a new row. After committing the changes, when you rerun this script you will get the updated data (and the new -svn version will be cached in ~/.matplotlib/mpl_data) +svn version will be cached in ~/.matplotlib/sample_data) """ import matplotlib.cbook as cbook -fh = cbook.get_mpl_data("testdata.csv") +fh = cbook.get_sample_data("testdata.csv") print fh.read() Modified: trunk/matplotlib/lib/matplotlib/cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 14:36:27 UTC (rev 7364) +++ trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 14:38:44 UTC (rev 7365) @@ -458,12 +458,12 @@ result.msg = response.msg return result -def get_mpl_data(fname, asfileobj=True): +def get_sample_data(fname, asfileobj=True): """ - Check the cachedirectory ~/.matplotlib/mpl_data for an mpl_data + Check the cachedirectory ~/.matplotlib/sample_data for an sample_data file. If it does not exist, fetch it with urllib from the mpl svn repo - http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/mpl_data/ + http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/sample_data/ and store it in the cachedir. @@ -471,31 +471,31 @@ path to the file as a string will be returned To add a datafile to this directory, you need to check out - mpl_data from matplotlib svn:: + sample_data from matplotlib svn:: - svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/mpl_data + svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data and svn add the data file you want to support. This is primarily intended for use in mpl examples that need custom data """ - if not hasattr(get_mpl_data, 'opener'): + if not hasattr(get_sample_data, 'opener'): configdir = matplotlib.get_configdir() - cachedir = os.path.join(configdir, 'mpl_data') + cachedir = os.path.join(configdir, 'sample_data') if not os.path.exists(cachedir): os.mkdir(cachedir) # Store the cache processor and url opener as attributes of this function - get_mpl_data.processor = _CacheProcessor(cachedir) - get_mpl_data.opener = urllib2.build_opener(get_mpl_data.processor) + get_sample_data.processor = _CacheProcessor(cachedir) + get_sample_data.opener = urllib2.build_opener(get_sample_data.processor) - url = 'http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/mpl_data/' + \ + url = 'http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/sample_data/' + \ urllib2.quote(fname) - response = get_mpl_data.opener.open(url) + response = get_sample_data.opener.open(url) if asfileobj: return response else: response.close() - p = get_mpl_data.processor + p = get_sample_data.processor return p.in_cache_dir(p.cache[url][0]) def flatten(seq, scalarp=is_scalar_or_string): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2009-08-05 15:02:20
|
Revision: 7369 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7369&view=rev Author: jdh2358 Date: 2009-08-05 15:02:12 +0000 (Wed, 05 Aug 2009) Log Message: ----------- add support for nested dirs in sample_data Modified Paths: -------------- trunk/matplotlib/examples/misc/sample_data_test.py trunk/matplotlib/lib/matplotlib/cbook.py Modified: trunk/matplotlib/examples/misc/sample_data_test.py =================================================================== --- trunk/matplotlib/examples/misc/sample_data_test.py 2009-08-05 14:54:01 UTC (rev 7368) +++ trunk/matplotlib/examples/misc/sample_data_test.py 2009-08-05 15:02:12 UTC (rev 7369) @@ -9,5 +9,5 @@ """ import matplotlib.cbook as cbook -fh = cbook.get_sample_data("testdata.csv") +fh = cbook.get_sample_data('testdir/subdir/testsub.csv') print fh.read() Modified: trunk/matplotlib/lib/matplotlib/cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 14:54:01 UTC (rev 7368) +++ trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 15:02:12 UTC (rev 7369) @@ -349,8 +349,9 @@ Urllib2 handler that takes care of caching files. The file cache.pck holds the directory of files to be cached. """ - def __init__(self, cache_dir): + def __init__(self, cache_dir, baseurl): self.cache_dir = cache_dir + self.baseurl = baseurl self.read_cache() self.remove_stale_files() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2009-08-05 15:14:44
|
Revision: 7371 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7371&view=rev Author: jdh2358 Date: 2009-08-05 15:14:35 +0000 (Wed, 05 Aug 2009) Log Message: ----------- use proper file handle to the sample data Modified Paths: -------------- trunk/matplotlib/examples/misc/sample_data_test.py trunk/matplotlib/lib/matplotlib/cbook.py Modified: trunk/matplotlib/examples/misc/sample_data_test.py =================================================================== --- trunk/matplotlib/examples/misc/sample_data_test.py 2009-08-05 15:07:41 UTC (rev 7370) +++ trunk/matplotlib/examples/misc/sample_data_test.py 2009-08-05 15:14:35 UTC (rev 7371) @@ -8,6 +8,19 @@ svn version will be cached in ~/.matplotlib/sample_data) """ +import matplotlib.mlab as mlab import matplotlib.cbook as cbook -fh = cbook.get_sample_data('testdir/subdir/testsub.csv') + +# get the file handle to the cached data and print the contents +datafile = 'testdir/subdir/testsub.csv' +fh = cbook.get_sample_data(datafile) print fh.read() + +# make sure we can read it using csv2rec +fh.seek(0) +r = mlab.csv2rec(fh) + +print mlab.rec2txt(r) + +fh.close() + Modified: trunk/matplotlib/lib/matplotlib/cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 15:07:41 UTC (rev 7370) +++ trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 15:14:35 UTC (rev 7371) @@ -418,8 +418,8 @@ #while os.path.exists(self.in_cache_dir(fn)): # fn = rightmost + '.' + str(random.randint(0,9999999)) - - + + f = open(self.in_cache_dir(fn), 'wb') f.write(data) f.close() @@ -514,12 +514,15 @@ url = baseurl + quote(fname) response = get_sample_data.opener.open(url) + + p = get_sample_data.processor + relpath = p.cache[url][0] + fname = p.in_cache_dir(relpath) + if asfileobj: - return response + return file(fname) else: - response.close() - p = get_sample_data.processor - return p.in_cache_dir(p.cache[url][0]) + return fname def flatten(seq, scalarp=is_scalar_or_string): """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2009-08-05 15:37:15
|
Revision: 7373 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7373&view=rev Author: jdh2358 Date: 2009-08-05 15:37:08 +0000 (Wed, 05 Aug 2009) Log Message: ----------- make all-in-one sample data server class cbook.ViewVCCachedServer so it can be reused by other projects Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/cbook.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-08-05 15:26:30 UTC (rev 7372) +++ trunk/matplotlib/CHANGELOG 2009-08-05 15:37:08 UTC (rev 7373) @@ -1,4 +1,5 @@ -2009-08-04 Made cbook.get_mpl_data make use of the ETag and Last-Modified + +2009-08-04 Made cbook.get_sample_data make use of the ETag and Last-Modified headers of mod_dav_svn. - JKS 2009-08-03 Add PathCollection; modify contourf to use complex @@ -6,9 +7,9 @@ 2009-08-03 Fixed boilerplate.py so it doesn't break the ReST docs. - JKS -2009-07-31 Added cbook.get_mpl_data for urllib enabled fetching and +2009-07-31 Added cbook.get_sample_data for urllib enabled fetching and cacheing of data needed for examples. See - examples/misc/mpl_data_demo.py - JDH + examples/misc/sample_data_demo.py - JDH ====================================================================== Modified: trunk/matplotlib/lib/matplotlib/cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 15:26:30 UTC (rev 7372) +++ trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 15:37:08 UTC (rev 7373) @@ -344,7 +344,7 @@ def is_scalar_or_string(val): return is_string_like(val) or not iterable(val) -class _CacheProcessor(urllib2.BaseHandler): +class ViewVCCachedServer(urllib2.BaseHandler): """ Urllib2 handler that takes care of caching files. The file cache.pck holds the directory of files to be cached. @@ -354,6 +354,7 @@ self.baseurl = baseurl self.read_cache() self.remove_stale_files() + self.opener = urllib2.build_opener(self) def in_cache_dir(self, fn): # make sure the datadir exists @@ -394,7 +395,7 @@ if path not in listed and path != 'cache.pck': thisfile = os.path.join(self.cache_dir, path) if not os.path.isdir(thisfile): - matplotlib.verbose.report('_CacheProcessor:remove_stale_files: removing %s'%thisfile, + matplotlib.verbose.report('ViewVCCachedServer:remove_stale_files: removing %s'%thisfile, level='debug') os.remove(thisfile) @@ -451,7 +452,7 @@ url = req.get_full_url() fn, _, _ = self.cache[url] cachefile = self.in_cache_dir(fn) - matplotlib.verbose.report('_CacheProcessor: reading data file from cache file "%s"'%cachefile) + matplotlib.verbose.report('ViewVCCachedServer: reading data file from cache file "%s"'%cachefile) file = open(cachefile, 'rb') handle = urllib2.addinfourl(file, hdrs, url) handle.code = 304 @@ -473,9 +474,41 @@ result.msg = response.msg return result + def get_sample_data(self, fname, asfileobj=True): + """ + Check the cachedirectory for a sample_data file. If it does + not exist, fetch it with urllib from the svn repo and + store it in the cachedir. + + If asfileobj is True, a file object will be returned. Else the + path to the file as a string will be returned + + """ + + + # quote is not in python2.4, so check for it and get it from + # urllib if it is not available + quote = getattr(urllib2, 'quote', None) + if quote is None: + import urllib + quote = urllib.quote + + url = self.baseurl + quote(fname) + response = self.opener.open(url) + + + relpath = self.cache[url][0] + fname = self.in_cache_dir(relpath) + + if asfileobj: + return file(fname) + else: + return fname + + def get_sample_data(fname, asfileobj=True): """ - Check the cachedirectory ~/.matplotlib/sample_data for an sample_data + Check the cachedirectory ~/.matplotlib/sample_data for a sample_data file. If it does not exist, fetch it with urllib from the mpl svn repo http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/sample_data/ @@ -488,42 +521,22 @@ To add a datafile to this directory, you need to check out sample_data from matplotlib svn:: - svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data + svn co http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/sample_data and svn add the data file you want to support. This is primarily intended for use in mpl examples that need custom data """ - baseurl ='http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/sample_data/' - if not hasattr(get_sample_data, 'opener'): + myserver = get_sample_data.myserver + if myserver is None: configdir = matplotlib.get_configdir() cachedir = os.path.join(configdir, 'sample_data') - if not os.path.exists(cachedir): - os.mkdir(cachedir) - # Store the cache processor and url opener as attributes of this function - get_sample_data.processor = _CacheProcessor(cachedir, baseurl) - get_sample_data.opener = urllib2.build_opener(get_sample_data.processor) + baseurl = 'http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/sample_data/' + myserver = get_sample_data.myserver = ViewVCCachedServer(cachedir, baseurl) + return myserver.get_sample_data(fname, asfileobj=asfileobj) - # quote is not in python2.4, so check for it and get it from - # urllib if it is not available - quote = getattr(urllib2, 'quote', None) - if quote is None: - import urllib - quote = urllib.quote - - url = baseurl + quote(fname) - response = get_sample_data.opener.open(url) - - p = get_sample_data.processor - relpath = p.cache[url][0] - fname = p.in_cache_dir(relpath) - - if asfileobj: - return file(fname) - else: - return fname - +get_sample_data.myserver = None def flatten(seq, scalarp=is_scalar_or_string): """ this generator flattens nested containers such as This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2009-08-05 15:44:06
|
Revision: 7375 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7375&view=rev Author: jdh2358 Date: 2009-08-05 15:43:54 +0000 (Wed, 05 Aug 2009) Log Message: ----------- move demo image into axes_grid package so examples will run from anywhere Modified Paths: -------------- trunk/matplotlib/examples/axes_grid/demo_axes_divider.py trunk/matplotlib/examples/axes_grid/demo_axes_grid.py trunk/matplotlib/examples/axes_grid/inset_locator_demo2.py trunk/matplotlib/examples/axes_grid/simple_axesgrid2.py trunk/matplotlib/examples/axes_grid/simple_rgb.py Added Paths: ----------- trunk/matplotlib/lib/mpl_toolkits/axes_grid/demo_image.py Removed Paths: ------------- trunk/matplotlib/examples/axes_grid/demo_image.py Modified: trunk/matplotlib/examples/axes_grid/demo_axes_divider.py =================================================================== --- trunk/matplotlib/examples/axes_grid/demo_axes_divider.py 2009-08-05 15:40:22 UTC (rev 7374) +++ trunk/matplotlib/examples/axes_grid/demo_axes_divider.py 2009-08-05 15:43:54 UTC (rev 7375) @@ -1,5 +1,5 @@ import matplotlib.pyplot as plt -from demo_image import get_demo_image +from mpl_toolkits.axes_grid.demo_image import get_demo_image #import mpl_toolkits.imaging.axes_grid as imaging def demo_simple_image(ax): Modified: trunk/matplotlib/examples/axes_grid/demo_axes_grid.py =================================================================== --- trunk/matplotlib/examples/axes_grid/demo_axes_grid.py 2009-08-05 15:40:22 UTC (rev 7374) +++ trunk/matplotlib/examples/axes_grid/demo_axes_grid.py 2009-08-05 15:43:54 UTC (rev 7375) @@ -1,5 +1,5 @@ import matplotlib.pyplot as plt -from demo_image import get_demo_image +from mpl_toolkits.axes_grid.demo_image import get_demo_image from mpl_toolkits.axes_grid import AxesGrid Deleted: trunk/matplotlib/examples/axes_grid/demo_image.py =================================================================== --- trunk/matplotlib/examples/axes_grid/demo_image.py 2009-08-05 15:40:22 UTC (rev 7374) +++ trunk/matplotlib/examples/axes_grid/demo_image.py 2009-08-05 15:43:54 UTC (rev 7375) @@ -1,17 +0,0 @@ -import numpy as np - -def get_demo_image(): - # prepare image - delta = 0.5 - - extent = (-3,4,-4,3) - x = np.arange(-3.0, 4.001, delta) - y = np.arange(-4.0, 3.001, delta) - X, Y = np.meshgrid(x, y) - import matplotlib.mlab as mlab - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = (Z1 - Z2) * 10 - - return Z, extent - Modified: trunk/matplotlib/examples/axes_grid/inset_locator_demo2.py =================================================================== --- trunk/matplotlib/examples/axes_grid/inset_locator_demo2.py 2009-08-05 15:40:22 UTC (rev 7374) +++ trunk/matplotlib/examples/axes_grid/inset_locator_demo2.py 2009-08-05 15:43:54 UTC (rev 7375) @@ -5,7 +5,7 @@ import numpy as np -from demo_image import get_demo_image +from mpl_toolkits.axes_grid.demo_image import get_demo_image fig = plt.figure(1, [5,4]) Modified: trunk/matplotlib/examples/axes_grid/simple_axesgrid2.py =================================================================== --- trunk/matplotlib/examples/axes_grid/simple_axesgrid2.py 2009-08-05 15:40:22 UTC (rev 7374) +++ trunk/matplotlib/examples/axes_grid/simple_axesgrid2.py 2009-08-05 15:43:54 UTC (rev 7375) @@ -1,6 +1,6 @@ import matplotlib.pyplot as plt from mpl_toolkits.axes_grid import AxesGrid -from demo_image import get_demo_image +from mpl_toolkits.axes_grid.demo_image import get_demo_image F = plt.figure(1, (5.5, 3.5)) grid = AxesGrid(F, 111, # similar to subplot(111) Modified: trunk/matplotlib/examples/axes_grid/simple_rgb.py =================================================================== --- trunk/matplotlib/examples/axes_grid/simple_rgb.py 2009-08-05 15:40:22 UTC (rev 7374) +++ trunk/matplotlib/examples/axes_grid/simple_rgb.py 2009-08-05 15:43:54 UTC (rev 7375) @@ -1,6 +1,6 @@ import matplotlib.pyplot as plt -from demo_image import get_demo_image +from mpl_toolkits.axes_grid.demo_image import get_demo_image from mpl_toolkits.axes_grid.axes_rgb import RGBAxes def get_rgb(): Added: trunk/matplotlib/lib/mpl_toolkits/axes_grid/demo_image.py =================================================================== --- trunk/matplotlib/lib/mpl_toolkits/axes_grid/demo_image.py (rev 0) +++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/demo_image.py 2009-08-05 15:43:54 UTC (rev 7375) @@ -0,0 +1,17 @@ +import numpy as np + +def get_demo_image(): + # prepare image + delta = 0.5 + + extent = (-3,4,-4,3) + x = np.arange(-3.0, 4.001, delta) + y = np.arange(-4.0, 3.001, delta) + X, Y = np.meshgrid(x, y) + import matplotlib.mlab as mlab + Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) + Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) + Z = (Z1 - Z2) * 10 + + return Z, extent + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2009-08-05 17:59:20
|
Revision: 7392 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7392&view=rev Author: jdh2358 Date: 2009-08-05 17:59:12 +0000 (Wed, 05 Aug 2009) Log Message: ----------- fixed some svn doc bugs; Modified Paths: -------------- trunk/matplotlib/doc/devel/coding_guide.rst trunk/matplotlib/lib/matplotlib/cbook.py Modified: trunk/matplotlib/doc/devel/coding_guide.rst =================================================================== --- trunk/matplotlib/doc/devel/coding_guide.rst 2009-08-05 17:36:27 UTC (rev 7391) +++ trunk/matplotlib/doc/devel/coding_guide.rst 2009-08-05 17:59:12 UTC (rev 7392) @@ -579,7 +579,7 @@ accessed using :func:`matplotlib.cbook.get_sample_data`. First get a copy of the repository and svn add your data:: - svn co http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/sample_data + svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data cp ~/path/to/mydata.dat sample_data/ cd sample_data svn add mydata.dat Modified: trunk/matplotlib/lib/matplotlib/cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 17:36:27 UTC (rev 7391) +++ trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-05 17:59:12 UTC (rev 7392) @@ -521,7 +521,7 @@ To add a datafile to this directory, you need to check out sample_data from matplotlib svn:: - svn co http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/sample_data + svn co https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/trunk/sample_data and svn add the data file you want to support. This is primarily intended for use in mpl examples that need custom data This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2009-08-05 19:18:35
|
Revision: 7394 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7394&view=rev Author: leejjoon Date: 2009-08-05 19:18:26 +0000 (Wed, 05 Aug 2009) Log Message: ----------- Merged revisions 7393 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint ........ r7393 | leejjoon | 2009-08-05 15:12:38 -0400 (Wed, 05 Aug 2009) | 1 line fix typo in axes_divider.py. use nanmin, nanmax in angle_helper.py (patch by Christoph Gohlke) ........ Modified Paths: -------------- trunk/matplotlib/lib/mpl_toolkits/axes_grid/angle_helper.py trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_divider.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/examples/misc/multiprocess.py trunk/matplotlib/examples/mplot3d/contour3d_demo.py trunk/matplotlib/examples/mplot3d/contourf3d_demo.py trunk/matplotlib/examples/mplot3d/polys3d_demo.py trunk/matplotlib/examples/mplot3d/scatter3d_demo.py trunk/matplotlib/examples/mplot3d/surface3d_demo.py trunk/matplotlib/examples/mplot3d/wire3d_demo.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7362 + /branches/mathtex:1-7263 /branches/v0_99_maint:1-7393 /branches/v0_98_5_maint:1-7253 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393 Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393 Property changes on: trunk/matplotlib/examples/misc/multiprocess.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7338 + /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393 Property changes on: trunk/matplotlib/examples/mplot3d/contour3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338 + /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393 Property changes on: trunk/matplotlib/examples/mplot3d/contourf3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338 + /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393 Property changes on: trunk/matplotlib/examples/mplot3d/polys3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338 + /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393 Property changes on: trunk/matplotlib/examples/mplot3d/scatter3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338 + /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393 Property changes on: trunk/matplotlib/examples/mplot3d/surface3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338 + /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393 Property changes on: trunk/matplotlib/examples/mplot3d/wire3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338 + /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393 Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/angle_helper.py =================================================================== --- trunk/matplotlib/lib/mpl_toolkits/axes_grid/angle_helper.py 2009-08-05 19:12:38 UTC (rev 7393) +++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/angle_helper.py 2009-08-05 19:18:26 UTC (rev 7394) @@ -293,14 +293,14 @@ # iron out jumps, but algorithm should be improved. # Tis is just naive way of doing and my fail for some cases. if self.lon_cycle is not None: - lon0 = lon.min() + lon0 = np.nanmin(lon) lon -= 360. * ((lon - lon0) > 180.) if self.lat_cycle is not None: - lat0 = lat.min() + lat0 = np.nanmin(lat) lat -= 360. * ((lat - lat0) > 180.) - lon_min, lon_max = lon.min(), lon.max() - lat_min, lat_max = lat.min(), lat.max() + lon_min, lon_max = np.nanmin(lon), np.nanmax(lon) + lat_min, lat_max = np.nanmin(lat), np.nanmax(lat) lon_min, lon_max, lat_min, lat_max = \ self._adjust_extremes(lon_min, lon_max, lat_min, lat_max) Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_divider.py =================================================================== --- trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_divider.py 2009-08-05 19:12:38 UTC (rev 7393) +++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/axes_divider.py 2009-08-05 19:18:26 UTC (rev 7394) @@ -544,7 +544,7 @@ def apply_aspect(self, position=None): if self.get_axes_locator() is None: - self._axes_class.apply_apsect(self, position) + self._axes_class.apply_aspect(self, position) else: pos = self.get_axes_locator()(self, self._locator_renderer) self._axes_class.apply_aspect(self, position=pos) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2009-08-06 17:09:39
|
Revision: 7405 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7405&view=rev Author: jdh2358 Date: 2009-08-06 17:09:25 +0000 (Thu, 06 Aug 2009) Log Message: ----------- Merged revisions 7395-7398,7400-7404 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint ........ r7395 | jdh2358 | 2009-08-05 12:49:43 -0700 (Wed, 05 Aug 2009) | 1 line fixed an alpha colormapping bug posted on sf 2832575 ........ r7396 | jdh2358 | 2009-08-06 04:53:23 -0700 (Thu, 06 Aug 2009) | 1 line removed pylab load and save ........ r7397 | jdh2358 | 2009-08-06 05:02:33 -0700 (Thu, 06 Aug 2009) | 1 line tagging for 0.99 release ........ r7398 | jdh2358 | 2009-08-06 05:17:45 -0700 (Thu, 06 Aug 2009) | 1 line final build of 0.99.0 ........ r7400 | jdh2358 | 2009-08-06 07:55:54 -0700 (Thu, 06 Aug 2009) | 1 line update whats new ........ r7401 | jdh2358 | 2009-08-06 07:58:37 -0700 (Thu, 06 Aug 2009) | 1 line update whats new ........ r7402 | jdh2358 | 2009-08-06 08:10:45 -0700 (Thu, 06 Aug 2009) | 1 line some updates for the release docs ........ r7403 | leejjoon | 2009-08-06 09:11:30 -0700 (Thu, 06 Aug 2009) | 1 line fix legend bug ignoring CircleCollection ........ r7404 | jdh2358 | 2009-08-06 09:41:18 -0700 (Thu, 06 Aug 2009) | 1 line some updates to site docs for release ........ Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/doc/_templates/index.html trunk/matplotlib/doc/_templates/indexsidebar.html trunk/matplotlib/doc/api/api_changes.rst trunk/matplotlib/doc/faq/installing_faq.rst trunk/matplotlib/doc/users/annotations.rst trunk/matplotlib/doc/users/plotting.rst trunk/matplotlib/doc/users/whats_new.rst trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/colors.py trunk/matplotlib/lib/matplotlib/pylab.py trunk/matplotlib/release/osx/Makefile trunk/matplotlib/release/osx/README.txt Added Paths: ----------- trunk/matplotlib/doc/pyplots/whats_new_99_axes_grid.py trunk/matplotlib/doc/pyplots/whats_new_99_mplot3d.py trunk/matplotlib/doc/pyplots/whats_new_99_spines.py trunk/matplotlib/release/osx/data/ReadMe.txt Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/examples/misc/multiprocess.py trunk/matplotlib/examples/mplot3d/contour3d_demo.py trunk/matplotlib/examples/mplot3d/contourf3d_demo.py trunk/matplotlib/examples/mplot3d/polys3d_demo.py trunk/matplotlib/examples/mplot3d/scatter3d_demo.py trunk/matplotlib/examples/mplot3d/surface3d_demo.py trunk/matplotlib/examples/mplot3d/wire3d_demo.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/mathtex:1-7263 /branches/v0_99_maint:1-7393 /branches/v0_98_5_maint:1-7253 + /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7404 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393,7395-7404 Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-08-06 16:41:18 UTC (rev 7404) +++ trunk/matplotlib/CHANGELOG 2009-08-06 17:09:25 UTC (rev 7405) @@ -1,18 +1,54 @@ +2009-08-06 Tagging the 0.99.0 release at svn r7397 - JDH + * fixed an alpha colormapping bug posted on sf 2832575 + + * fix typo in axes_divider.py. use nanmin, nanmax in angle_helper.py + (patch by Christoph Gohlke) + + * remove dup gui event in enter/leave events in gtk + + * lots of fixes for os x binaries (Thanks Russell Owen) + + * attach gtk events to mpl events -- fixes sf bug 2816580 + + * applied sf patch 2815064 (middle button events for wx) and + patch 2818092 (resize events for wx) + + * fixed boilerplate.py so it doesn't break the ReST docs. + + * removed a couple of cases of mlab.load + + * fixed rec2csv win32 file handle bug from sf patch 2831018 + + * added two examples from Josh Hemann: examples/pylab_examples/barchart_demo2.py + and examples/pylab_examples/boxplot_demo2.py + + * handled sf bugs 2831556 and 2830525; better bar error messages and + backend driver configs + + * added miktex win32 patch from sf patch 2820194 + + * apply sf patches 2830233 and 2823885 for osx setup and 64 bit; thanks Michiel + + 2009-08-04 Made cbook.get_sample_data make use of the ETag and Last-Modified headers of mod_dav_svn. - JKS 2009-08-03 Add PathCollection; modify contourf to use complex paths instead of simple paths with cuts. - EF + 2009-08-03 Fixed boilerplate.py so it doesn't break the ReST docs. - JKS +2009-08-03 pylab no longer provides a load and save function. These + are available in matplotlib.mlab, or you can use + numpy.loadtxt and numpy.savetxt for text files, or np.save + and np.load for binary numpy arrays. - JDH + 2009-07-31 Added cbook.get_sample_data for urllib enabled fetching and cacheing of data needed for examples. See examples/misc/sample_data_demo.py - JDH -====================================================================== - 2009-07-31 Tagging 0.99.0.rc1 at 7314 - MGD 2009-07-30 Add set_cmap and register_cmap, and improve get_cmap, Modified: trunk/matplotlib/doc/_templates/index.html =================================================================== --- trunk/matplotlib/doc/_templates/index.html 2009-08-06 16:41:18 UTC (rev 7404) +++ trunk/matplotlib/doc/_templates/index.html 2009-08-06 17:09:25 UTC (rev 7405) @@ -1,9 +1,9 @@ {% extends "layout.html" %} {% set title = 'matplotlib: python plotting' %} - + {% block body %} - <h1>mpl</h1> + <h1>intro</h1> <p>matplotlib is a python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and @@ -41,7 +41,7 @@ <a href="http://scipy.org/Numpy_Example_List_With_Doc">numpy</a> and <a href="api/mlab_api.html">matplotlib.mlab</a>.</p> - <h3>Plotting commands</h3> <br/> + <h3>plotting commands</h3> <br/> <table border="1" cellpadding="3" cellspacing="2"> Modified: trunk/matplotlib/doc/_templates/indexsidebar.html =================================================================== --- trunk/matplotlib/doc/_templates/indexsidebar.html 2009-08-06 16:41:18 UTC (rev 7404) +++ trunk/matplotlib/doc/_templates/indexsidebar.html 2009-08-06 17:09:25 UTC (rev 7405) @@ -3,33 +3,26 @@ <p>Please <a href="http://sourceforge.net/project/project_donations.php?group_id=80706">donate</a> to support matplotlib development.</p> - -<p>A release candidate rc2 of matplotlib-0.99.0 is <a href="http://drop.io/xortel1#">available</a> for testing. Please post any bugs to the <a href="http://sourceforge.net/tracker2/?group_id=80706">tracker</a> + +<p>matplotlib 0.99 is available for <a href="http://sourceforge.net/projects/matplotlib">download</a>. See <a href="{{ pathto('users/whats_new') }}">what's new</a> and tips on <a href="{{ +pathto('users/installing') }}">installing</a> </p> <p>Watch a <a href="http://videolectures.net/mloss08_hunter_mat">video lecture</a> about matplotlib presented at <a href="http://videolectures.net/mloss08_whistler">NIPS 08 Workshop</a> <i>Machine Learning Open Source Software</i></a>. </p> -<h3>Download</h3> - -<p>Current version: <b>{{ version }}</b></p> - - -<p>Download matplotlib from the -sourceforge <a href="http://sourceforge.net/projects/matplotlib">project</a> -page (but first take a look at the <a href="{{ -pathto('users/installing') }}">installing</a> page). Here's a summary -of <a href="{{ pathto('users/whats_new') }}">what's new</a>. </p> - <p>There are several matplotlib addon <a href="{{ pathto('users/toolkits') }}">toolkits</a>, including the projection and mapping toolkit -<a href="http://matplotlib.sf.net/basemap/doc/html">basemap</a>.</p> +<a href="http://matplotlib.sf.net/basemap/doc/html">basemap</a>, 3d plotting with <a href="{{ +pathto('mpl_toolkits/mplot3d/index') }}">mplot3d</a>, wild and wonderful axes and axis helpers in <a href="{{ +pathto('mpl_toolkits/axes_grid/index') }}">axes_grid</a> and more. + </p> <h3>Need help?</h3> -<p>Check the <a href="{{ pathto('users/index') }}">user</a> guide, +<p>Check the <a href="{{ pathto('users/index') }}">user guide</a>, the <a href="{{ pathto('faq/index') }}">faq</a>, the <a href="{{ pathto('api/index') }}">api</a> docs, <a href="http://www.nabble.com/matplotlib---users-f2906.html">archives</a>, Modified: trunk/matplotlib/doc/api/api_changes.rst =================================================================== --- trunk/matplotlib/doc/api/api_changes.rst 2009-08-06 16:41:18 UTC (rev 7404) +++ trunk/matplotlib/doc/api/api_changes.rst 2009-08-06 17:09:25 UTC (rev 7405) @@ -18,9 +18,14 @@ .. _configobj: http://www.voidspace.org.uk/python/configobj.html .. _`enthought.traits`: http://code.enthought.com/projects/traits -Changes beyond 0.98.x -===================== +Changes in 0.99 +====================== +* pylab no longer provides a load and save function. These are + available in matplotlib.mlab, or you can use numpy.loadtxt and + numpy.savetxt for text files, or np.save and np.load for binary + numpy arrays. + * User-generated colormaps can now be added to the set recognized by :func:`matplotlib.cm.get_cmap`. Colormaps can be made the default and applied to the current image using Modified: trunk/matplotlib/doc/faq/installing_faq.rst =================================================================== --- trunk/matplotlib/doc/faq/installing_faq.rst 2009-08-06 16:41:18 UTC (rev 7404) +++ trunk/matplotlib/doc/faq/installing_faq.rst 2009-08-06 17:09:25 UTC (rev 7405) @@ -293,23 +293,21 @@ ----------------------- If you want to install matplotlib from one of the binary installers we -build, you have two choices: a mpkg installer, which is a typical +build, you have two choices: a dmg installer, which is a typical Installer.app, or an binary OSX egg, which you can install via setuptools easy_install. + +The mkpg installer will have a "dmg" extension, and will have a name +like :file:`matplotlib-0.99.0-py2.5-macosx10.5.dmg` depending on the +python, matplotlib, and OSX versions. Save this file and double +click it, which will open up a folder with a file in it that has the +mpkg extension. Double click this to run the Installer.app, which +will prompt you for a password if you need system wide installation +privileges, and install to a directory like +:file:`/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages`, +again depedending on your python version. This directory should be in +your python path, so you can test your installation with:: -The mkpg installer will have a "zip" extension, and will have a name -like file:`matplotlib-0.99.0.rc1-py2.5-macosx10.5_mpkg.zip` depending on -the python, matplotlib, and OSX versions. You need to unzip this file -using either the "unzip" command on OSX, or simply double clicking on -it to run StuffIt Expander. When you double click on the resultant -mpkd directory, which will have a name like -file:`matplotlib-0.99.0.rc1-py2.5-macosx10.5.mpkg`, it will run the -Installer.app, prompt you for a password if you need system wide -installation privileges, and install to a directory like -file:`/Library/Python/2.5/site-packages/`, again depedending on your -python version. This directory may not be in your python path, so you -can test your installation with:: - > python -c 'import matplotlib; print matplotlib.__version__, matplotlib.__file__' If you get an error like:: @@ -320,9 +318,9 @@ then you will need to set your PYTHONPATH, eg:: - export PYTHONPATH=/Library/Python/2.5/site-packages:$PYTHONPATH + export PYTHONPATH=/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages:$PYTHONPATH -See also ref:`environment-variables`. +See also :ref:`environment-variables`. .. _easy-install-osx-egg: Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404 Copied: trunk/matplotlib/doc/pyplots/whats_new_99_axes_grid.py (from rev 7404, branches/v0_99_maint/doc/pyplots/whats_new_99_axes_grid.py) =================================================================== --- trunk/matplotlib/doc/pyplots/whats_new_99_axes_grid.py (rev 0) +++ trunk/matplotlib/doc/pyplots/whats_new_99_axes_grid.py 2009-08-06 17:09:25 UTC (rev 7405) @@ -0,0 +1,47 @@ +import numpy as np +import matplotlib.pyplot as plt +from mpl_toolkits.axes_grid.axes_rgb import RGBAxes + +def get_demo_image(): + # prepare image + delta = 0.5 + + extent = (-3,4,-4,3) + x = np.arange(-3.0, 4.001, delta) + y = np.arange(-4.0, 3.001, delta) + X, Y = np.meshgrid(x, y) + import matplotlib.mlab as mlab + Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) + Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) + Z = (Z1 - Z2) * 10 + + return Z, extent + + + +def get_rgb(): + Z, extent = get_demo_image() + + Z[Z<0] = 0. + Z = Z/Z.max() + + R = Z[:13,:13] + G = Z[2:,2:] + B = Z[:13,2:] + + return R, G, B + + +fig = plt.figure(1) +ax = RGBAxes(fig, [0.1, 0.1, 0.8, 0.8]) + +r, g, b = get_rgb() +kwargs = dict(origin="lower", interpolation="nearest") +ax.imshow_rgb(r, g, b, **kwargs) + +ax.RGB.set_xlim(0., 9.5) +ax.RGB.set_ylim(0.9, 10.6) + + +plt.draw() +plt.show() Copied: trunk/matplotlib/doc/pyplots/whats_new_99_mplot3d.py (from rev 7404, branches/v0_99_maint/doc/pyplots/whats_new_99_mplot3d.py) =================================================================== --- trunk/matplotlib/doc/pyplots/whats_new_99_mplot3d.py (rev 0) +++ trunk/matplotlib/doc/pyplots/whats_new_99_mplot3d.py 2009-08-06 17:09:25 UTC (rev 7405) @@ -0,0 +1,17 @@ +from mpl_toolkits.mplot3d import Axes3D +from matplotlib import cm +import pylab +import random +import numpy as np + +fig = pylab.figure() +ax = Axes3D(fig) +X = np.arange(-5, 5, 0.25) +Y = np.arange(-5, 5, 0.25) +X, Y = np.meshgrid(X, Y) +R = np.sqrt(X**2 + Y**2) +Z = np.sin(R) +ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet) + +pylab.show() + Copied: trunk/matplotlib/doc/pyplots/whats_new_99_spines.py (from rev 7404, branches/v0_99_maint/doc/pyplots/whats_new_99_spines.py) =================================================================== --- trunk/matplotlib/doc/pyplots/whats_new_99_spines.py (rev 0) +++ trunk/matplotlib/doc/pyplots/whats_new_99_spines.py 2009-08-06 17:09:25 UTC (rev 7405) @@ -0,0 +1,47 @@ +import matplotlib.pyplot as plt +import numpy as np +from matplotlib.pyplot import show + + +def adjust_spines(ax,spines): + for loc, spine in ax.spines.iteritems(): + if loc in spines: + spine.set_position(('outward',10)) # outward by 10 points + else: + spine.set_color('none') # don't draw spine + + # turn off ticks where there is no spine + if 'left' in spines: + ax.yaxis.set_ticks_position('left') + else: + # no yaxis ticks + ax.yaxis.set_ticks([]) + + if 'bottom' in spines: + ax.xaxis.set_ticks_position('bottom') + else: + # no xaxis ticks + ax.xaxis.set_ticks([]) + +fig = plt.figure() + +x = np.linspace(0,2*np.pi,100) +y = 2*np.sin(x) + +ax = fig.add_subplot(2,2,1) +ax.plot(x,y) +adjust_spines(ax,['left']) + +ax = fig.add_subplot(2,2,2) +ax.plot(x,y) +adjust_spines(ax,[]) + +ax = fig.add_subplot(2,2,3) +ax.plot(x,y) +adjust_spines(ax,['left','bottom']) + +ax = fig.add_subplot(2,2,4) +ax.plot(x,y) +adjust_spines(ax,['bottom']) + +show() Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404 Modified: trunk/matplotlib/doc/users/annotations.rst =================================================================== --- trunk/matplotlib/doc/users/annotations.rst 2009-08-06 16:41:18 UTC (rev 7404) +++ trunk/matplotlib/doc/users/annotations.rst 2009-08-06 17:09:25 UTC (rev 7405) @@ -3,6 +3,9 @@ Annotating text =============== +For a more detailed introduction to annotations, see +:ref:`plotting-guide-annotation`. + The uses of the basic :func:`~matplotlib.pyplot.text` command above place text at an arbitrary position on the Axes. A common use case of text is to annotate some feature of the plot, and the Modified: trunk/matplotlib/doc/users/plotting.rst =================================================================== --- trunk/matplotlib/doc/users/plotting.rst 2009-08-06 16:41:18 UTC (rev 7404) +++ trunk/matplotlib/doc/users/plotting.rst 2009-08-06 17:09:25 UTC (rev 7405) @@ -152,5 +152,4 @@ :ref:`plotting-guide-annotation` -TODO; see :ref:`how-to-contribute-docs`. Modified: trunk/matplotlib/doc/users/whats_new.rst =================================================================== --- trunk/matplotlib/doc/users/whats_new.rst 2009-08-06 16:41:18 UTC (rev 7404) +++ trunk/matplotlib/doc/users/whats_new.rst 2009-08-06 17:09:25 UTC (rev 7405) @@ -1,28 +1,70 @@ .. _whats-new: -*************************** +************************ What's new in matplotlib -*************************** +************************ -.. _whats-new-svn: +This page just covers the highlights -- for the full story, see the +`CHANGELOG <http://matplotlib.sourceforge.net/_static/CHANGELOG>`_ -What new in svn -=============== +new in matplotlib-0.99 +====================== +.. _whats-new-mplot3d: + +mplot3d +-------- + + +Reinier Heeres has ported John Porter's mplot3d over to the new +matplotlib transformations framework, and it is now available as a +toolkit mpl_toolkits.mplot3d. See the `examples +<http://matplotlib.sourceforge.net/examples/mplot3d/index.html>`_ and +:ref:`toolkit_mplot3d-tutorial` + +.. plot:: pyplots/whats_new_99_mplot3d.py + +.. _whats-new-axes-grid: + +axes grid toolkit +----------------- + +Jae Joon has added a new toolkit to ease displaying multiple images in +matplotlib, as well as some support for curvilinear grids to support +the world coordinate system. See :ref:`axes_grid_users-guide-index` +and `examples <http://matplotlib.sourceforge.net/examples/axes_grid/index.html>`_ + +.. plot:: pyplots/whats_new_99_axes_grid.py + +.. _whats-new-spine: + Axis spine placement -------------------- Andrew Straw has added the ability to place "axis spines" -- the lines -that denote the data limits -- in various arbitrary locations. See +that denote the data limits -- in various arbitrary locations. No +longer are your axis lines constrained to be a simple rectangle around +the figure -- you can turn on or off left, bottom, right and top, as +well as "detach" the spine to offset it away from the data. See +:ref:`pylab_examples-spine_placement_demo` and :class:`matplotlib.spines.Spine`. +.. plot:: pyplots/whats_new_99_spines.py + + +New documentation +----------------- + +jae-Joon Lee has written two new guides :ref:`plotting-guide-legend` +and :ref:`plotting-guide-annotation`. + .. _whats-new-0-98-4: -What new in 0.98.4 -============================== +new in 0.98.4 +============= It's been four months since the last matplotlib release, and there are -a lot of new features and bug-fixes. +a lot of new features and bug-fixes. Thanks to Charlie Moad for testing and preparing the source release, including binaries for OS X and Windows for python 2.4 and 2.5 (2.6 Property changes on: trunk/matplotlib/examples/misc/multiprocess.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393 + /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404 Property changes on: trunk/matplotlib/examples/mplot3d/contour3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393 + /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404 Property changes on: trunk/matplotlib/examples/mplot3d/contourf3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393 + /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404 Property changes on: trunk/matplotlib/examples/mplot3d/polys3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393 + /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404 Property changes on: trunk/matplotlib/examples/mplot3d/scatter3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393 + /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404 Property changes on: trunk/matplotlib/examples/mplot3d/surface3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393 + /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404 Property changes on: trunk/matplotlib/examples/mplot3d/wire3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393 + /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404 Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-08-06 16:41:18 UTC (rev 7404) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-08-06 17:09:25 UTC (rev 7405) @@ -3819,6 +3819,8 @@ if isinstance(c, mcoll.LineCollection)]) handles.extend([c for c in self.collections if isinstance(c, mcoll.RegularPolyCollection)]) + handles.extend([c for c in self.collections + if isinstance(c, mcoll.CircleCollection)]) return handles Modified: trunk/matplotlib/lib/matplotlib/colors.py =================================================================== --- trunk/matplotlib/lib/matplotlib/colors.py 2009-08-06 16:41:18 UTC (rev 7404) +++ trunk/matplotlib/lib/matplotlib/colors.py 2009-08-06 17:09:25 UTC (rev 7405) @@ -488,7 +488,7 @@ if not self._isinit: self._init() alpha = min(alpha, 1.0) # alpha must be between 0 and 1 alpha = max(alpha, 0.0) - self._lut[:-3, -1] = alpha + self._lut[:,-1] = alpha mask_bad = None if not cbook.iterable(X): vtype = 'scalar' Modified: trunk/matplotlib/lib/matplotlib/pylab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/pylab.py 2009-08-06 16:41:18 UTC (rev 7404) +++ trunk/matplotlib/lib/matplotlib/pylab.py 2009-08-06 17:09:25 UTC (rev 7405) @@ -236,6 +236,9 @@ base_repr, binary_repr, log2, ispower2, \ rec_append_fields, rec_drop_fields, rec_join, csv2rec, rec2csv, isvector +import matplotlib.mlab as mlab +import matplotlib.cbook as cbook + from numpy import * from numpy.fft import * from numpy.random import * @@ -248,3 +251,25 @@ import numpy as np import numpy.ma as ma +def load(*args, **kwargs): + raise NotImplementedError(load.__doc__) +load.__doc__ = """\ + pylab no longer provides a load function, though the old pylab + function is still available as matplotlib.mlab.load (you can refer + to it in pylab as "mlab.load"). However, for plain text files, we + recommend numpy.loadtxt, which was inspired by the old pylab.load + but now has more features. For loading numpy arrays, we recommend + numpy.load, and its analog numpy.save, which are available in + pylab as np.load and np.save. + """ + + +def save(*args, **kwargs): + raise NotImplementedError(save.__doc__) +save.__doc__ = """\ + pylab no longer provides a save function, though the old pylab + function is still available as matplotlib.mlab.save (you can still + refer to it in pylab as "mlab.save"). However, for plain text + files, we recommend numpy.savetxt. For saving numpy arrays, + we recommend numpy.save, and its analog numpy.load, which are + available in pylab as np.save and np.load.""" Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404 Modified: trunk/matplotlib/release/osx/Makefile =================================================================== --- trunk/matplotlib/release/osx/Makefile 2009-08-06 16:41:18 UTC (rev 7404) +++ trunk/matplotlib/release/osx/Makefile 2009-08-06 17:09:25 UTC (rev 7405) @@ -1,10 +1,10 @@ -PYVERSION=2.5 +PYVERSION=2.6 PYTHON=python${PYVERSION} SRCDIR=${PWD} ZLIBVERSION=1.2.3 PNGVERSION=1.2.33 FREETYPEVERSION=2.3.7 -MPLVERSION=0.99.0.rc2 +MPLVERSION=0.99.0 BDISTMPKGVERSION=0.4.4 MPLSRC=matplotlib-${MPLVERSION} MACOSX_DEPLOYMENT_TARGET=10.4 @@ -28,7 +28,7 @@ zlib-${ZLIBVERSION} libpng-${PNGVERSION} freetype-${FREETYPEVERSION} \ matplotlib-${MPLVERSION} *~ -fetch_deps: +fetch: wget http://www.zlib.net/zlib-${ZLIBVERSION}.tar.gz &&\ wget http://internap.dl.sourceforge.net/sourceforge/libpng/libpng-${PNGVERSION}.tar.bz2 &&\ wget http://download.savannah.gnu.org/releases/freetype/freetype-${FREETYPEVERSION}.tar.bz2&&\ @@ -77,7 +77,7 @@ cp objs/.libs/libfreetype.a . &&\ unset MACOSX_DEPLOYMENT_TARGET -dependencies: +deps: make zlib png freetype installers: @@ -85,13 +85,12 @@ tar xvfz matplotlib-${MPLVERSION}.tar.gz && \ cd ${MPLSRC} && \ rm -rf build && \ - cp ../data/setup.cfg . &&\ + cp ../data/setup.cfg ../data/ReadMe.txt . &&\ export CFLAGS=${CFLAGS} &&\ export LDFLAGS=${LDFLAGS} &&\ - /Library/Frameworks/Python.framework/Versions/${PYVERSION}/bin/bdist_mpkg &&\ - ${PYTHON} setupegg.py bdist_egg &&\ - cd dist && \ - zip -ro matplotlib-${MPLVERSION}-py${PYVERSION}-macosx10.5_mpkg.zip matplotlib-${MPLVERSION}-py${PYVERSION}-macosx10.5.mpkg + /Library/Frameworks/Python.framework/Versions/${PYVERSION}/bin/bdist_mpkg --readme=ReadMe.txt &&\ + hdiutil create -srcdir dist/matplotlib-${MPLVERSION}-py${PYVERSION}-macosx10.5.mpkg dist/matplotlib-${MPLVERSION}-py${PYVERSION}-macosx10.5.dmg &&\ + ${PYTHON} setupegg.py bdist_egg upload: rm -rf upload &&\ @@ -102,7 +101,7 @@ scp upload/* jd...@fr...:uploads/ all: - make clean fetch_deps dependencies installers upload + make clean fetch deps installers upload Modified: trunk/matplotlib/release/osx/README.txt =================================================================== --- trunk/matplotlib/release/osx/README.txt 2009-08-06 16:41:18 UTC (rev 7404) +++ trunk/matplotlib/release/osx/README.txt 2009-08-06 17:09:25 UTC (rev 7405) @@ -48,16 +48,16 @@ * First fetch all the dependencies and patch bdist_mpkg for OSX 10.5. You can do this automatically in one step with:: - make fetch_deps + make fetch -* install the patched bdist_mpkg, that the fetch_deps step just created:: +* install the patched bdist_mpkg, that the fetch step just created:: cd bdist_mpkg-0.4.4 sudo python setup.py install * build the dependencies:: - make dependencies + make deps * copy over the latest mpl *.tar.gz tarball to this directory, update the MPLVERSION in the Makefile:: @@ -77,11 +77,11 @@ cd release/osx/ unset PKG_CONFIG_PATH - make fetch_deps + make fetch cd bdist_mpkg-0.4.4 sudo python setup.py install cd .. - make dependencies + make deps Build the mpl sdist:: Copied: trunk/matplotlib/release/osx/data/ReadMe.txt (from rev 7404, branches/v0_99_maint/release/osx/data/ReadMe.txt) =================================================================== --- trunk/matplotlib/release/osx/data/ReadMe.txt (rev 0) +++ trunk/matplotlib/release/osx/data/ReadMe.txt 2009-08-06 17:09:25 UTC (rev 7405) @@ -0,0 +1,45 @@ +matplotlib for MacOS X 10.3.9 or later and Python 2.5 and Python 2.6 + +matplotlib is a python 2D plotting library which produces publication +quality figures in a variety of hardcopy formats and interactive +environments across platforms. matplotlib can be used in python +scripts, the python and ipython shell (ala matlab or mathematica), web +application servers, and various graphical user interface toolkits. + +Home page: <http://matplotlib.sourceforge.net/> + +Before running matplotlib, you must install numpy. Binary installers +for all these packages are available here: + + <http://pythonmac.org/packages/py25-fat/index.html>. + +*** Back Ends *** + +You may use TkAgg or WXAgg back ends; Qt and GTK support is not +provided in this package. By default this matplotlib uses TkAgg +because Tcl/Tk is included with MacOS X. + +If you wish to use WXAgg then: +* Install wxPython from: + <http://pythonmac.org/packages/py25-fat/index.html>. +* Configure a matplotlibrc file, as described below. + +For TkAgg you may use Apple's built-in Tcl/Tk or install your own 8.4.x + +*** Configuring a matplotlibrc file *** + +If you wish to change any matplotlib settings, create a file: + ~/.matplotlib/matplotlibrc + + +that contains at least the following information. The values shown are +the defaults in the internal matplotlibrc file; change them as you see +fit: + +# the default backend; one of GTK GTKAgg GTKCairo FltkAgg QtAgg TkAgg WXAgg +# Agg Cairo GD GDK Paint PS PDF SVG Template +backend : TkAgg +interactive : False # see http://matplotlib.sourceforge.net/interactive.html + +See also +<http://matplotlib.sourceforge.net/users/customizing.html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-08-06 20:05:55
|
Revision: 7410 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7410&view=rev Author: efiring Date: 2009-08-06 20:05:41 +0000 (Thu, 06 Aug 2009) Log Message: ----------- Turn off contourf compound path generation; enable ContourSet as contour arg. The former change is part of a continuing effort to make compound paths work; in its present state, users should see no difference. The second change is to make it easier to use line contours with filled contours. Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/contourf_demo.py trunk/matplotlib/lib/matplotlib/contour.py Modified: trunk/matplotlib/examples/pylab_examples/contourf_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/contourf_demo.py 2009-08-06 19:28:16 UTC (rev 7409) +++ trunk/matplotlib/examples/pylab_examples/contourf_demo.py 2009-08-06 20:05:41 UTC (rev 7410) @@ -55,9 +55,10 @@ # Note that in the following, we explicitly pass in a subset of # the contour levels used for the filled contours. Alternatively, -# We could pass in additional levels to provide extra resolution. +# We could pass in additional levels to provide extra resolution, +# or leave out the levels kwarg to use all of the original levels. -CS2 = contour(X, Y, Z, CS.levels[::2], +CS2 = contour(CS, levels=CS.levels[::2], colors = 'r', origin=origin, hold='on') Modified: trunk/matplotlib/lib/matplotlib/contour.py =================================================================== --- trunk/matplotlib/lib/matplotlib/contour.py 2009-08-06 19:28:16 UTC (rev 7409) +++ trunk/matplotlib/lib/matplotlib/contour.py 2009-08-06 20:05:41 UTC (rev 7410) @@ -539,6 +539,7 @@ """ self.ax = ax + self.noslit = kwargs.get('noslit', False) # **Temporary** self.levels = kwargs.get('levels', None) self.filled = kwargs.get('filled', False) self.linewidths = kwargs.get('linewidths', None) @@ -571,12 +572,31 @@ if self.colors is not None and cmap is not None: raise ValueError('Either colors or cmap must be None') if self.origin == 'image': self.origin = mpl.rcParams['image.origin'] - x, y, z = self._contour_args(*args) # also sets self.levels, - # self.layers + + if isinstance(args[0], ContourSet): + C = args[0].Cntr + if self.levels is None: + self.levels = args[0].levels + else: + x, y, z = self._contour_args(*args) + + x0 = ma.minimum(x) + x1 = ma.maximum(x) + y0 = ma.minimum(y) + y1 = ma.maximum(y) + self.ax.update_datalim([(x0,y0), (x1,y1)]) + self.ax.autoscale_view() + _mask = ma.getmask(z) + if _mask is ma.nomask: + _mask = None + C = _cntr.Cntr(x, y, z.filled(), _mask) + self.Cntr = C + self._process_levels() + if self.colors is not None: cmap = colors.ListedColormap(self.colors, N=len(self.layers)) if self.filled: - self.collections = cbook.silent_list('collections.PolyCollection') + self.collections = cbook.silent_list('collections.PathCollection') else: self.collections = cbook.silent_list('collections.LineCollection') self.segs = [] @@ -590,14 +610,9 @@ kw['norm'] = norm cm.ScalarMappable.__init__(self, **kw) # sets self.cmap; self._process_colors() - _mask = ma.getmask(z) - if _mask is ma.nomask: - _mask = None - if self.filled: if self.linewidths is not None: warnings.warn('linewidths is ignored by contourf') - C = _cntr.Cntr(x, y, z.filled(), _mask) lowers = self._levels[:-1] uppers = self._levels[1:] for level, level_upper in zip(lowers, uppers): @@ -620,7 +635,6 @@ tlinewidths = self._process_linewidths() self.tlinewidths = tlinewidths tlinestyles = self._process_linestyles() - C = _cntr.Cntr(x, y, z.filled(), _mask) for level, width, lstyle in zip(self.levels, tlinewidths, tlinestyles): nlist = C.trace(level) nseg = len(nlist)//2 @@ -637,24 +651,18 @@ self.segs.append(segs) self.kinds.append(kinds) self.changed() # set the colors - x0 = ma.minimum(x) - x1 = ma.maximum(x) - y0 = ma.minimum(y) - y1 = ma.maximum(y) - self.ax.update_datalim([(x0,y0), (x1,y1)]) - self.ax.autoscale_view() - @staticmethod - def _make_paths(segs, kinds): + def _make_paths(self, segs, kinds): paths = [] for seg, kind in zip(segs, kinds): codes = np.zeros(kind.shape, dtype=mpath.Path.code_type) codes.fill(mpath.Path.LINETO) codes[0] = mpath.Path.MOVETO # points that begin a slit or are in it: - in_slit = kind[:-1] >= _cntr._slitkind # use moveto for any point *following* such a point - codes[1:][in_slit] = mpath.Path.MOVETO + if self.noslit: + in_slit = kind[:-1] >= _cntr._slitkind + codes[1:][in_slit] = mpath.Path.MOVETO paths.append(mpath.Path(seg, codes)) return paths @@ -813,14 +821,10 @@ "Last %s arg must give levels; see help(%s)" % (fn,fn)) if self.filled and len(lev) < 2: raise ValueError("Filled contours require at least 2 levels.") - # Workaround for cntr.c bug wrt masked interior regions: - #if filled: - # z = ma.masked_array(z.filled(-1e38)) - # It's not clear this is any better than the original bug. self.levels = lev - #if self._auto and self.extend in ('both', 'min', 'max'): - # raise TypeError("Auto level selection is inconsistent " - # + "with use of 'extend' kwarg") + return (x, y, z) + + def _process_levels(self): self._levels = list(self.levels) if self.extend in ('both', 'min'): self._levels.insert(0, min(self.levels[0],self.zmin) - 1) @@ -841,7 +845,6 @@ if self.extend in ('both', 'max'): self.layers[-1] = 0.5 * (self.vmax + self._levels[-2]) - return (x, y, z) def _process_colors(self): """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2009-08-07 17:02:37
|
Revision: 7417 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7417&view=rev Author: mdboom Date: 2009-08-07 17:02:28 +0000 (Fri, 07 Aug 2009) Log Message: ----------- Refactor some backend methods for consistency and to reduce explosion of the number of arguments. A first crack at Gouraud shading in the Agg backend (not hooked up to anything). Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/doc/api/api_changes.rst trunk/matplotlib/examples/pylab_examples/quadmesh_demo.py trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/backend_bases.py trunk/matplotlib/lib/matplotlib/backends/backend_agg.py trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py trunk/matplotlib/lib/matplotlib/backends/backend_mixed.py trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py trunk/matplotlib/lib/matplotlib/backends/backend_ps.py trunk/matplotlib/lib/matplotlib/backends/backend_svg.py trunk/matplotlib/lib/matplotlib/backends/backend_template.py trunk/matplotlib/lib/matplotlib/backends/backend_wx.py trunk/matplotlib/lib/matplotlib/collections.py trunk/matplotlib/lib/matplotlib/figure.py trunk/matplotlib/lib/matplotlib/font_manager.py trunk/matplotlib/lib/matplotlib/image.py trunk/matplotlib/src/_backend_agg.cpp trunk/matplotlib/src/_backend_agg.h Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/CHANGELOG 2009-08-07 17:02:28 UTC (rev 7417) @@ -1,3 +1,41 @@ +2009-08-07 In an effort to simplify the backend API, all clipping rectangles + and paths are now passed in using GraphicsContext objects, even + on collections and images. Therefore: + + draw_path_collection(self, master_transform, cliprect, clippath, + clippath_trans, paths, all_transforms, offsets, + offsetTrans, facecolors, edgecolors, linewidths, + linestyles, antialiaseds, urls) + + becomes: + + draw_path_collection(self, gc, master_transform, paths, all_transforms, + offsets, offsetTrans, facecolors, edgecolors, + linewidths, linestyles, antialiaseds, urls) + + + + draw_quad_mesh(self, master_transform, cliprect, clippath, + clippath_trans, meshWidth, meshHeight, coordinates, + offsets, offsetTrans, facecolors, antialiased, + showedges) + + becomes: + + draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight, + coordinates, offsets, offsetTrans, facecolors, + antialiased, showedges) + + + + draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None) + + becomes: + + draw_image(self, gc, x, y, im) + + - MGD + 2009-08-06 Tagging the 0.99.0 release at svn r7397 - JDH * fixed an alpha colormapping bug posted on sf 2832575 @@ -30,7 +68,6 @@ * apply sf patches 2830233 and 2823885 for osx setup and 64 bit; thanks Michiel - 2009-08-04 Made cbook.get_sample_data make use of the ETag and Last-Modified headers of mod_dav_svn. - JKS Modified: trunk/matplotlib/doc/api/api_changes.rst =================================================================== --- trunk/matplotlib/doc/api/api_changes.rst 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/doc/api/api_changes.rst 2009-08-07 17:02:28 UTC (rev 7417) @@ -18,6 +18,43 @@ .. _configobj: http://www.voidspace.org.uk/python/configobj.html .. _`enthought.traits`: http://code.enthought.com/projects/traits +Changes beyond 0.99.x +===================== + +In an effort to simplify the backend API, all clipping rectangles +and paths are now passed in using GraphicsContext objects, even +on collections and images. Therefore:: + + draw_path_collection(self, master_transform, cliprect, clippath, + clippath_trans, paths, all_transforms, offsets, + offsetTrans, facecolors, edgecolors, linewidths, + linestyles, antialiaseds, urls) + + # is now + + draw_path_collection(self, gc, master_transform, paths, all_transforms, + offsets, offsetTrans, facecolors, edgecolors, + linewidths, linestyles, antialiaseds, urls) + + + draw_quad_mesh(self, master_transform, cliprect, clippath, + clippath_trans, meshWidth, meshHeight, coordinates, + offsets, offsetTrans, facecolors, antialiased, + showedges) + + # is now + + draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight, + coordinates, offsets, offsetTrans, facecolors, + antialiased, showedges) + + + draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None) + + # is now + + draw_image(self, gc, x, y, im) + Changes in 0.99 ====================== Modified: trunk/matplotlib/examples/pylab_examples/quadmesh_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/quadmesh_demo.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/examples/pylab_examples/quadmesh_demo.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -11,7 +11,7 @@ from matplotlib import cm, colors from numpy import ma -n = 56 +n = 12 x = np.linspace(-1.5,1.5,n) y = np.linspace(-1.5,1.5,n*2) X,Y = np.meshgrid(x,y); Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -1705,12 +1705,14 @@ l, b, w, h = self.bbox.bounds # composite images need special args so they will not # respect z-order for now - renderer.draw_image( - round(l), round(b), im, self.bbox, - self.patch.get_path(), - self.patch.get_transform()) + gc = renderer.new_gc() + gc.set_clip_rectangle(self.bbox) + gc.set_clip_path(mtransforms.TransformedPath( + self.patch.get_path(), + self.patch.get_transform())) + renderer.draw_image(gc, round(l), round(b), im) if dsu_rasterized: for zorder, i, a in dsu_rasterized: Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backend_bases.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -108,24 +108,23 @@ marker_trans + transforms.Affine2D().translate(x, y), rgbFace) - def draw_path_collection(self, master_transform, cliprect, clippath, - clippath_trans, paths, all_transforms, offsets, - offsetTrans, facecolors, edgecolors, linewidths, - linestyles, antialiaseds, urls): + def draw_path_collection(self, gc, master_transform, paths, all_transforms, + offsets, offsetTrans, facecolors, edgecolors, + linewidths, linestyles, antialiaseds, urls): """ - Draws a collection of paths, selecting drawing properties from + Draws a collection of paths selecting drawing properties from the lists *facecolors*, *edgecolors*, *linewidths*, *linestyles* and *antialiaseds*. *offsets* is a list of offsets to apply to each of the paths. The offsets in - *offsets* are first transformed by *offsetTrans* before - being applied. + *offsets* are first transformed by *offsetTrans* before being + applied. This provides a fallback implementation of :meth:`draw_path_collection` that makes multiple calls to - draw_path. Some backends may want to override this in order - to render each set of path data only once, and then reference - that path multiple times with the different offsets, colors, - styles etc. The generator methods + :meth:`draw_path`. Some backends may want to override this in + order to render each set of path data only once, and then + reference that path multiple times with the different offsets, + colors, styles etc. The generator methods :meth:`_iter_collection_raw_paths` and :meth:`_iter_collection` are provided to help with (and standardize) the implementation across backends. It is highly @@ -137,18 +136,16 @@ master_transform, paths, all_transforms): path_ids.append((path, transform)) - for xo, yo, path_id, gc, rgbFace in self._iter_collection( - path_ids, cliprect, clippath, clippath_trans, - offsets, offsetTrans, facecolors, edgecolors, + for xo, yo, path_id, gc0, rgbFace in self._iter_collection( + gc, path_ids, offsets, offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds, urls): path, transform = path_id transform = transforms.Affine2D(transform.get_matrix()).translate(xo, yo) - self.draw_path(gc, path, transform, rgbFace) + self.draw_path(gc0, path, transform, rgbFace) - def draw_quad_mesh(self, master_transform, cliprect, clippath, - clippath_trans, meshWidth, meshHeight, coordinates, - offsets, offsetTrans, facecolors, antialiased, - showedges): + def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight, + coordinates, offsets, offsetTrans, facecolors, + antialiased, showedges): """ This provides a fallback implementation of :meth:`draw_quad_mesh` that generates paths and then calls @@ -166,11 +163,11 @@ linewidths = np.array([0.0], np.float_) return self.draw_path_collection( - master_transform, cliprect, clippath, clippath_trans, - paths, [], offsets, offsetTrans, facecolors, edgecolors, - linewidths, [], [antialiased], [None]) + gc, master_transform, paths, [], offsets, offsetTrans, facecolors, + edgecolors, linewidths, [], [antialiased], [None]) - def _iter_collection_raw_paths(self, master_transform, paths, all_transforms): + def _iter_collection_raw_paths(self, master_transform, paths, + all_transforms): """ This is a helper method (along with :meth:`_iter_collection`) to make it easier to write a space-efficent :meth:`draw_path_collection` @@ -200,9 +197,9 @@ transform = all_transforms[i % Ntransforms] yield path, transform + master_transform - def _iter_collection(self, path_ids, cliprect, clippath, clippath_trans, - offsets, offsetTrans, facecolors, edgecolors, - linewidths, linestyles, antialiaseds, urls): + def _iter_collection(self, gc, path_ids, offsets, offsetTrans, facecolors, + edgecolors, linewidths, linestyles, antialiaseds, + urls): """ This is a helper method (along with :meth:`_iter_collection_raw_paths`) to make it easier to write @@ -243,18 +240,14 @@ if Noffsets: toffsets = offsetTrans.transform(offsets) - gc = self.new_gc() + gc0 = self.new_gc() + gc0.copy_properties(gc) - gc.set_clip_rectangle(cliprect) - if clippath is not None: - clippath = transforms.TransformedPath(clippath, clippath_trans) - gc.set_clip_path(clippath) - if Nfacecolors == 0: rgbFace = None if Nedgecolors == 0: - gc.set_linewidth(0.0) + gc0.set_linewidth(0.0) xo, yo = 0, 0 for i in xrange(N): @@ -264,20 +257,20 @@ if Nfacecolors: rgbFace = facecolors[i % Nfacecolors] if Nedgecolors: - gc.set_foreground(edgecolors[i % Nedgecolors]) + gc0.set_foreground(edgecolors[i % Nedgecolors]) if Nlinewidths: - gc.set_linewidth(linewidths[i % Nlinewidths]) + gc0.set_linewidth(linewidths[i % Nlinewidths]) if Nlinestyles: - gc.set_dashes(*linestyles[i % Nlinestyles]) + gc0.set_dashes(*linestyles[i % Nlinestyles]) if rgbFace is not None and len(rgbFace)==4: - gc.set_alpha(rgbFace[-1]) + gc0.set_alpha(rgbFace[-1]) rgbFace = rgbFace[:3] - gc.set_antialiased(antialiaseds[i % Naa]) + gc0.set_antialiased(antialiaseds[i % Naa]) if Nurls: - gc.set_url(urls[i % Nurls]) + gc0.set_url(urls[i % Nurls]) - yield xo, yo, path_id, gc, rgbFace - gc.restore() + yield xo, yo, path_id, gc0, rgbFace + gc0.restore() def get_image_magnification(self): """ @@ -287,10 +280,13 @@ """ return 1.0 - def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): + def draw_image(self, gc, x, y, im): """ Draw the image instance into the current axes; + *gc* + a GraphicsContext containing clipping information + *x* is the distance in pixels from the left hand side of the canvas. @@ -301,11 +297,6 @@ *im* the :class:`matplotlib._image.Image` instance - - *bbox* - a :class:`matplotlib.transforms.Bbox` instance for clipping, or - None - """ raise NotImplementedError Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -250,7 +250,7 @@ >>> 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: Modified: trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/backends/backend_cairo.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -151,10 +151,12 @@ self._fill_and_stroke(ctx, rgbFace, gc.get_alpha()) - def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): + def draw_image(self, gc, x, y, im): # bbox - not currently used if _debug: print '%s.%s()' % (self.__class__.__name__, _fn_name()) + clippath, clippath_trans = gc.get_clip_path() + im.flipud_out() rows, cols, buf = im.color_conv (BYTE_FORMAT) Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/backends/backend_gdk.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -97,7 +97,9 @@ if gc.gdkGC.line_width > 0: self.gdkDrawable.draw_lines(gc.gdkGC, polygon) - def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): + def draw_image(self, gc, x, y, im): + bbox = gc.get_clip_rectangle() + if bbox != None: l,b,w,h = bbox.bounds #rectangle = (int(l), self.height-int(b+h), Modified: trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/backends/backend_macosx.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -59,12 +59,19 @@ gc.draw_markers(marker_path, marker_trans, path, trans, rgbFace) def draw_path_collection(self, *args): - gc = self.gc - args = args[:13] + # TODO: We should change this in the C code eventually, but this + # re-ordering of arguments should work for now + gc = args[0] + args = tuple([gc, args[1], gc.get_clip_rectangle()] + \ + list(gc.get_clip_path()) + list(args[2:])) gc.draw_path_collection(*args) def draw_quad_mesh(self, *args): - gc = self.gc + # TODO: We should change this in the C code eventually, but this + # re-ordering of arguments should work for now + gc = args[0] + args = [gc, args[1], gc.get_clip_rectangle()] + \ + list(gc.get_clip_path()) + list(args[2:]) gc.draw_quad_mesh(*args) def new_gc(self): @@ -72,12 +79,15 @@ self.gc.set_hatch(None) return self.gc - def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): + def draw_image(self, gc, x, y, im): + # TODO: We should change this in the C code eventually, but this + # re-ordering of arguments should work for now im.flipud_out() nrows, ncols, data = im.as_rgba_str() - self.gc.draw_image(x, y, nrows, ncols, data, bbox, clippath, clippath_trans) + gc.draw_image(x, y, nrows, ncols, data, gc.get_clip_rectangle(), + *gc.get_clip_path()) im.flipud_out() - + def draw_tex(self, gc, x, y, s, prop, angle): # todo, handle props, angle, origins size = prop.get_size_in_points() @@ -128,7 +138,7 @@ def flipy(self): return False - + def points_to_pixels(self, points): return points/72.0 * self.dpi @@ -168,7 +178,7 @@ _macosx.GraphicsContext.set_clip_path(self, path) ######################################################################## -# +# # The following functions and classes are for pylab and implement # window/figure managers, etc... # @@ -281,7 +291,7 @@ self.toolbar = NavigationToolbar2Mac(canvas) else: self.toolbar = None - if self.toolbar is not None: + if self.toolbar is not None: self.toolbar.update() def notify_axes_change(fig): @@ -300,7 +310,7 @@ Gcf.destroy(self.num) class NavigationToolbarMac(_macosx.NavigationToolbar): - + def __init__(self, canvas): self.canvas = canvas basedir = os.path.join(matplotlib.rcParams['datapath'], "images") @@ -331,7 +341,7 @@ assert magic=="P6" assert len(imagedata)==width*height*3 # 3 colors in RGB return (width, height, imagedata) - + def panx(self, direction): axes = self.canvas.figure.axes selected = self.get_active() @@ -401,9 +411,9 @@ _macosx.NavigationToolbar2.set_message(self, message.encode('utf-8')) ######################################################################## -# +# # Now just provide the standard names that backend.__init__ is expecting -# +# ######################################################################## Modified: trunk/matplotlib/lib/matplotlib/backends/backend_mixed.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_mixed.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/backends/backend_mixed.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -14,7 +14,7 @@ raster_renderer_class=None, bbox_inches_restore=None): """ - figure: The figure instance. + figure: The figure instance. width: The width of the canvas in logical units @@ -49,7 +49,7 @@ self.figure=figure self._bbox_inches_restore = bbox_inches_restore - + self._set_current_renderer(vector_renderer) _methods = """ @@ -88,8 +88,8 @@ mode="png") self._bbox_inches_restore = r - - + + if self._rasterizing == 0: self._raster_renderer = self._raster_renderer_class( self._width*self.dpi, self._height*self.dpi, self.dpi) @@ -117,9 +117,12 @@ image = frombuffer(buffer, w, h, True) image.is_grayscale = False image.flipud_out() - self._renderer.draw_image(int(float(l)/self.dpi*72.), - int((float(height) - b - h)/self.dpi*72.), - image, None) + gc = self._renderer.new_gc() + self._renderer.draw_image( + gc, + int(float(l)/self.dpi*72.), + int((float(height) - b - h)/self.dpi*72.), + image) self._raster_renderer = None self._rasterizing = False Modified: trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/backends/backend_pdf.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -1286,13 +1286,7 @@ def get_image_magnification(self): return self.image_dpi/72.0 - def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): - gc = self.new_gc() - if bbox is not None: - gc.set_clip_rectangle(bbox) - if clippath is not None: - clippath = TransformedPath(clippath, clippath_trans) - gc.set_clip_path(clippath) + def draw_image(self, gc, x, y, im): self.check_gc(gc) h, w = im.get_size_out() Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -374,7 +374,7 @@ """ return self.image_magnification - def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): + def draw_image(self, gc, x, y, im): """ Draw the Image instance into the current axes; x is the distance in pixels from the left hand side of the canvas and y @@ -400,6 +400,9 @@ figh = self.height*72 #print 'values', origin, flipud, figh, h, y + bbox = gc.get_clip_rectangle() + clippath, clippath_trans = gc.get_clip_path() + clip = [] if bbox is not None: clipx,clipy,clipw,cliph = bbox.bounds @@ -504,10 +507,9 @@ ps = '\n'.join(ps_cmd) self._draw_ps(ps, gc, rgbFace, fill=False, stroke=False) - def draw_path_collection(self, master_transform, cliprect, clippath, - clippath_trans, paths, all_transforms, offsets, - offsetTrans, facecolors, edgecolors, linewidths, - linestyles, antialiaseds, urls): + def draw_path_collection(self, gc, master_transform, paths, all_transforms, + offsets, offsetTrans, facecolors, edgecolors, + linewidths, linestyles, antialiaseds, urls): write = self._pswriter.write path_codes = [] @@ -521,13 +523,11 @@ write('\n'.join(ps_cmd)) path_codes.append(name) - for xo, yo, path_id, gc, rgbFace in self._iter_collection( - path_codes, cliprect, clippath, clippath_trans, - offsets, offsetTrans, facecolors, edgecolors, + for xo, yo, path_id, gc0, rgbFace in self._iter_collection( + gc, path_codes, offsets, offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds, urls): - ps = "%g %g %s" % (xo, yo, path_id) - self._draw_ps(ps, gc, rgbFace) + self._draw_ps(ps, gc0, rgbFace) self._path_collection_id += 1 @@ -964,7 +964,7 @@ class NullWriter(object): def write(self, *kl, **kwargs): pass - + self._pswriter = NullWriter() else: self._pswriter = StringIO() @@ -1096,7 +1096,7 @@ class NullWriter(object): def write(self, *kl, **kwargs): pass - + self._pswriter = NullWriter() else: self._pswriter = StringIO() Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -262,10 +262,9 @@ self._svgwriter.write ('<use style="%s" %s/>\n' % (style, details)) write('</g>') - def draw_path_collection(self, master_transform, cliprect, clippath, - clippath_trans, paths, all_transforms, offsets, - offsetTrans, facecolors, edgecolors, linewidths, - linestyles, antialiaseds, urls): + def draw_path_collection(self, gc, master_transform, paths, all_transforms, + offsets, offsetTrans, facecolors, edgecolors, + linewidths, linestyles, antialiaseds, urls): write = self._svgwriter.write path_codes = [] @@ -280,18 +279,17 @@ path_codes.append(name) write('</defs>\n') - for xo, yo, path_id, gc, rgbFace in self._iter_collection( - path_codes, cliprect, clippath, clippath_trans, - offsets, offsetTrans, facecolors, edgecolors, + for xo, yo, path_id, gc0, rgbFace in self._iter_collection( + gc, path_codes, offsets, offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds, urls): - clipid = self._get_gc_clip_svg(gc) - url = gc.get_url() + clipid = self._get_gc_clip_svg(gc0) + url = gc0.get_url() if url is not None: self._svgwriter.write('<a xlink:href="%s">' % url) if clipid is not None: write('<g clip-path="url(#%s)">' % clipid) details = 'xlink:href="#%s" x="%f" y="%f"' % (path_id, xo, self.height - yo) - style = self._get_style(gc, rgbFace) + style = self._get_style(gc0, rgbFace) self._svgwriter.write ('<use style="%s" %s/>\n' % (style, details)) if clipid is not None: write('</g>') @@ -300,7 +298,7 @@ self._path_collection_id += 1 - def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): + def draw_image(self, gc, x, y, im): # MGDTODO: Support clippath here trans = [1,0,0,1,0,0] transstr = '' @@ -643,7 +641,7 @@ # the problem. I hope someone who knows the svg backends # take a look at this problem. Meanwhile, the dpi # parameter is ignored and image_dpi is fixed at 72. - JJL - + #image_dpi = kwargs.pop("dpi", 72) image_dpi = 72 _bbox_inches_restore = kwargs.pop("bbox_inches_restore", None) Modified: trunk/matplotlib/lib/matplotlib/backends/backend_template.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_template.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/backends/backend_template.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -87,22 +87,21 @@ # draw_path_collection is optional, and we get more correct # relative timings by leaving it out. backend implementers concerned with # performance will probably want to implement it -# def draw_path_collection(self, master_transform, cliprect, clippath, -# clippath_trans, paths, all_transforms, offsets, -# offsetTrans, facecolors, edgecolors, linewidths, -# linestyles, antialiaseds): +# def draw_path_collection(self, gc, master_transform, paths, +# all_transforms, offsets, offsetTrans, facecolors, +# edgecolors, linewidths, linestyles, +# antialiaseds): # pass # draw_quad_mesh is optional, and we get more correct # relative timings by leaving it out. backend implementers concerned with # performance will probably want to implement it -# def draw_quad_mesh(self, master_transform, cliprect, clippath, -# clippath_trans, meshWidth, meshHeight, coordinates, -# offsets, offsetTrans, facecolors, antialiased, -# showedges): +# def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight, +# coordinates, offsets, offsetTrans, facecolors, +# antialiased, showedges): # pass - def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): + def draw_image(self, gc, x, y, im): pass def draw_text(self, gc, x, y, s, prop, angle, ismath=False): Modified: trunk/matplotlib/lib/matplotlib/backends/backend_wx.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/backends/backend_wx.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -361,7 +361,8 @@ gfx_ctx.StrokePath(wxpath) gc.unselect() - def draw_image(self, x, y, im, bbox, clippath=None, clippath_trans=None): + def draw_image(self, gc, x, y, im): + bbox = gc.get_clip_rectangle() if bbox != None: l,b,w,h = bbox.bounds else: @@ -776,7 +777,7 @@ bind(self, wx.EVT_MIDDLE_DOWN, self._onMiddleButtonDown) bind(self, wx.EVT_MIDDLE_DCLICK, self._onMiddleButtonDown) bind(self, wx.EVT_MIDDLE_UP, self._onMiddleButtonUp) - + self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM) self.macros = {} # dict from wx id to seq of macros @@ -1257,7 +1258,7 @@ if self.HasCapture(): self.ReleaseMouse() FigureCanvasBase.button_release_event(self, x, y, 1, guiEvent=evt) - #Add middle button events + #Add middle button events def _onMiddleButtonDown(self, evt): """Start measuring on an axis.""" x = evt.GetX() Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/collections.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -204,18 +204,16 @@ self.update_scalarmappable() - clippath, clippath_trans = self.get_transformed_clip_path_and_affine() - if clippath_trans is not None: - clippath_trans = clippath_trans.frozen() - transform, transOffset, offsets, paths = self._prepare_points() + gc = renderer.new_gc() + gc.set_clip_rectangle(self.get_clip_box()) + gc.set_clip_path(self.get_clip_path()) + renderer.draw_path_collection( - transform.frozen(), self.clipbox, clippath, clippath_trans, - paths, self.get_transforms(), - offsets, transOffset, - self.get_facecolor(), self.get_edgecolor(), self._linewidths, - self._linestyles, self._antialiaseds, self._urls) + gc, transform.frozen(), paths, self.get_transforms(), + offsets, transOffset, self.get_facecolor(), self.get_edgecolor(), + self._linewidths, self._linestyles, self._antialiaseds, self._urls) renderer.close_group(self.__class__.__name__) def contains(self, mouseevent): @@ -1149,10 +1147,6 @@ if self.check_update('array'): self.update_scalarmappable() - clippath, clippath_trans = self.get_transformed_clip_path_and_affine() - if clippath_trans is not None: - clippath_trans = clippath_trans.frozen() - if not transform.is_affine: coordinates = self._coordinates.reshape( (self._coordinates.shape[0] * @@ -1168,11 +1162,14 @@ offsets = transOffset.transform_non_affine(offsets) transOffset = transOffset.get_affine() + gc = renderer.new_gc() + gc.set_clip_rectangle(self.get_clip_box()) + gc.set_clip_path(self.get_clip_path()) + renderer.draw_quad_mesh( - transform.frozen(), self.clipbox, clippath, clippath_trans, - self._meshWidth, self._meshHeight, coordinates, - offsets, transOffset, self.get_facecolor(), self._antialiased, - self._showedges) + gc, transform.frozen(), self._meshWidth, self._meshHeight, + coordinates, offsets, transOffset, self.get_facecolor(), + self._antialiased, self._showedges) renderer.close_group(self.__class__.__name__) Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/figure.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -766,9 +766,10 @@ im.is_grayscale = False l, b, w, h = self.bbox.bounds - clippath, affine = self.get_transformed_clip_path_and_affine() - renderer.draw_image(l, b, im, self.bbox, - clippath, affine) + gc = renderer.new_gc() + gc.set_clip_rectangle(self.bbox) + gc.set_clip_path(self.get_clip_path()) + renderer.draw_image(gc, l, b, im) # render the axes for a in self.axes: a.draw(renderer) @@ -851,7 +852,7 @@ *fancybox*: [ None | False | True ] if True, draw a frame with a round fancybox. If None, use rc - + *shadow*: [ None | False | True ] If *True*, draw a shadow behind legend. If *None*, use rc settings. Modified: trunk/matplotlib/lib/matplotlib/font_manager.py =================================================================== --- trunk/matplotlib/lib/matplotlib/font_manager.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/font_manager.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -707,7 +707,7 @@ def __hash__(self): l = [(k, getattr(self, "get" + k)()) for k in sorted(self.__dict__)] return hash(repr(l)) - + def __str__(self): return self.get_fontconfig_pattern() Modified: trunk/matplotlib/lib/matplotlib/image.py =================================================================== --- trunk/matplotlib/lib/matplotlib/image.py 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/lib/matplotlib/image.py 2009-08-07 17:02:28 UTC (rev 7417) @@ -235,9 +235,10 @@ im = self.make_image(renderer.get_image_magnification()) im._url = self.get_url() l, b, widthDisplay, heightDisplay = self.axes.bbox.bounds - clippath, affine = self.get_transformed_clip_path_and_affine() - renderer.draw_image(round(l), round(b), im, self.axes.bbox.frozen(), - clippath, affine) + gc = renderer.new_gc() + gc.set_clip_rectangle(self.axes.bbox.frozen()) + gc.set_clip_path(self.get_clip_path()) + renderer.draw_image(gc, round(l), round(b), im) def contains(self, mouseevent): """ @@ -576,11 +577,13 @@ def draw(self, renderer, *args, **kwargs): if not self.get_visible(): return im = self.make_image(renderer.get_image_magnification()) - renderer.draw_image(round(self.axes.bbox.xmin), + gc = renderer.new_gc() + gc.set_clip_rectangle(self.axes.bbox.frozen()) + gc.set_clip_path(self.get_clip_path()) + renderer.draw_image(gc, + round(self.axes.bbox.xmin), round(self.axes.bbox.ymin), - im, - self.axes.bbox.frozen(), - *self.get_transformed_clip_path_and_affine()) + im) def set_data(self, x, y, A): @@ -730,8 +733,10 @@ if not self.get_visible(): return # todo: we should be able to do some cacheing here im = self.make_image(renderer.get_image_magnification()) - renderer.draw_image(round(self.ox), round(self.oy), im, self.figure.bbox, - *self.get_transformed_clip_path_and_affine()) + gc = renderer.new_gc() + gc.set_clip_rectangle(self.figure.bbox) + gc.set_clip_path(self.get_clip_path()) + renderer.draw_image(gc, round(self.ox), round(self.oy), im) def write_png(self, fname): """Write the image to png file with fname""" Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/src/_backend_agg.cpp 2009-08-07 17:02:28 UTC (rev 7417) @@ -31,6 +31,7 @@ #include "agg_span_image_filter_rgba.h" #include "agg_span_interpolator_linear.h" #include "agg_span_pattern_rgba.h" +#include "agg_span_gouraud_rgba.h" #include "agg_conv_shorten_path.h" #include "util/agg_color_conv_rgb8.h" @@ -799,23 +800,17 @@ RendererAgg::draw_image(const Py::Tuple& args) { _VERBOSE("RendererAgg::draw_image"); - args.verify_length(4, 6); + args.verify_length(4); - double x = Py::Float(args[0]); - double y = Py::Float(args[1]); - Image *image = static_cast<Image*>(args[2].ptr()); - Py::Object box_obj = args[3]; - Py::Object clippath; - agg::trans_affine clippath_trans; + GCAgg gc(args[0], dpi); + double x = Py::Float(args[1]); + double y = Py::Float(args[2]); + Image *image = static_cast<Image*>(args[3].ptr()); bool has_clippath = false; theRasterizer.reset_clipping(); rendererBase.reset_clipping(true); - if (args.size() == 6) { - clippath = args[4]; - clippath_trans = py_to_agg_transformation_matrix(args[5].ptr(), false); - has_clippath = render_clippath(clippath, clippath_trans); - } + has_clippath = render_clippath(gc.clippath, gc.clippath_trans); Py::Tuple empty; image->flipud_out(empty); @@ -855,7 +850,7 @@ theRasterizer.add_path(rect2); agg::render_scanlines(theRasterizer, slineP8, ri); } else { - set_clipbox(box_obj, rendererBase); + set_clipbox(gc.cliprect, rendererBase); rendererBase.blend_from(pixf, 0, (int)x, (int)(height-(y+image->rowsOut))); } @@ -1026,15 +1021,13 @@ _VERBOSE("RendererAgg::draw_path"); args.verify_length(3, 4); - Py::Object gc_obj = args[0]; - Py::Object path_obj = args[1]; + GCAgg gc(args[0], dpi); + PathIterator path(args[1]); agg::trans_affine trans = py_to_agg_transformation_matrix(args[2].ptr()); Py::Object face_obj; if (args.size() == 4) face_obj = args[3]; - PathIterator path(path_obj); - GCAgg gc = GCAgg(gc_obj, dpi); facepair_t face = _get_rgba_face(face_obj, gc.alpha); theRasterizer.reset_clipping(); @@ -1275,32 +1268,29 @@ Py::Object RendererAgg::draw_path_collection(const Py::Tuple& args) { _VERBOSE("RendererAgg::draw_path_collection"); - args.verify_length(14); + args.verify_length(12); - //segments, trans, clipbox, colors, linewidths, antialiaseds - agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0].ptr()); - Py::Object cliprect = args[1]; - Py::Object clippath = args[2]; - agg::trans_affine clippath_trans = py_to_agg_transformation_matrix(args[3].ptr(), false); - Py::SeqBase<Py::Object> paths = args[4]; - Py::SeqBase<Py::Object> transforms_obj = args[5]; - Py::Object offsets_obj = args[6]; - agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[7].ptr()); - Py::Object facecolors_obj = args[8]; - Py::Object edgecolors_obj = args[9]; - Py::SeqBase<Py::Float> linewidths = args[10]; - Py::SeqBase<Py::Object> linestyles_obj = args[11]; - Py::SeqBase<Py::Int> antialiaseds = args[12]; + GCAgg gc(args[0], dpi); + agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[1].ptr()); + PathListGenerator paths(args[2]); + Py::SeqBase<Py::Object> transforms_obj = args[3]; + Py::Object offsets_obj = args[4]; + agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[5].ptr()); + Py::Object facecolors_obj = args[6]; + Py::Object edgecolors_obj = args[7]; + Py::SeqBase<Py::Float> linewidths = args[8]; + Py::SeqBase<Py::Object> linestyles_obj = args[9]; + Py::SeqBase<Py::Int> antialiaseds = args[10]; // We don't actually care about urls for Agg, so just ignore it. - // Py::SeqBase<Py::Object> urls = args[13]; + // Py::SeqBase<Py::Object> urls = args[11]; PathListGenerator path_generator(paths); try { _draw_path_collection_generic<PathListGenerator, 0, 1> (master_transform, - cliprect, - clippath, - clippath_trans, + gc.cliprect, + gc.clippath, + gc.clippath_trans, path_generator, transforms_obj, offsets_obj, @@ -1390,22 +1380,20 @@ Py::Object RendererAgg::draw_quad_mesh(const Py::Tuple& args) { _VERBOSE("RendererAgg::draw_quad_mesh"); - args.verify_length(12); + args.verify_length(10); //segments, trans, clipbox, colors, linewidths, antialiaseds - agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0].ptr()); - Py::Object cliprect = args[1]; - Py::Object clippath = args[2]; - agg::trans_affine clippath_trans = py_to_agg_transformation_matrix(args[3].ptr(), false); - size_t mesh_width = Py::Int(args[4]); - size_t mesh_height = Py::Int(args[5]); - PyObject* coordinates = args[6].ptr(); - Py::Object offsets_obj = args[7]; - agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[8].ptr()); - Py::Object facecolors_obj = args[9]; - bool antialiased = (bool)Py::Int(args[10]); - bool showedges = (bool)Py::Int(args[11]); + GCAgg gc(args[0], dpi); + agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[1].ptr()); + size_t mesh_width = Py::Int(args[2]); + size_t mesh_height = Py::Int(args[3]); + PyObject* coordinates = args[4].ptr(); + Py::Object offsets_obj = args[5]; + agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[6].ptr()); + Py::Object facecolors_obj = args[7]; + bool antialiased = (bool)Py::Int(args[8]); + bool showedges = (bool)Py::Int(args[9]); bool free_edgecolors = false; QuadMeshGenerator path_generator(mesh_width, mesh_height, coordinates); @@ -1437,9 +1425,9 @@ try { _draw_path_collection_generic<QuadMeshGenerator, 0, 0> (master_transform, - cliprect, - clippath, - clippath_trans, + gc.cliprect, + gc.clippath, + gc.clippath_trans, path_generator, transforms_obj, offsets_obj, @@ -1467,6 +1455,73 @@ } Py::Object +RendererAgg::draw_gouraud_triangle(const Py::Tuple& args) { + _VERBOSE("RendererAgg::draw_quad_mesh"); + args.verify_length(4); + + typedef agg::rgba8 color_t; + typedef agg::span_gouraud_rgba<color_t> span_gen_t; + typedef agg::span_allocator<color_t> span_alloc_t; + + //segments, trans, clipbox, colors, linewidths, antialiaseds + GCAgg gc(args[0], dpi); + Py::Object points_obj = args[1]; + Py::Object colors_obj = args[2]; + agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[3].ptr()); + + PyArrayObject* points = (PyArrayObject*)PyArray_ContiguousFromAny + (points_obj.ptr(), PyArray_DOUBLE, 2, 2); + if (!points || + PyArray_DIM(points, 0) != 3 || PyArray_DIM(points, 1) != 2) + throw Py::ValueError("points must be a 3x2 numpy array"); + + PyArrayObject* colors = (PyArrayObject*)PyArray_ContiguousFromAny + (colors_obj.ptr(), PyArray_DOUBLE, 2, 2); + if (!colors || + PyArray_DIM(colors, 0) != 3 || PyArray_DIM(colors, 1) != 4) + throw Py::ValueError("colors must be a 3x4 numpy array"); + + try { + double* opoints = (double*)PyArray_DATA(points); + double* c = (double*)PyArray_DATA(colors); + double tpoints[6]; + + for (int i = 0; i < 6; i += 2) { + tpoints[i] = opoints[i]; + tpoints[i+1] = opoints[i+1]; + master_transform.transform(&tpoints[i], &tpoints[i+1]); + } + + span_alloc_t span_alloc; + span_gen_t span_gen; + + span_gen.colors( + agg::rgba(c[0], c[1], c[2], c[3]), + agg::rgba(c[4], c[5], c[6], c[7]), + agg::rgba(c[8], c[9], c[10], c[11])); + span_gen.triangle( + tpoints[0], tpoints[1], + tpoints[2], tpoints[3], + tpoints[4], tpoints[5], + 1.0); + + theRasterizer.add_path(span_gen); + agg::render_scanlines_aa( + theRasterizer, slineP8, rendererBase, span_alloc, span_gen); + } catch (...) { + Py_DECREF(points); + Py_DECREF(colors); + + throw; + } + + Py_DECREF(points); + Py_DECREF(colors); + + return Py::Object(); +} + +Py::Object RendererAgg::write_rgba(const Py::Tuple& args) { _VERBOSE("RendererAgg::write_rgba"); @@ -1802,15 +1857,17 @@ add_varargs_method("draw_path", &RendererAgg::draw_path, "draw_path(gc, path, transform, rgbFace)\n"); add_varargs_method("draw_path_collection", &RendererAgg::draw_path_collection, - "draw_path_collection(master_transform, cliprect, clippath, clippath_trans, paths, transforms, offsets, offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds)\n"); + "draw_path_collection(gc, master_transform, paths, transforms, offsets, offsetTrans, facecolors, edgecolors, linewidths, linestyles, antialiaseds)\n"); add_varargs_method("draw_quad_mesh", &RendererAgg::draw_quad_mesh, - "draw_quad_mesh(master_transform, cliprect, clippath, clippath_trans, meshWidth, meshHeight, coordinates, offsets, offsetTrans, facecolors, antialiaseds, showedges)\n"); + "draw_quad_mesh(gc, master_transform, meshWidth, meshHeight, coordinates, offsets, offsetTrans, facecolors, antialiaseds, showedges)\n"); + add_varargs_method("draw_gouraud_triangle", &RendererAgg::draw_gouraud_triangle, + "draw_gouraud_triangle(gc, points, colors, master_transform)\n"); add_varargs_method("draw_markers", &RendererAgg::draw_markers, "draw_markers(gc, marker_path, marker_trans, path, rgbFace)\n"); add_varargs_method("draw_text_image", &RendererAgg::draw_text_image, "draw_text_image(font_image, x, y, r, g, b, a)\n"); add_varargs_method("draw_image", &RendererAgg::draw_image, - "draw_image(x, y, im)"); + "draw_image(gc, x, y, im)"); add_varargs_method("write_rgba", &RendererAgg::write_rgba, "write_rgba(fname)"); add_varargs_method("tostring_rgb", &RendererAgg::tostring_rgb, Modified: trunk/matplotlib/src/_backend_agg.h =================================================================== --- trunk/matplotlib/src/_backend_agg.h 2009-08-07 15:40:56 UTC (rev 7416) +++ trunk/matplotlib/src/_backend_agg.h 2009-08-07 17:02:28 UTC (rev 7417) @@ -164,8 +164,8 @@ Py::Object draw_path(const Py::Tuple & args); Py::Object draw_path_collection(const Py::Tuple & args); Py::Object draw_quad_mesh(const Py::Tuple& args); + Py::Object draw_gouraud_triangle(const Py::Tuple& args); - Py::Object write_rgba(const Py::Tuple & args); Py::Object tostring_rgb(const Py::Tuple & args); Py::Object tostring_argb(const Py::Tuple & args); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2009-08-07 18:31:59
|
Revision: 7418 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7418&view=rev Author: mdboom Date: 2009-08-07 18:31:45 +0000 (Fri, 07 Aug 2009) Log Message: ----------- Experimental Gouraud shading support in the Agg backend. Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/quadmesh_demo.py trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/backend_bases.py trunk/matplotlib/lib/matplotlib/backends/backend_agg.py trunk/matplotlib/lib/matplotlib/collections.py trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/examples/pylab_examples/quadmesh_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/quadmesh_demo.py 2009-08-07 17:02:28 UTC (rev 7417) +++ trunk/matplotlib/examples/pylab_examples/quadmesh_demo.py 2009-08-07 18:31:45 UTC (rev 7418) @@ -28,7 +28,7 @@ fig = figure() ax = fig.add_subplot(121) ax.set_axis_bgcolor("#bdb76b") -ax.pcolormesh(Qx,Qz,Z) +ax.pcolormesh(Qx,Qz,Z, shading='gouraud') ax.set_title('Without masked values') ax = fig.add_subplot(122) Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-08-07 17:02:28 UTC (rev 7417) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-08-07 18:31:45 UTC (rev 7418) @@ -6543,7 +6543,7 @@ and max of the color array *C* is used. If you pass a *norm* instance, *vmin* and *vmax* will be ignored. - *shading*: [ 'flat' | 'faceted' ] + *shading*: [ 'flat' | 'faceted' | 'gouraud' ] If 'faceted', a black grid is drawn around each rectangle; if 'flat', edges are not drawn. Default is 'flat', contrary to Matlab(TM). @@ -6584,7 +6584,7 @@ cmap = kwargs.pop('cmap', None) vmin = kwargs.pop('vmin', None) vmax = kwargs.pop('vmax', None) - shading = kwargs.pop('shading', 'flat') + shading = kwargs.pop('shading', 'flat').lower() edgecolors = kwargs.pop('edgecolors', 'None') antialiased = kwargs.pop('antialiased', False) @@ -6592,8 +6592,11 @@ Ny, Nx = X.shape # convert to one dimensional arrays - C = ma.ravel(C[0:Ny-1, 0:Nx-1]) # data point in each cell is value at - # lower left corner + if shading != 'gouraud': + C = ma.ravel(C[0:Ny-1, 0:Nx-1]) # data point in each cell is value at + # lower left corner + else: + C = C.ravel() X = X.ravel() Y = Y.ravel() @@ -6608,7 +6611,7 @@ collection = mcoll.QuadMesh( Nx - 1, Ny - 1, coords, showedges, - antialiased=antialiased) # kwargs are not used + antialiased=antialiased, shading=shading) # kwargs are not used collection.set_alpha(alpha) collection.set_array(C) if norm is not None: assert(isinstance(norm, mcolors.Normalize)) Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backend_bases.py 2009-08-07 17:02:28 UTC (rev 7417) +++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2009-08-07 18:31:45 UTC (rev 7418) @@ -166,6 +166,14 @@ gc, master_transform, paths, [], offsets, offsetTrans, facecolors, edgecolors, linewidths, [], [antialiased], [None]) + def draw_gouraud_triangle(self, gc, points, colors, transform): + """ + Draw a Gouraud-shaded triangle. + + EXPERIMENTAL + """ + raise NotImplementedError + def _iter_collection_raw_paths(self, master_transform, paths, all_transforms): """ Modified: trunk/matplotlib/lib/matplotlib/backends/backend_agg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2009-08-07 17:02:28 UTC (rev 7417) +++ trunk/matplotlib/lib/matplotlib/backends/backend_agg.py 2009-08-07 18:31:45 UTC (rev 7418) @@ -63,6 +63,7 @@ self.draw_markers = self._renderer.draw_markers self.draw_path_collection = self._renderer.draw_path_collection self.draw_quad_mesh = self._renderer.draw_quad_mesh + self.draw_gouraud_triangle = self._renderer.draw_gouraud_triangle self.draw_image = self._renderer.draw_image self.copy_from_bbox = self._renderer.copy_from_bbox self.tostring_rgba_minimized = self._renderer.tostring_rgba_minimized Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2009-08-07 17:02:28 UTC (rev 7417) +++ trunk/matplotlib/lib/matplotlib/collections.py 2009-08-07 18:31:45 UTC (rev 7418) @@ -1073,14 +1073,18 @@ coordinates of the vertex at mesh coordinates (0, 0), then the one at (0, 1), then at (0, 2) .. (0, meshWidth), (1, 0), (1, 1), and so on. + + *shading* may be 'flat', 'faceted' or 'gouraud' """ - def __init__(self, meshWidth, meshHeight, coordinates, showedges, antialiased=True): + def __init__(self, meshWidth, meshHeight, coordinates, showedges, + antialiased=True, shading='flat'): Collection.__init__(self) self._meshWidth = meshWidth self._meshHeight = meshHeight self._coordinates = coordinates self._showedges = showedges self._antialiased = antialiased + self._shading = shading self._bbox = transforms.Bbox.unit() self._bbox.update_from_data_xy(coordinates.reshape( @@ -1125,6 +1129,46 @@ points = points.reshape((meshWidth * meshHeight, 5, 2)) return [Path(x) for x in points] + def convert_mesh_to_triangles(self, meshWidth, meshHeight, coordinates): + """ + Converts a given mesh into a sequence of triangles, each point + with its own color + :class:`matplotlib.path.Path` objects for easier rendering by + backends that do not directly support quadmeshes. + + This function is primarily of use to backend implementers. + """ + Path = mpath.Path + + if ma.isMaskedArray(coordinates): + c = coordinates.data + else: + c = coordinates + + triangles = np.concatenate(( + c[0:-1, 0:-1], + c[0:-1, 1: ], + c[1: , 1: ], + c[1: , 1: ], + c[1: , 0:-1], + c[0:-1, 0:-1] + ), axis=2) + triangles = triangles.reshape((meshWidth * meshHeight * 2, 3, 2)) + + c = self.get_facecolor().reshape((meshHeight + 1, meshWidth + 1, 4)) + colors = np.concatenate(( + c[0:-1, 0:-1], + c[0:-1, 1: ], + c[1: , 1: ], + c[1: , 1: ], + c[1: , 0:-1], + c[0:-1, 0:-1] + ), axis=2) + + colors = colors.reshape((meshWidth * meshHeight * 2, 3, 4)) + + return triangles, colors + def get_datalim(self, transData): return self._bbox @@ -1166,10 +1210,17 @@ gc.set_clip_rectangle(self.get_clip_box()) gc.set_clip_path(self.get_clip_path()) - renderer.draw_quad_mesh( - gc, transform.frozen(), self._meshWidth, self._meshHeight, - coordinates, offsets, transOffset, self.get_facecolor(), - self._antialiased, self._showedges) + if self._shading == 'gouraud': + triangles, colors = self.convert_mesh_to_triangles( + self._meshWidth, self._meshHeight, coordinates) + check = {} + for tri, col in zip(triangles, colors): + renderer.draw_gouraud_triangle(gc, tri, col, transform.frozen()) + else: + renderer.draw_quad_mesh( + gc, transform.frozen(), self._meshWidth, self._meshHeight, + coordinates, offsets, transOffset, self.get_facecolor(), + self._antialiased, self._showedges) renderer.close_group(self.__class__.__name__) Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2009-08-07 17:02:28 UTC (rev 7417) +++ trunk/matplotlib/src/_backend_agg.cpp 2009-08-07 18:31:45 UTC (rev 7418) @@ -1464,11 +1464,14 @@ typedef agg::span_allocator<color_t> span_alloc_t; //segments, trans, clipbox, colors, linewidths, antialiaseds - GCAgg gc(args[0], dpi); - Py::Object points_obj = args[1]; - Py::Object colors_obj = args[2]; - agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[3].ptr()); + GCAgg gc(args[0], dpi); + Py::Object points_obj = args[1]; + Py::Object colors_obj = args[2]; + agg::trans_affine trans = py_to_agg_transformation_matrix(args[3].ptr()); + trans *= agg::trans_affine_scaling(1.0, -1.0); + trans *= agg::trans_affine_translation(0.0, (double)height); + PyArrayObject* points = (PyArrayObject*)PyArray_ContiguousFromAny (points_obj.ptr(), PyArray_DOUBLE, 2, 2); if (!points || @@ -1489,7 +1492,7 @@ for (int i = 0; i < 6; i += 2) { tpoints[i] = opoints[i]; tpoints[i+1] = opoints[i+1]; - master_transform.transform(&tpoints[i], &tpoints[i+1]); + trans.transform(&tpoints[i], &tpoints[i+1]); } span_alloc_t span_alloc; @@ -1503,7 +1506,7 @@ tpoints[0], tpoints[1], tpoints[2], tpoints[3], tpoints[4], tpoints[5], - 1.0); + 0.5); theRasterizer.add_path(span_gen); agg::render_scanlines_aa( This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-08-08 01:46:56
|
Revision: 7422 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7422&view=rev Author: efiring Date: 2009-08-08 01:46:44 +0000 (Sat, 08 Aug 2009) Log Message: ----------- Convert slit paths to compound paths inside cntr.c. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/contour.py trunk/matplotlib/src/cntr.c Modified: trunk/matplotlib/lib/matplotlib/contour.py =================================================================== --- trunk/matplotlib/lib/matplotlib/contour.py 2009-08-08 01:40:31 UTC (rev 7421) +++ trunk/matplotlib/lib/matplotlib/contour.py 2009-08-08 01:46:44 UTC (rev 7422) @@ -539,7 +539,6 @@ """ self.ax = ax - self.noslit = kwargs.get('noslit', False) # **Temporary** self.levels = kwargs.get('levels', None) self.filled = kwargs.get('filled', False) self.linewidths = kwargs.get('linewidths', None) @@ -599,8 +598,6 @@ self.collections = cbook.silent_list('collections.PathCollection') else: self.collections = cbook.silent_list('collections.LineCollection') - self.segs = [] - self.kinds = [] # label lists must be initialized here self.labelTexts = [] self.labelCValues = [] @@ -629,8 +626,6 @@ alpha=self.alpha) self.ax.add_collection(col) self.collections.append(col) - self.segs.append(segs) - self.kinds.append(kinds) else: tlinewidths = self._process_linewidths() self.tlinewidths = tlinewidths @@ -639,7 +634,7 @@ nlist = C.trace(level) nseg = len(nlist)//2 segs = nlist[:nseg] - kinds = nlist[nseg:] + #kinds = nlist[nseg:] col = collections.LineCollection(segs, linewidths = width, linestyle = lstyle, @@ -648,24 +643,16 @@ col.set_label('_nolegend_') self.ax.add_collection(col, False) self.collections.append(col) - self.segs.append(segs) - self.kinds.append(kinds) self.changed() # set the colors def _make_paths(self, segs, kinds): paths = [] for seg, kind in zip(segs, kinds): - codes = np.zeros(kind.shape, dtype=mpath.Path.code_type) - codes.fill(mpath.Path.LINETO) - codes[0] = mpath.Path.MOVETO - # points that begin a slit or are in it: - # use moveto for any point *following* such a point - if self.noslit: - in_slit = kind[:-1] >= _cntr._slitkind - codes[1:][in_slit] = mpath.Path.MOVETO - paths.append(mpath.Path(seg, codes)) + paths.append(mpath.Path(seg, codes=kind)) return paths + + def changed(self): tcolors = [ (tuple(rgba),) for rgba in self.to_rgba(self.cvalues, alpha=self.alpha)] Modified: trunk/matplotlib/src/cntr.c =================================================================== --- trunk/matplotlib/src/cntr.c 2009-08-08 01:40:31 UTC (rev 7421) +++ trunk/matplotlib/src/cntr.c 2009-08-08 01:46:44 UTC (rev 7422) @@ -1318,9 +1318,134 @@ site = NULL; } +#define MOVETO 1 +#define LINETO 2 -/* Build a list of XY 2-D arrays, shape (N,2), to which a list of K arrays - is concatenated. */ +int reorder(double *xpp, double *ypp, short *kpp, + double *xy, unsigned char *c, int npts) +{ + int *i0; + int *i1; + int *subp=NULL; /* initialized to suppress warning */ + int isp, nsp; + int iseg, nsegs; + int isegplus; + int i; + int k; + int started; + int maxnsegs = npts/2 + 1; + + /* allocate maximum possible size--gross overkill */ + i0 = malloc(maxnsegs * sizeof(int)); + i1 = malloc(maxnsegs * sizeof(int)); + + /* Find the segments. */ + iseg = 0; + started = 0; + for (i=0; i<npts; i++) + { + if (started) + { + if ((kpp[i] >= kind_slit_up) || (i == npts-1)) + { + i1[iseg] = i; + started = 0; + iseg++; + if (iseg == maxnsegs) + { + k = -1; + goto ending; + } + } + } + else if ((kpp[i] < kind_slit_up) && (i < npts-1)) + { + i0[iseg] = i; + started = 1; + } + } + + nsegs = iseg; + + + /* Find the subpaths as sets of connected segments. */ + + subp = malloc(nsegs * sizeof(int)); + for (i=0; i<nsegs; i++) subp[i] = -1; + + nsp = 0; + for (iseg=0; iseg<nsegs; iseg++) + { + /* For each segment, if it is not closed, look ahead for + the next connected segment. + */ + double xend, yend; + xend = xpp[i1[iseg]]; + yend = ypp[i1[iseg]]; + if (subp[iseg] >= 0) continue; + subp[iseg] = nsp; + nsp++; + if (iseg == nsegs-1) continue; + for (isegplus = iseg+1; isegplus < nsegs; isegplus++) + { + if (subp[isegplus] >= 0) continue; + + if (xend == xpp[i0[isegplus]] && yend == ypp[i0[isegplus]]) + { + subp[isegplus] = subp[iseg]; + xend = xpp[i1[isegplus]]; + yend = ypp[i1[isegplus]]; + } + + } + } + + /* Generate the verts and codes from the subpaths. */ + k = 0; + for (isp=0; isp<nsp; isp++) + { + int first = 1; + for (iseg=0; iseg<nsegs; iseg++) + { + int istart, iend; + if (subp[iseg] != isp) continue; + iend = i1[iseg]; + if (first) + { + istart = i0[iseg]; + } + else + { + istart = i0[iseg]+1; /* skip duplicate */ + } + for (i=istart; i<=iend; i++) + { + xy[2*k] = xpp[i]; + xy[2*k+1] = ypp[i]; + if (first) c[k] = MOVETO; + else c[k] = LINETO; + first = 0; + k++; + if (k > npts) /* should never happen */ + { + k = -1; + goto ending; + } + } + } + } + + ending: + free(i0); + free(i1); + free(subp); + + return k; +} + +/* Build a list of XY 2-D arrays, shape (N,2), to which a list of path + code arrays is concatenated. +*/ static PyObject * build_cntr_list_v2(long *np, double *xp, double *yp, short *kp, int nparts, long ntotal) @@ -1331,6 +1456,73 @@ npy_intp dims[2]; npy_intp kdims[1]; int i; + long k; + + PyArray_Dims newshape; + + all_contours = PyList_New(nparts*2); + + for (i=0, k=0; i < nparts; k+= np[i], i++) + { + double *xpp = xp+k; + double *ypp = yp+k; + short *kpp = kp+k; + int n; + + + dims[0] = np[i]; + dims[1] = 2; + kdims[0] = np[i]; + xyv = (PyArrayObject *) PyArray_SimpleNew(2, dims, PyArray_DOUBLE); + if (xyv == NULL) goto error; + kv = (PyArrayObject *) PyArray_SimpleNew(1, kdims, PyArray_UBYTE); + if (kv == NULL) goto error; + + n = reorder(xpp, ypp, kpp, + (double *) xyv->data, + (unsigned char *) kv->data, + np[i]); + if (n == -1) goto error; + newshape.len = 2; + dims[0] = n; + newshape.ptr = dims; + if (PyArray_Resize(xyv, &newshape, 1, NPY_CORDER) == NULL) goto error; + + newshape.len = 1; /* ptr, dims can stay the same */ + if (PyArray_Resize(kv, &newshape, 1, NPY_CORDER) == NULL) goto error; + + + if (PyList_SetItem(all_contours, i, (PyObject *)xyv)) goto error; + if (PyList_SetItem(all_contours, nparts+i, + (PyObject *)kv)) goto error; + } + return all_contours; + + error: + Py_XDECREF(xyv); + Py_XDECREF(kv); + Py_XDECREF(all_contours); + return NULL; +} + +#if 0 /* preprocess this out when we are not using it. */ +/* Build a list of XY 2-D arrays, shape (N,2), to which a list of K arrays + is concatenated. + This is kept in the code in case we need to switch back to it, + or in case we need it for investigating the infamous internal + masked region bug. +*/ + +static PyObject * +__build_cntr_list_v2(long *np, double *xp, double *yp, short *kp, + int nparts, long ntotal) +{ + PyObject *all_contours; + PyArrayObject *xyv; + PyArrayObject *kv; + npy_intp dims[2]; + npy_intp kdims[1]; + int i; long j, k; all_contours = PyList_New(nparts*2); @@ -1364,6 +1556,7 @@ return NULL; } +#endif /* preprocessing out the old version for now */ /* cntr_trace is called once per contour level or level pair. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2009-08-08 02:07:11
|
Revision: 7423 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7423&view=rev Author: leejjoon Date: 2009-08-08 02:06:56 +0000 (Sat, 08 Aug 2009) Log Message: ----------- BboxImage implemented and two examples added. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/image.py Added Paths: ----------- trunk/matplotlib/examples/pylab_examples/demo_bboximage.py trunk/matplotlib/examples/pylab_examples/demo_ribbon_box.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-08-08 01:46:44 UTC (rev 7422) +++ trunk/matplotlib/CHANGELOG 2009-08-08 02:06:56 UTC (rev 7423) @@ -1,3 +1,6 @@ +2009-08-07 BboxImage implemented. Two examples, demo_bboximage.py and + demo_ribbon_box.py added. - JJL + 2009-08-07 In an effort to simplify the backend API, all clipping rectangles and paths are now passed in using GraphicsContext objects, even on collections and images. Therefore: Added: trunk/matplotlib/examples/pylab_examples/demo_bboximage.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/demo_bboximage.py (rev 0) +++ trunk/matplotlib/examples/pylab_examples/demo_bboximage.py 2009-08-08 02:06:56 UTC (rev 7423) @@ -0,0 +1,62 @@ +import matplotlib.pyplot as plt +import numpy as np +from matplotlib.image import BboxImage +from matplotlib.transforms import Bbox, TransformedBbox + +if __name__ == "__main__": + + fig = plt.figure(1) + ax = plt.subplot(121) + + txt = ax.text(0.5, 0.5, "test", size=30, ha="center", color="w") + kwargs = dict() + + bbox_image = BboxImage(txt.get_window_extent, + norm = None, + origin=None, + clip_on=False, + **kwargs + ) + a = np.arange(256).reshape(1,256)/256. + bbox_image.set_data(a) + ax.add_artist(bbox_image) + + + ax = plt.subplot(122) + a = np.linspace(0, 1, 256).reshape(1,-1) + a = np.vstack((a,a)) + + maps = sorted(m for m in plt.cm.datad if not m.endswith("_r")) + #nmaps = len(maps) + 1 + + #fig.subplots_adjust(top=0.99, bottom=0.01, left=0.2, right=0.99) + + ncol = 2 + nrow = len(maps)//ncol + 1 + + xpad_fraction = 0.3 + dx = 1./(ncol + xpad_fraction*(ncol-1)) + + ypad_fraction = 0.3 + dy = 1./(nrow + ypad_fraction*(nrow-1)) + + for i,m in enumerate(maps): + ix, iy = divmod(i, nrow) + #plt.figimage(a, 10, i*10, cmap=plt.get_cmap(m), origin='lower') + bbox0 = Bbox.from_bounds(ix*dx*(1+xpad_fraction), + 1.-iy*dy*(1+ypad_fraction)-dy, + dx, dy) + bbox = TransformedBbox(bbox0, ax.transAxes) + + bbox_image = BboxImage(bbox, + cmap = plt.get_cmap(m), + norm = None, + origin=None, + **kwargs + ) + + bbox_image.set_data(a) + ax.add_artist(bbox_image) + + plt.draw() + plt.show() Added: trunk/matplotlib/examples/pylab_examples/demo_ribbon_box.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/demo_ribbon_box.py (rev 0) +++ trunk/matplotlib/examples/pylab_examples/demo_ribbon_box.py 2009-08-08 02:06:56 UTC (rev 7423) @@ -0,0 +1,140 @@ +import matplotlib.pyplot as plt +import numpy as np +from matplotlib.image import BboxImage + +from matplotlib._png import read_png +import matplotlib.colors +from matplotlib.cbook import get_sample_data + +class RibbonBox(object): + + original_image = read_png(get_sample_data("Minduka_Present_Blue_Pack.png", + asfileobj=False)) + cut_location = 70 + b_and_h = original_image[:,:,2] + color = original_image[:,:,2] - original_image[:,:,0] + alpha = original_image[:,:,3] + nx = original_image.shape[1] + + def __init__(self, color): + rgb = matplotlib.colors.colorConverter.to_rgb(color) + + im = np.empty(self.original_image.shape, + self.original_image.dtype) + + + im[:,:,:3] = self.b_and_h[:,:,np.newaxis] + im[:,:,:3] -= self.color[:,:,np.newaxis]*(1.-np.array(rgb)) + im[:,:,3] = self.alpha + + self.im = im + + + def get_stretched_image(self, stretch_factor): + stretch_factor = max(stretch_factor, 1) + ny, nx, nch = self.im.shape + ny2 = int(ny*stretch_factor) + + stretched_image = np.empty((ny2, nx, nch), + self.im.dtype) + cut = self.im[self.cut_location,:,:] + stretched_image[:,:,:] = cut + stretched_image[:self.cut_location,:,:] = \ + self.im[:self.cut_location,:,:] + stretched_image[-(ny-self.cut_location):,:,:] = \ + self.im[-(ny-self.cut_location):,:,:] + + self._cached_im = stretched_image + return stretched_image + + + +class RibbonBoxImage(BboxImage): + zorder = 1 + + def __init__(self, bbox, color, + cmap = None, + norm = None, + interpolation=None, + origin=None, + filternorm=1, + filterrad=4.0, + resample = False, + **kwargs + ): + + BboxImage.__init__(self, bbox, + cmap = None, + norm = None, + interpolation=None, + origin=None, + filternorm=1, + filterrad=4.0, + resample = False, + **kwargs + ) + + self._ribbonbox = RibbonBox(color) + self._cached_ny = None + + + def draw(self, renderer, *args, **kwargs): + + bbox = self.get_window_extent(renderer) + stretch_factor = bbox.height / bbox.width + + ny = int(stretch_factor*self._ribbonbox.nx) + if self._cached_ny != ny: + arr = self._ribbonbox.get_stretched_image(stretch_factor) + self.set_array(arr) + self._cached_ny = ny + + BboxImage.draw(self, renderer, *args, **kwargs) + + +if 1: + from matplotlib.transforms import Bbox, TransformedBbox + from matplotlib.ticker import ScalarFormatter + + fig = plt.gcf() + fig.clf() + ax = plt.subplot(111) + + years = np.arange(2004, 2009) + box_colors = [(0.8, 0.2, 0.2), + (0.2, 0.8, 0.2), + (0.2, 0.2, 0.8), + (0.7, 0.5, 0.8), + (0.3, 0.8, 0.7), + ] + heights = np.random.random(years.shape) * 7000 + 3000 + + fmt = ScalarFormatter(useOffset=False) + ax.xaxis.set_major_formatter(fmt) + + for year, h, bc in zip(years, heights, box_colors): + bbox0 = Bbox.from_extents(year-0.4, 0., year+0.4, h) + bbox = TransformedBbox(bbox0, ax.transData) + rb_patch = RibbonBoxImage(bbox, bc) + + ax.add_artist(rb_patch) + + ax.annotate(r"%d" % (int(h/100.)*100), + (year, h), va="bottom", ha="center") + + patch_gradient = BboxImage(ax.bbox, + interpolation="bicubic", + zorder=0.1, + ) + gradient = np.zeros((2, 2, 4), dtype=np.float) + gradient[:,:,:3] = [1, 1, 0.] + gradient[:,:,3] = [[0.1, 0.3],[0.3, 0.5]] # alpha channel + patch_gradient.set_array(gradient) + ax.add_artist(patch_gradient) + + + ax.set_xlim(years[0]-0.5, years[-1]+0.5) + ax.set_ylim(0, 10000) + + plt.show() + Modified: trunk/matplotlib/lib/matplotlib/image.py =================================================================== --- trunk/matplotlib/lib/matplotlib/image.py 2009-08-08 01:46:44 UTC (rev 7422) +++ trunk/matplotlib/lib/matplotlib/image.py 2009-08-08 02:06:56 UTC (rev 7423) @@ -24,6 +24,8 @@ # the image namespace: from matplotlib._image import * +from matplotlib.transforms import BboxBase + class AxesImage(martist.Artist, cm.ScalarMappable): zorder = 1 # map interpolation strings to module constants @@ -744,6 +746,149 @@ rows, cols, buffer = im.as_rgba_str() _png.write_png(buffer, cols, rows, fname) + +class BboxImage(AxesImage): + """ + The Image class whose size is determined by the given bbox. + """ + zorder = 1 + def __init__(self, bbox, + cmap = None, + norm = None, + interpolation=None, + origin=None, + filternorm=1, + filterrad=4.0, + resample = False, + **kwargs + ): + + """ + cmap is a colors.Colormap instance + norm is a colors.Normalize instance to map luminance to 0-1 + + kwargs are an optional list of Artist keyword args + """ + + AxesImage.__init__(self, ax=None, + cmap = cmap, + norm = norm, + interpolation=interpolation, + origin=origin, + filternorm=filternorm, + filterrad=filterrad, + resample = resample, + **kwargs + ) + + self.bbox = bbox + + def get_window_extent(self, renderer=None): + if renderer is None: + renderer = self.get_figure()._cachedRenderer + + if isinstance(self.bbox, BboxBase): + return self.bbox + elif callable(self.bbox): + return self.bbox(renderer) + else: + raise ValueError("unknown type of bbox") + + + def contains(self, mouseevent): + """Test whether the mouse event occured within the image. + """ + + if callable(self._contains): return self._contains(self,mouseevent) + + if not self.get_visible():# or self.get_figure()._renderer is None: + return False,{} + + x, y = mouseevent.x, mouseevent.y + inside = self.get_window_extent().contains(x, y) + + return inside,{} + + def get_size(self): + 'Get the numrows, numcols of the input image' + if self._A is None: + raise RuntimeError('You must first set the image array') + + return self._A.shape[:2] + + def make_image(self, renderer, magnification=1.0): + if self._A is None: + raise RuntimeError('You must first set the image array or the image attribute') + + if self._imcache is None: + if self._A.dtype == np.uint8 and len(self._A.shape) == 3: + im = _image.frombyte(self._A, 0) + im.is_grayscale = False + else: + if self._rgbacache is None: + x = self.to_rgba(self._A, self._alpha) + self._rgbacache = x + else: + x = self._rgbacache + im = _image.fromarray(x, 0) + if len(self._A.shape) == 2: + im.is_grayscale = self.cmap.is_gray() + else: + im.is_grayscale = False + self._imcache = im + + if self.origin=='upper': + im.flipud_in() + else: + im = self._imcache + + if 0: + fc = self.axes.patch.get_facecolor() + bg = mcolors.colorConverter.to_rgba(fc, 0) + im.set_bg( *bg) + + # image input dimensions + im.reset_matrix() + + im.set_interpolation(self._interpd[self._interpolation]) + + im.set_resample(self._resample) + + l, b, r, t = self.get_window_extent(renderer).extents #bbox.extents + widthDisplay = (round(r) + 0.5) - (round(l) - 0.5) + heightDisplay = (round(t) + 0.5) - (round(b) - 0.5) + widthDisplay *= magnification + heightDisplay *= magnification + #im.apply_translation(tx, ty) + + numrows, numcols = self._A.shape[:2] + + # resize viewport to display + rx = widthDisplay / numcols + ry = heightDisplay / numrows + #im.apply_scaling(rx*sx, ry*sy) + im.apply_scaling(rx, ry) + #im.resize(int(widthDisplay+0.5), int(heightDisplay+0.5), + # norm=self._filternorm, radius=self._filterrad) + im.resize(int(widthDisplay), int(heightDisplay), + norm=self._filternorm, radius=self._filterrad) + 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 + image_mag = renderer.get_image_magnification() + im = self.make_image(renderer, image_mag) + l, b, r, t = self.get_window_extent(renderer).extents + gc = renderer.new_gc() + self._set_gc_clip(gc) + #gc.set_clip_path(self.get_clip_path()) + renderer.draw_image(gc, round(l), round(b), im) + + + def imread(fname): """ Return image file in *fname* as :class:`numpy.array`. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-08-08 06:24:14
|
Revision: 7425 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7425&view=rev Author: efiring Date: 2009-08-08 06:24:00 +0000 (Sat, 08 Aug 2009) Log Message: ----------- Merged revisions 7407,7409,7414,7416,7424 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint ........ r7407 | jdh2358 | 2009-08-06 08:51:58 -1000 (Thu, 06 Aug 2009) | 1 line hide colorbar_doc a bit ........ r7409 | ryanmay | 2009-08-06 09:28:16 -1000 (Thu, 06 Aug 2009) | 1 line Tweak solution for hiding colorbar_doc to sync with trunk. ........ r7414 | jdh2358 | 2009-08-07 00:15:04 -1000 (Fri, 07 Aug 2009) | 1 line some doc fixes ........ r7416 | jdh2358 | 2009-08-07 05:40:56 -1000 (Fri, 07 Aug 2009) | 1 line don't fail on window icon load ........ r7424 | efiring | 2009-08-07 20:07:06 -1000 (Fri, 07 Aug 2009) | 2 lines Restore default colormap behavior: no color (alpha = 0) for masked data ........ Modified Paths: -------------- trunk/matplotlib/doc/_templates/indexsidebar.html trunk/matplotlib/doc/users/annotations.rst trunk/matplotlib/doc/users/artists.rst trunk/matplotlib/doc/users/credits.rst trunk/matplotlib/doc/users/event_handling.rst trunk/matplotlib/doc/users/pyplot_tutorial.rst trunk/matplotlib/doc/users/screenshots.rst trunk/matplotlib/doc/users/whats_new.rst trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py trunk/matplotlib/lib/matplotlib/colors.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/examples/misc/multiprocess.py trunk/matplotlib/examples/mplot3d/contour3d_demo.py trunk/matplotlib/examples/mplot3d/contourf3d_demo.py trunk/matplotlib/examples/mplot3d/polys3d_demo.py trunk/matplotlib/examples/mplot3d/scatter3d_demo.py trunk/matplotlib/examples/mplot3d/surface3d_demo.py trunk/matplotlib/examples/mplot3d/wire3d_demo.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7404 + /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7424 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393,7395-7404 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393,7395-7404,7407-7424 Modified: trunk/matplotlib/doc/_templates/indexsidebar.html =================================================================== --- trunk/matplotlib/doc/_templates/indexsidebar.html 2009-08-08 06:07:06 UTC (rev 7424) +++ trunk/matplotlib/doc/_templates/indexsidebar.html 2009-08-08 06:24:00 UTC (rev 7425) @@ -29,7 +29,7 @@ and join the matplotlib mailing <a href="http://sourceforge.net/mail/?group_id=80706">lists</a>. The <a href="{{ pathto('search') }}">search</a> tool searches all of -the documentation, including full text search of almost 300 complete +the documentation, including full text search of over 350 complete examples which exercise almost every corner of matplotlib.</p> <p>You can file bugs, patches and feature requests on the Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424 Modified: trunk/matplotlib/doc/users/annotations.rst =================================================================== --- trunk/matplotlib/doc/users/annotations.rst 2009-08-08 06:07:06 UTC (rev 7424) +++ trunk/matplotlib/doc/users/annotations.rst 2009-08-08 06:24:00 UTC (rev 7425) @@ -78,6 +78,4 @@ .. plot:: pyplots/annotation_polar.py :include-source: -See the `annotations demo -<http://matplotlib.sf.net/examples/pylab_examples/annotation_demo.py>`_ for more -examples. +For more on all the wild and wonderful things you can do with annotations, including fancy arrows, see :ref:`plotting-guide-annotation` and :ref:`pylab_examples-annotation_demo`. Modified: trunk/matplotlib/doc/users/artists.rst =================================================================== --- trunk/matplotlib/doc/users/artists.rst 2009-08-08 06:07:06 UTC (rev 7424) +++ trunk/matplotlib/doc/users/artists.rst 2009-08-08 06:24:00 UTC (rev 7425) @@ -19,27 +19,7 @@ and laying out the figure, text, and lines. The typical user will spend 95% of his time working with the ``Artists``. -There are two types of ``Artists``: primitives and containers. The -primitives represent the standard graphical objects we want to paint -onto our canvas: :class:`~matplotlib.lines.Line2D`, -:class:`~matplotlib.patches.Rectangle`, -:class:`~matplotlib.text.Text`, :class:`~matplotlib.image.AxesImage`, -etc., and the containers are places to put them -(:class:`~matplotlib.axis.Axis`, :class:`~matplotlib.axes.Axes` and -:class:`~matplotlib.figure.Figure`). The standard use is to create a -:class:`~matplotlib.figure.Figure` instance, use the ``Figure`` to -create one or more :class:`~matplotlib.axes.Axes` or -:class:`~matplotlib.axes.Subplot` instances, and use the ``Axes`` -instance helper methods to create the primitives. In the example -below, we create a ``Figure`` instance using -:func:`matplotlib.pyplot.figure`, which is a convenience method for -instantiating ``Figure`` instances and connecting them with your user -interface or drawing toolkit ``FigureCanvas``. As we will discuss -below, this is not necessary, and you can work directly with -PostScript, PDF Gtk+, or wxPython ``FigureCanvas`` instances. For -example, instantiate your ``Figures`` directly and connect them -yourselves, but since we are focusing here on the ``Artist`` API we'll let -:mod:`~matplotlib.pyplot` handle some of those details for us:: +There are two types of ``Artists``: primitives and containers. The primitives represent the standard graphical objects we want to paint onto our canvas: :class:`~matplotlib.lines.Line2D`, :class:`~matplotlib.patches.Rectangle`, :class:`~matplotlib.text.Text`, :class:`~matplotlib.image.AxesImage`, etc., and the containers are places to put them (:class:`~matplotlib.axis.Axis`, :class:`~matplotlib.axes.Axes` and :class:`~matplotlib.figure.Figure`). The standard use is to create a :class:`~matplotlib.figure.Figure` instance, use the ``Figure`` to create one or more :class:`~matplotlib.axes.Axes` or :class:`~matplotlib.axes.Subplot` instances, and use the ``Axes`` instance helper methods to create the primitives. In the example below, we create a ``Figure`` instance using :func:`matplotlib.pyplot.figure`, which is a convenience method for instantiating ``Figure`` instances and connecting them with your user interface or drawing toolkit ``FigureCanvas``. As we will discuss below, this is not necessary -- you can work directly with PostScript, PDF Gtk+, or wxPython ``FigureCanvas`` instances, instantiate your ``Figures`` directly and connect them yourselves -- but since we are focusing here on the ``Artist`` API we'll let :mod:`~matplotlib.pyplot` handle some of those details for us:: import matplotlib.pyplot as plt fig = plt.figure() @@ -85,7 +65,7 @@ <matplotlib.axes.Axes.lines>` list. In the interactive `ipython <http://ipython.scipy.org/>`_ session below, you can see that the ``Axes.lines`` list is length one and contains the same line that was -returned by the ``line, = ax.plot(x, y, 'o')`` call: +returned by the ``line, = ax.plot...`` call: .. sourcecode:: ipython @@ -536,20 +516,7 @@ :class:`~matplotlib.ticker.Formatter` instances which control where the ticks are placed and how they are represented as strings. -Each ``Axis`` object contains a :attr:`~matplotlib.axis.Axis.label` -attribute (this is what the :mod:`~matplotlib.pylab` calls to -:func:`~matplotlib.pylab.xlabel` and :func:`~matplotlib.pylab.ylabel` -set) as well as a list of major and minor ticks. The ticks are -:class:`~matplotlib.axis.XTick` and :class:`~matplotlib.axis.YTick` -instances, which contain the actual line and text primitives that -render the ticks and ticklabels. Because the ticks are dynamically -created as needed (eg. when panning and zooming), you should access -the lists of major and minor ticks through their accessor methods -:meth:`~matplotlib.axis.Axis.get_major_ticks` and -:meth:`~matplotlib.axis.Axis.get_minor_ticks`. Although the ticks -contain all the primitives and will be covered below, the ``Axis`` methods -contain accessor methods to return the tick lines, tick labels, tick -locations etc.: +Each ``Axis`` object contains a :attr:`~matplotlib.axis.Axis.label` attribute (this is what :mod:`~matplotlib.pylab` modifies in calls to :func:`~matplotlib.pylab.xlabel` and :func:`~matplotlib.pylab.ylabel`) as well as a list of major and minor ticks. The ticks are :class:`~matplotlib.axis.XTick` and :class:`~matplotlib.axis.YTick` instances, which contain the actual line and text primitives that render the ticks and ticklabels. Because the ticks are dynamically created as needed (eg. when panning and zooming), you should access the lists of major and minor ticks through their accessor methods :meth:`~matplotlib.axis.Axis.get_major_ticks` and :meth:`~matplotlib.axis.Axis.get_minor_ticks`. Although the ticks contain all the primitives and will be covered below, the ``Axis`` methods contain accessor methods to return the tick lines, tick labels, tick locations etc.: .. sourcecode:: ipython @@ -636,7 +603,7 @@ label2On boolean which determines whether to draw tick label ============== ========================================================== -Here is an example which sets the formatter for the upper ticks with +Here is an example which sets the formatter for the right side ticks with dollar signs and colors them green on the right side of the yaxis .. plot:: pyplots/dollar_ticks.py Modified: trunk/matplotlib/doc/users/credits.rst =================================================================== --- trunk/matplotlib/doc/users/credits.rst 2009-08-08 06:07:06 UTC (rev 7424) +++ trunk/matplotlib/doc/users/credits.rst 2009-08-08 06:24:00 UTC (rev 7425) @@ -16,9 +16,9 @@ Jeremy O'Donoghue wrote the wx backend -Andrew Straw - provided much of the log scaling architecture, the fill command, PIL - support for imshow, and provided many examples +Andrew Straw provided much of the log scaling architecture, the fill + command, PIL support for imshow, and provided many examples. He + also wrote the support for dropped axis spines. Charles Twardy provided the impetus code for the legend class and has made @@ -28,7 +28,6 @@ made many enhancements to errorbar to support x and y errorbar plots, and added a number of new marker types to plot. - John Gill wrote the table class and examples, helped with support for auto-legend placement, and added support for legending scatter @@ -133,7 +132,7 @@ most aspects of matplotlib. Daishi Harada - added support for "Dashed Text". See ` dashpointlabel.py + added support for "Dashed Text". See `dashpointlabel.py <examples/pylab_examples/dashpointlabel.py>`_ and :class:`~matplotlib.text.TextWithDash`. @@ -147,11 +146,10 @@ Charlie Moad - contributed work to matplotlib's Cocoa support and does the binary - builds and releases. + contributed work to matplotlib's Cocoa support and has done a lot of work on the OSX and win32 binary releases. -Jouni K. Seppaenen - wrote the PDF backend. +Jouni K. Seppaenen wrote the PDF backend and contributed numerous + fixes to the code, to tex support and to the get_sample_data handler Paul Kienzle improved the picking infrastruture for interactive plots, and with @@ -171,4 +169,7 @@ matplotlib, and Jonathon Taylor and Reinier Heeres ported it to the refactored transform trunk. - +Jae-Joon Lee implemented fancy arrows and boxes, rewrote the legend + support to handle multiple columns and fancy text boxes, wrote the + axes grid toolkit, and has made numerous contributions to the code + and documentation \ No newline at end of file Modified: trunk/matplotlib/doc/users/event_handling.rst =================================================================== --- trunk/matplotlib/doc/users/event_handling.rst 2009-08-08 06:07:06 UTC (rev 7424) +++ trunk/matplotlib/doc/users/event_handling.rst 2009-08-08 06:24:00 UTC (rev 7425) @@ -1,555 +1,555 @@ -.. _event-handling-tutorial: - -************************** -Event handling and picking -************************** - -matplotlib works with 5 user interface toolkits (wxpython, tkinter, -qt, gtk and fltk) and in order to support features like interactive -panning and zooming of figures, it is helpful to the developers to -have an API for interacting with the figure via key presses and mouse -movements that is "GUI neutral" so we don't have to repeat a lot of -code across the different user interfaces. Although the event -handling API is GUI neutral, it is based on the GTK model, which was -the first user interface matplotlib supported. The events that are -triggered are also a bit richer vis-a-vis matplotlib than standard GUI -events, including information like which :class:`matplotlib.axes.Axes` -the event occurred in. The events also understand the matplotlib -coordinate system, and report event locations in both pixel and data -coordinates. - -.. _event-connections: - -Event connections -================= - -To receive events, you need to write a callback function and then -connect your function to the event manager, which is part of the -:class:`~matplotlib.backend_bases.FigureCanvasBase`. Here is a simple -example that prints the location of the mouse click and which button -was pressed:: - - fig = plt.figure() - ax = fig.add_subplot(111) - ax.plot(np.random.rand(10)) - - def onclick(event): - print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%( - event.button, event.x, event.y, event.xdata, event.ydata) - - cid = fig.canvas.mpl_connect('button_press_event', onclick) - -The ``FigureCanvas`` method -:meth:`~matplotlib.backend_bases.FigureCanvasBase.mpl_connect` returns -a connection id which is simply an integer. When you want to -disconnect the callback, just call:: - - fig.canvas.mpl_disconnect(cid) - -Here are the events that you can connect to, the class instances that -are sent back to you when the event occurs, and the event descriptions - - -======================= ====================================================================================== -Event name Class and description -======================= ====================================================================================== -'button_press_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse button is pressed -'button_release_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse button is released -'draw_event' :class:`~matplotlib.backend_bases.DrawEvent` - canvas draw -'key_press_event' :class:`~matplotlib.backend_bases.KeyEvent` - key is pressed -'key_release_event' :class:`~matplotlib.backend_bases.KeyEvent` - key is released -'motion_notify_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse motion -'pick_event' :class:`~matplotlib.backend_bases.PickEvent` - an object in the canvas is selected -'resize_event' :class:`~matplotlib.backend_bases.ResizeEvent` - figure canvas is resized -'scroll_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse scroll wheel is rolled -'figure_enter_event' :class:`~matplotlib.backend_bases.LocationEvent` - mouse enters a new figure -'figure_leave_event' :class:`~matplotlib.backend_bases.LocationEvent` - mouse leaves a figure -'axes_enter_event' :class:`~matplotlib.backend_bases.LocationEvent` - mouse enters a new axes -'axes_leave_event' :class:`~matplotlib.backend_bases.LocationEvent` - mouse leaves an axes -======================= ====================================================================================== - -.. _event-attributes: - -Event attributes -================ - -All matplotlib events inherit from the base class -:class:`matplotlib.backend_bases.Event`, which store the attributes: - - ``name`` - the event name - - ``canvas`` - the FigureCanvas instance generating the event - - ``guiEvent`` - the GUI event that triggered the matplotlib event - - -The most common events that are the bread and butter of event handling -are key press/release events and mouse press/release and movement -events. The :class:`~matplotlib.backend_bases.KeyEvent` and -:class:`~matplotlib.backend_bases.MouseEvent` classes that handle -these events are both derived from the LocationEvent, which has the -following attributes - - ``x`` - x position - pixels from left of canvas - - ``y`` - y position - pixels from bottom of canvas - - ``inaxes`` - the :class:`~matplotlib.axes.Axes` instance if mouse is over axes - - ``xdata`` - x coord of mouse in data coords - - ``ydata`` - y coord of mouse in data coords - -Let's look a simple example of a canvas, where a simple line segment -is created every time a mouse is pressed:: - - class LineBuilder: - def __init__(self, line): - self.line = line - self.xs = list(line.get_xdata()) - self.ys = list(line.get_ydata()) - self.cid = line.figure.canvas.mpl_connect('button_press_event', self) - - def __call__(self, event): - print 'click', event - if event.inaxes!=self.line.axes: return - self.xs.append(event.xdata) - self.ys.append(event.ydata) - self.line.set_data(self.xs, self.ys) - self.line.figure.canvas.draw() - - fig = plt.figure() - ax = fig.add_subplot(111) - ax.set_title('click to build line segments') - line, = ax.plot([0], [0]) # empty line - linebuilder = LineBuilder(line) - - - -The :class:`~matplotlib.backend_bases.MouseEvent` that we just used is a -:class:`~matplotlib.backend_bases.LocationEvent`, so we have access to -the data and pixel coordinates in event.x and event.xdata. In -addition to the ``LocationEvent`` attributes, it has - - ``button`` - button pressed None, 1, 2, 3, 'up', 'down' (up and down are used for scroll events) - - ``key`` - the key pressed: None, chr(range(255), 'shift', 'win', or 'control' - -Draggable rectangle exercise ----------------------------- - -Write draggable rectangle class that is initialized with a -:class:`~matplotlib.patches.Rectangle` instance but will move its x,y -location when dragged. Hint: you will need to store the orginal -``xy`` location of the rectangle which is stored as rect.xy and -connect to the press, motion and release mouse events. When the mouse -is pressed, check to see if the click occurs over your rectangle (see -:meth:`matplotlib.patches.Rectangle.contains`) and if it does, store -the rectangle xy and the location of the mouse click in data coords. -In the motion event callback, compute the deltax and deltay of the -mouse movement, and add those deltas to the origin of the rectangle -you stored. The redraw the figure. On the button release event, just -reset all the button press data you stored as None. - -Here is the solution:: - - import numpy as np - import matplotlib.pyplot as plt - - class DraggableRectangle: - def __init__(self, rect): - self.rect = rect - self.press = None - - def connect(self): - 'connect to all the events we need' - self.cidpress = self.rect.figure.canvas.mpl_connect( - 'button_press_event', self.on_press) - self.cidrelease = self.rect.figure.canvas.mpl_connect( - 'button_release_event', self.on_release) - self.cidmotion = self.rect.figure.canvas.mpl_connect( - 'motion_notify_event', self.on_motion) - - def on_press(self, event): - 'on button press we will see if the mouse is over us and store some data' - if event.inaxes != self.rect.axes: return - - contains, attrd = self.rect.contains(event) - if not contains: return - print 'event contains', self.rect.xy - x0, y0 = self.rect.xy - self.press = x0, y0, event.xdata, event.ydata - - def on_motion(self, event): - 'on motion we will move the rect if the mouse is over us' - if self.press is None: return - if event.inaxes != self.rect.axes: return - x0, y0, xpress, ypress = self.press - dx = event.xdata - xpress - dy = event.ydata - ypress - #print 'x0=%f, xpress=%f, event.xdata=%f, dx=%f, x0+dx=%f'%(x0, xpress, event.xdata, dx, x0+dx) - self.rect.set_x(x0+dx) - self.rect.set_y(y0+dy) - - self.rect.figure.canvas.draw() - - - def on_release(self, event): - 'on release we reset the press data' - self.press = None - self.rect.figure.canvas.draw() - - def disconnect(self): - 'disconnect all the stored connection ids' - self.rect.figure.canvas.mpl_disconnect(self.cidpress) - self.rect.figure.canvas.mpl_disconnect(self.cidrelease) - self.rect.figure.canvas.mpl_disconnect(self.cidmotion) - - fig = plt.figure() - ax = fig.add_subplot(111) - rects = ax.bar(range(10), 20*np.random.rand(10)) - drs = [] - for rect in rects: - dr = DraggableRectangle(rect) - dr.connect() - drs.append(dr) - - plt.show() - - -**Extra credit**: use the animation blit techniques discussed in the -`animations recipe -<http://www.scipy.org/Cookbook/Matplotlib/Animations>`_ to make the -animated drawing faster and smoother. - -Extra credit solution:: - - # draggable rectangle with the animation blit techniques; see - # http://www.scipy.org/Cookbook/Matplotlib/Animations - import numpy as np - import matplotlib.pyplot as plt - - class DraggableRectangle: - lock = None # only one can be animated at a time - def __init__(self, rect): - self.rect = rect - self.press = None - self.background = None - - def connect(self): - 'connect to all the events we need' - self.cidpress = self.rect.figure.canvas.mpl_connect( - 'button_press_event', self.on_press) - self.cidrelease = self.rect.figure.canvas.mpl_connect( - 'button_release_event', self.on_release) - self.cidmotion = self.rect.figure.canvas.mpl_connect( - 'motion_notify_event', self.on_motion) - - def on_press(self, event): - 'on button press we will see if the mouse is over us and store some data' - if event.inaxes != self.rect.axes: return - if DraggableRectangle.lock is not None: return - contains, attrd = self.rect.contains(event) - if not contains: return - print 'event contains', self.rect.xy - x0, y0 = self.rect.xy - self.press = x0, y0, event.xdata, event.ydata - DraggableRectangle.lock = self - - # draw everything but the selected rectangle and store the pixel buffer - canvas = self.rect.figure.canvas - axes = self.rect.axes - self.rect.set_animated(True) - canvas.draw() - self.background = canvas.copy_from_bbox(self.rect.axes.bbox) - - # now redraw just the rectangle - axes.draw_artist(self.rect) - - # and blit just the redrawn area - canvas.blit(axes.bbox) - - def on_motion(self, event): - 'on motion we will move the rect if the mouse is over us' - if DraggableRectangle.lock is not self: - return - if event.inaxes != self.rect.axes: return - x0, y0, xpress, ypress = self.press - dx = event.xdata - xpress - dy = event.ydata - ypress - self.rect.set_x(x0+dx) - self.rect.set_y(y0+dy) - - canvas = self.rect.figure.canvas - axes = self.rect.axes - # restore the background region - canvas.restore_region(self.background) - - # redraw just the current rectangle - axes.draw_artist(self.rect) - - # blit just the redrawn area - canvas.blit(axes.bbox) - - def on_release(self, event): - 'on release we reset the press data' - if DraggableRectangle.lock is not self: - return - - self.press = None - DraggableRectangle.lock = None - - # turn off the rect animation property and reset the background - self.rect.set_animated(False) - self.background = None - - # redraw the full figure - self.rect.figure.canvas.draw() - - def disconnect(self): - 'disconnect all the stored connection ids' - self.rect.figure.canvas.mpl_disconnect(self.cidpress) - self.rect.figure.canvas.mpl_disconnect(self.cidrelease) - self.rect.figure.canvas.mpl_disconnect(self.cidmotion) - - fig = plt.figure() - ax = fig.add_subplot(111) - rects = ax.bar(range(10), 20*np.random.rand(10)) - drs = [] - for rect in rects: - dr = DraggableRectangle(rect) - dr.connect() - drs.append(dr) - - plt.show() - - -.. _enter-leave-events: - -Mouse enter and leave -====================== - -If you want to be notified when the mouse enters or leaves a figure or -axes, you can connect to the figure/axes enter/leave events. Here is -a simple example that changes the colors of the axes and figure -background that the mouse is over:: - - """ - Illustrate the figure and axes enter and leave events by changing the - frame colors on enter and leave - """ - import matplotlib.pyplot as plt - - def enter_axes(event): - print 'enter_axes', event.inaxes - event.inaxes.patch.set_facecolor('yellow') - event.canvas.draw() - - def leave_axes(event): - print 'leave_axes', event.inaxes - event.inaxes.patch.set_facecolor('white') - event.canvas.draw() - - def enter_figure(event): - print 'enter_figure', event.canvas.figure - event.canvas.figure.patch.set_facecolor('red') - event.canvas.draw() - - def leave_figure(event): - print 'leave_figure', event.canvas.figure - event.canvas.figure.patch.set_facecolor('grey') - event.canvas.draw() - - fig1 = plt.figure() - fig1.suptitle('mouse hover over figure or axes to trigger events') - ax1 = fig1.add_subplot(211) - ax2 = fig1.add_subplot(212) - - fig1.canvas.mpl_connect('figure_enter_event', enter_figure) - fig1.canvas.mpl_connect('figure_leave_event', leave_figure) - fig1.canvas.mpl_connect('axes_enter_event', enter_axes) - fig1.canvas.mpl_connect('axes_leave_event', leave_axes) - - fig2 = plt.figure() - fig2.suptitle('mouse hover over figure or axes to trigger events') - ax1 = fig2.add_subplot(211) - ax2 = fig2.add_subplot(212) - - fig2.canvas.mpl_connect('figure_enter_event', enter_figure) - fig2.canvas.mpl_connect('figure_leave_event', leave_figure) - fig2.canvas.mpl_connect('axes_enter_event', enter_axes) - fig2.canvas.mpl_connect('axes_leave_event', leave_axes) - - plt.show() - - - -.. _object-picking: - -Object picking -============== - -You can enable picking by setting the ``picker`` property of an -:class:`~matplotlib.artist.Artist` (eg a matplotlib -:class:`~matplotlib.lines.Line2D`, :class:`~matplotlib.text.Text`, -:class:`~matplotlib.patches.Patch`, :class:`~matplotlib.patches.Polygon`, -:class:`~matplotlib.patches.AxesImage`, etc...) - -There are a variety of meanings of the ``picker`` property: - - ``None`` - picking is disabled for this artist (default) - - ``boolean`` - if True then picking will be enabled and the artist will fire a - pick event if the mouse event is over the artist - - ``float`` - if picker is a number it is interpreted as an epsilon tolerance in - points and the the artist will fire off an event if its data is - within epsilon of the mouse event. For some artists like lines - and patch collections, the artist may provide additional data to - the pick event that is generated, eg the indices of the data - within epsilon of the pick event. - - ``function`` - if picker is callable, it is a user supplied function which - determines whether the artist is hit by the mouse event. The - signature is ``hit, props = picker(artist, mouseevent)`` to - determine the hit test. If the mouse event is over the artist, - return ``hit=True`` and props is a dictionary of properties you - want added to the :class:`~matplotlib.backend_bases.PickEvent` - attributes - - -After you have enabled an artist for picking by setting the ``picker`` -property, you need to connect to the figure canvas pick_event to get -pick callbacks on mouse press events. Eg:: - - def pick_handler(event): - mouseevent = event.mouseevent - artist = event.artist - # now do something with this... - - -The :class:`~matplotlib.backend_bases.PickEvent` which is passed to -your callback is always fired with two attributes: - - ``mouseevent`` the mouse event that generate the pick event. The - mouse event in turn has attributes like ``x`` and ``y`` (the - coords in display space, eg pixels from left, bottom) and xdata, - ydata (the coords in data space). Additionally, you can get - information about which buttons were pressed, which keys were - pressed, which :class:`~matplotlib.axes.Axes` the mouse is over, - etc. See :class:`matplotlib.backend_bases.MouseEvent` for - details. - - ``artist`` - the :class:`~matplotlib.artist.Artist` that generated the pick - event. - -Additionally, certain artists like :class:`~matplotlib.lines.Line2D` -and :class:`~matplotlib.collections.PatchCollection` may attach -additional meta data like the indices into the data that meet the -picker criteria (eg all the points in the line that are within the -specified epsilon tolerance) - -Simple picking example ----------------------- - -In the example below, we set the line picker property to a scalar, so -it represents a tolerance in points (72 points per inch). The onpick -callback function will be called when the pick event it within the -tolerance distance from the line, and has the indices of the data -vertices that are within the pick distance tolerance. Our onpick -callback function simply prints the data that are under the pick -location. Different matplotlib Artists can attach different data to -the PickEvent. For example, ``Line2D`` attaches the ind property, -which are the indices into the line data under the pick point. See -:meth:`~matplotlib.lines.Line2D.pick` for details on the ``PickEvent`` -properties of the line. Here is the code:: - - import numpy as np - import matplotlib.pyplot as plt - - fig = plt.figure() - ax = fig.add_subplot(111) - ax.set_title('click on points') - - line, = ax.plot(np.random.rand(100), 'o', picker=5) # 5 points tolerance - - def onpick(event): - thisline = event.artist - xdata = thisline.get_xdata() - ydata = thisline.get_ydata() - ind = event.ind - print 'onpick points:', zip(xdata[ind], ydata[ind]) - - fig.canvas.mpl_connect('pick_event', onpick) - - plt.show() - - -Picking exercise ----------------- - -Create a data set of 100 arrays of 1000 Gaussian random numbers and -compute the sample mean and standard deviation of each of them (hint: -numpy arrays have a mean and std method) and make a xy marker plot of -the 100 means vs the 100 standard deviations. Connect the line -created by the plot command to the pick event, and plot the original -time series of the data that generated the clicked on points. If more -than one point is within the tolerance of the clicked on point, you -can use multiple subplots to plot the multiple time series. - -Exercise solution:: - - """ - compute the mean and stddev of 100 data sets and plot mean vs stddev. - When you click on one of the mu, sigma points, plot the raw data from - the dataset that generated the mean and stddev - """ - import numpy as np - import matplotlib.pyplot as plt - - X = np.random.rand(100, 1000) - xs = np.mean(X, axis=1) - ys = np.std(X, axis=1) - - fig = plt.figure() - ax = fig.add_subplot(111) - ax.set_title('click on point to plot time series') - line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance - - - def onpick(event): - - if event.artist!=line: return True - - N = len(event.ind) - if not N: return True - - - figi = plt.figure() - for subplotnum, dataind in enumerate(event.ind): - ax = figi.add_subplot(N,1,subplotnum+1) - ax.plot(X[dataind]) - ax.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f'%(xs[dataind], ys[dataind]), - transform=ax.transAxes, va='top') - ax.set_ylim(-0.5, 1.5) - figi.show() - return True - - fig.canvas.mpl_connect('pick_event', onpick) - +.. _event-handling-tutorial: + +************************** +Event handling and picking +************************** + +matplotlib works with 6 user interface toolkits (wxpython, tkinter, +qt, gtk, fltk abd macosx) and in order to support features like interactive +panning and zooming of figures, it is helpful to the developers to +have an API for interacting with the figure via key presses and mouse +movements that is "GUI neutral" so we don't have to repeat a lot of +code across the different user interfaces. Although the event +handling API is GUI neutral, it is based on the GTK model, which was +the first user interface matplotlib supported. The events that are +triggered are also a bit richer vis-a-vis matplotlib than standard GUI +events, including information like which :class:`matplotlib.axes.Axes` +the event occurred in. The events also understand the matplotlib +coordinate system, and report event locations in both pixel and data +coordinates. + +.. _event-connections: + +Event connections +================= + +To receive events, you need to write a callback function and then +connect your function to the event manager, which is part of the +:class:`~matplotlib.backend_bases.FigureCanvasBase`. Here is a simple +example that prints the location of the mouse click and which button +was pressed:: + + fig = plt.figure() + ax = fig.add_subplot(111) + ax.plot(np.random.rand(10)) + + def onclick(event): + print 'button=%d, x=%d, y=%d, xdata=%f, ydata=%f'%( + event.button, event.x, event.y, event.xdata, event.ydata) + + cid = fig.canvas.mpl_connect('button_press_event', onclick) + +The ``FigureCanvas`` method +:meth:`~matplotlib.backend_bases.FigureCanvasBase.mpl_connect` returns +a connection id which is simply an integer. When you want to +disconnect the callback, just call:: + + fig.canvas.mpl_disconnect(cid) + +Here are the events that you can connect to, the class instances that +are sent back to you when the event occurs, and the event descriptions + + +======================= ====================================================================================== +Event name Class and description +======================= ====================================================================================== +'button_press_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse button is pressed +'button_release_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse button is released +'draw_event' :class:`~matplotlib.backend_bases.DrawEvent` - canvas draw +'key_press_event' :class:`~matplotlib.backend_bases.KeyEvent` - key is pressed +'key_release_event' :class:`~matplotlib.backend_bases.KeyEvent` - key is released +'motion_notify_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse motion +'pick_event' :class:`~matplotlib.backend_bases.PickEvent` - an object in the canvas is selected +'resize_event' :class:`~matplotlib.backend_bases.ResizeEvent` - figure canvas is resized +'scroll_event' :class:`~matplotlib.backend_bases.MouseEvent` - mouse scroll wheel is rolled +'figure_enter_event' :class:`~matplotlib.backend_bases.LocationEvent` - mouse enters a new figure +'figure_leave_event' :class:`~matplotlib.backend_bases.LocationEvent` - mouse leaves a figure +'axes_enter_event' :class:`~matplotlib.backend_bases.LocationEvent` - mouse enters a new axes +'axes_leave_event' :class:`~matplotlib.backend_bases.LocationEvent` - mouse leaves an axes +======================= ====================================================================================== + +.. _event-attributes: + +Event attributes +================ + +All matplotlib events inherit from the base class +:class:`matplotlib.backend_bases.Event`, which store the attributes: + + ``name`` + the event name + + ``canvas`` + the FigureCanvas instance generating the event + + ``guiEvent`` + the GUI event that triggered the matplotlib event + + +The most common events that are the bread and butter of event handling +are key press/release events and mouse press/release and movement +events. The :class:`~matplotlib.backend_bases.KeyEvent` and +:class:`~matplotlib.backend_bases.MouseEvent` classes that handle +these events are both derived from the LocationEvent, which has the +following attributes + + ``x`` + x position - pixels from left of canvas + + ``y`` + y position - pixels from bottom of canvas + + ``inaxes`` + the :class:`~matplotlib.axes.Axes` instance if mouse is over axes + + ``xdata`` + x coord of mouse in data coords + + ``ydata`` + y coord of mouse in data coords + +Let's look a simple example of a canvas, where a simple line segment +is created every time a mouse is pressed:: + + class LineBuilder: + def __init__(self, line): + self.line = line + self.xs = list(line.get_xdata()) + self.ys = list(line.get_ydata()) + self.cid = line.figure.canvas.mpl_connect('button_press_event', self) + + def __call__(self, event): + print 'click', event + if event.inaxes!=self.line.axes: return + self.xs.append(event.xdata) + self.ys.append(event.ydata) + self.line.set_data(self.xs, self.ys) + self.line.figure.canvas.draw() + + fig = plt.figure() + ax = fig.add_subplot(111) + ax.set_title('click to build line segments') + line, = ax.plot([0], [0]) # empty line + linebuilder = LineBuilder(line) + + + +The :class:`~matplotlib.backend_bases.MouseEvent` that we just used is a +:class:`~matplotlib.backend_bases.LocationEvent`, so we have access to +the data and pixel coordinates in event.x and event.xdata. In +addition to the ``LocationEvent`` attributes, it has + + ``button`` + button pressed None, 1, 2, 3, 'up', 'down' (up and down are used for scroll events) + + ``key`` + the key pressed: None, any character, 'shift', 'win', or 'control' + +Draggable rectangle exercise +---------------------------- + +Write draggable rectangle class that is initialized with a +:class:`~matplotlib.patches.Rectangle` instance but will move its x,y +location when dragged. Hint: you will need to store the orginal +``xy`` location of the rectangle which is stored as rect.xy and +connect to the press, motion and release mouse events. When the mouse +is pressed, check to see if the click occurs over your rectangle (see +:meth:`matplotlib.patches.Rectangle.contains`) and if it does, store +the rectangle xy and the location of the mouse click in data coords. +In the motion event callback, compute the deltax and deltay of the +mouse movement, and add those deltas to the origin of the rectangle +you stored. The redraw the figure. On the button release event, just +reset all the button press data you stored as None. + +Here is the solution:: + + import numpy as np + import matplotlib.pyplot as plt + + class DraggableRectangle: + def __init__(self, rect): + self.rect = rect + self.press = None + + def connect(self): + 'connect to all the events we need' + self.cidpress = self.rect.figure.canvas.mpl_connect( + 'button_press_event', self.on_press) + self.cidrelease = self.rect.figure.canvas.mpl_connect( + 'button_release_event', self.on_release) + self.cidmotion = self.rect.figure.canvas.mpl_connect( + 'motion_notify_event', self.on_motion) + + def on_press(self, event): + 'on button press we will see if the mouse is over us and store some data' + if event.inaxes != self.rect.axes: return + + contains, attrd = self.rect.contains(event) + if not contains: return + print 'event contains', self.rect.xy + x0, y0 = self.rect.xy + self.press = x0, y0, event.xdata, event.ydata + + def on_motion(self, event): + 'on motion we will move the rect if the mouse is over us' + if self.press is None: return + if event.inaxes != self.rect.axes: return + x0, y0, xpress, ypress = self.press + dx = event.xdata - xpress + dy = event.ydata - ypress + #print 'x0=%f, xpress=%f, event.xdata=%f, dx=%f, x0+dx=%f'%(x0, xpress, event.xdata, dx, x0+dx) + self.rect.set_x(x0+dx) + self.rect.set_y(y0+dy) + + self.rect.figure.canvas.draw() + + + def on_release(self, event): + 'on release we reset the press data' + self.press = None + self.rect.figure.canvas.draw() + + def disconnect(self): + 'disconnect all the stored connection ids' + self.rect.figure.canvas.mpl_disconnect(self.cidpress) + self.rect.figure.canvas.mpl_disconnect(self.cidrelease) + self.rect.figure.canvas.mpl_disconnect(self.cidmotion) + + fig = plt.figure() + ax = fig.add_subplot(111) + rects = ax.bar(range(10), 20*np.random.rand(10)) + drs = [] + for rect in rects: + dr = DraggableRectangle(rect) + dr.connect() + drs.append(dr) + plt.show() + + +**Extra credit**: use the animation blit techniques discussed in the +`animations recipe +<http://www.scipy.org/Cookbook/Matplotlib/Animations>`_ to make the +animated drawing faster and smoother. + +Extra credit solution:: + + # draggable rectangle with the animation blit techniques; see + # http://www.scipy.org/Cookbook/Matplotlib/Animations + import numpy as np + import matplotlib.pyplot as plt + + class DraggableRectangle: + lock = None # only one can be animated at a time + def __init__(self, rect): + self.rect = rect + self.press = None + self.background = None + + def connect(self): + 'connect to all the events we need' + self.cidpress = self.rect.figure.canvas.mpl_connect( + 'button_press_event', self.on_press) + self.cidrelease = self.rect.figure.canvas.mpl_connect( + 'button_release_event', self.on_release) + self.cidmotion = self.rect.figure.canvas.mpl_connect( + 'motion_notify_event', self.on_motion) + + def on_press(self, event): + 'on button press we will see if the mouse is over us and store some data' + if event.inaxes != self.rect.axes: return + if DraggableRectangle.lock is not None: return + contains, attrd = self.rect.contains(event) + if not contains: return + print 'event contains', self.rect.xy + x0, y0 = self.rect.xy + self.press = x0, y0, event.xdata, event.ydata + DraggableRectangle.lock = self + + # draw everything but the selected rectangle and store the pixel buffer + canvas = self.rect.figure.canvas + axes = self.rect.axes + self.rect.set_animated(True) + canvas.draw() + self.background = canvas.copy_from_bbox(self.rect.axes.bbox) + + # now redraw just the rectangle + axes.draw_artist(self.rect) + + # and blit just the redrawn area + canvas.blit(axes.bbox) + + def on_motion(self, event): + 'on motion we will move the rect if the mouse is over us' + if DraggableRectangle.lock is not self: + return + if event.inaxes != self.rect.axes: return + x0, y0, xpress, ypress = self.press + dx = event.xdata - xpress + dy = event.ydata - ypress + self.rect.set_x(x0+dx) + self.rect.set_y(y0+dy) + + canvas = self.rect.figure.canvas + axes = self.rect.axes + # restore the background region + canvas.restore_region(self.background) + + # redraw just the current rectangle + axes.draw_artist(self.rect) + + # blit just the redrawn area + canvas.blit(axes.bbox) + + def on_release(self, event): + 'on release we reset the press data' + if DraggableRectangle.lock is not self: + return + + self.press = None + DraggableRectangle.lock = None + + # turn off the rect animation property and reset the background + self.rect.set_animated(False) + self.background = None + + # redraw the full figure + self.rect.figure.canvas.draw() + + def disconnect(self): + 'disconnect all the stored connection ids' + self.rect.figure.canvas.mpl_disconnect(self.cidpress) + self.rect.figure.canvas.mpl_disconnect(self.cidrelease) + self.rect.figure.canvas.mpl_disconnect(self.cidmotion) + + fig = plt.figure() + ax = fig.add_subplot(111) + rects = ax.bar(range(10), 20*np.random.rand(10)) + drs = [] + for rect in rects: + dr = DraggableRectangle(rect) + dr.connect() + drs.append(dr) + + plt.show() + + +.. _enter-leave-events: + +Mouse enter and leave +====================== + +If you want to be notified when the mouse enters or leaves a figure or +axes, you can connect to the figure/axes enter/leave events. Here is +a simple example that changes the colors of the axes and figure +background that the mouse is over:: + + """ + Illustrate the figure and axes enter and leave events by changing the + frame colors on enter and leave + """ + import matplotlib.pyplot as plt + + def enter_axes(event): + print 'enter_axes', event.inaxes + event.inaxes.patch.set_facecolor('yellow') + event.canvas.draw() + + def leave_axes(event): + print 'leave_axes', event.inaxes + event.inaxes.patch.set_facecolor('white') + event.canvas.draw() + + def enter_figure(event): + print 'enter_figure', event.canvas.figure + event.canvas.figure.patch.set_facecolor('red') + event.canvas.draw() + + def leave_figure(event): + print 'leave_figure', event.canvas.figure + event.canvas.figure.patch.set_facecolor('grey') + event.canvas.draw() + + fig1 = plt.figure() + fig1.suptitle('mouse hover over figure or axes to trigger events') + ax1 = fig1.add_subplot(211) + ax2 = fig1.add_subplot(212) + + fig1.canvas.mpl_connect('figure_enter_event', enter_figure) + fig1.canvas.mpl_connect('figure_leave_event', leave_figure) + fig1.canvas.mpl_connect('axes_enter_event', enter_axes) + fig1.canvas.mpl_connect('axes_leave_event', leave_axes) + + fig2 = plt.figure() + fig2.suptitle('mouse hover over figure or axes to trigger events') + ax1 = fig2.add_subplot(211) + ax2 = fig2.add_subplot(212) + + fig2.canvas.mpl_connect('figure_enter_event', enter_figure) + fig2.canvas.mpl_connect('figure_leave_event', leave_figure) + fig2.canvas.mpl_connect('axes_enter_event', enter_axes) + fig2.canvas.mpl_connect('axes_leave_event', leave_axes) + + plt.show() + + + +.. _object-picking: + +Object picking +============== + +You can enable picking by setting the ``picker`` property of an +:class:`~matplotlib.artist.Artist` (eg a matplotlib +:class:`~matplotlib.lines.Line2D`, :class:`~matplotlib.text.Text`, +:class:`~matplotlib.patches.Patch`, :class:`~matplotlib.patches.Polygon`, +:class:`~matplotlib.patches.AxesImage`, etc...) + +There are a variety of meanings of the ``picker`` property: + + ``None`` + picking is disabled for this artist (default) + + ``boolean`` + if True then picking will be enabled and the artist will fire a + pick event if the mouse event is over the artist + + ``float`` + if picker is a number it is interpreted as an epsilon tolerance in + points and the the artist will fire off an event if its data is + within epsilon of the mouse event. For some artists like lines + and patch collections, the artist may provide additional data to + the pick event that is generated, eg the indices of the data + within epsilon of the pick event. + + ``function`` + if picker is callable, it is a user supplied function which + determines whether the artist is hit by the mouse event. The + signature is ``hit, props = picker(artist, mouseevent)`` to + determine the hit test. If the mouse event is over the artist, + return ``hit=True`` and props is a dictionary of properties you + want added to the :class:`~matplotlib.backend_bases.PickEvent` + attributes + + +After you have enabled an artist for picking by setting the ``picker`` +property, you need to connect to the figure canvas pick_event to get +pick callbacks on mouse press events. Eg:: + + def pick_handler(event): + mouseevent = event.mouseevent + artist = event.artist + # now do something with this... + + +The :class:`~matplotlib.backend_bases.PickEvent` which is passed to +your callback is always fired with two attributes: + + ``mouseevent`` the mouse event that generate the pick event. The + mouse event in turn has attributes like ``x`` and ``y`` (the + coords in display space, eg pixels from left, bottom) and xdata, + ydata (the coords in data space). Additionally, you can get + information about which buttons were pressed, which keys were + pressed, which :class:`~matplotlib.axes.Axes` the mouse is over, + etc. See :class:`matplotlib.backend_bases.MouseEvent` for + details. + + ``artist`` + the :class:`~matplotlib.artist.Artist` that generated the pick + event. + +Additionally, certain artists like :class:`~matplotlib.lines.Line2D` +and :class:`~matplotlib.collections.PatchCollection` may attach +additional meta data like the indices into the data that meet the +picker criteria (eg all the points in the line that are within the +specified epsilon tolerance) + +Simple picking example +---------------------- + +In the example below, we set the line picker property to a scalar, so +it represents a tolerance in points (72 points per inch). The onpick +callback function will be called when the pick event it within the +tolerance distance from the line, and has the indices of the data +vertices that are within the pick distance tolerance. Our onpick +callback function simply prints the data that are under the pick +location. Different matplotlib Artists can attach different data to +the PickEvent. For example, ``Line2D`` attaches the ind property, +which are the indices into the line data under the pick point. See +:meth:`~matplotlib.lines.Line2D.pick` for details on the ``PickEvent`` +properties of the line. Here is the code:: + + import numpy as np + import matplotlib.pyplot as plt + + fig = plt.figure() + ax = fig.add_subplot(111) + ax.set_title('click on points') + + line, = ax.plot(np.random.rand(100), 'o', picker=5) # 5 points tolerance + + def onpick(event): + thisline = event.artist + xdata = thisline.get_xdata() + ydata = thisline.get_ydata() + ind = event.ind + print 'onpick points:', zip(xdata[ind], ydata[ind]) + + fig.canvas.mpl_connect('pick_event', onpick) + + plt.show() + + +Picking exercise +---------------- + +Create a data set of 100 arrays of 1000 Gaussian random numbers and +compute the sample mean and standard deviation of each of them (hint: +numpy arrays have a mean and std method) and make a xy marker plot of +the 100 means vs the 100 standard deviations. Connect the line +created by the plot command to the pick event, and plot the original +time series of the data that generated the clicked on points. If more +than one point is within the tolerance of the clicked on point, you +can use multiple subplots to plot the multiple time series. + +Exercise solution:: + + """ + compute the mean and stddev of 100 data sets and plot mean vs stddev. + When you click on one of the mu, sigma points, plot the raw data from + the dataset that generated the mean and stddev + """ + import numpy as np + import matplotlib.pyplot as plt + + X = np.random.rand(100, 1000) + xs = np.mean(X, axis=1) + ys = np.std(X, axis=1) + + fig = plt.figure() + ax = fig.add_subplot(111) + ax.set_title('click on point to plot time series') + line, = ax.plot(xs, ys, 'o', picker=5) # 5 points tolerance + + + def onpick(event): + + if event.artist!=line: return True + + N = len(event.ind) + if not N: return True + + + figi = plt.figure() + for subplotnum, dataind in enumerate(event.ind): + ax = figi.add_subplot(N,1,subplotnum+1) + ax.plot(X[dataind]) + ax.text(0.05, 0.9, 'mu=%1.3f\nsigma=%1.3f'%(xs[dataind], ys[dataind]), + transform=ax.transAxes, va='top') + ax.set_ylim(-0.5, 1.5) + figi.show() + return True + + fig.canvas.mpl_connect('pick_event', onpick) + + plt.show() Modified: trunk/matplotlib/doc/users/pyplot_tutorial.rst =================================================================== --- trunk/matplotlib/doc/users/pyplot_tutorial.rst 2009-08-08 06:07:06 UTC (rev 7424) +++ trunk/matplotlib/doc/users/pyplot_tutorial.rst 2009-08-08 06:24:00 UTC (rev 7425) @@ -74,7 +74,7 @@ one line so it is a list of length 1. I use tuple unpacking in the ``line, = plot(x, y, 'o')`` to get the first element of the list:: - line, = plt.plot(x, y, 'o') + line, = plt.plot(x, y, '-') line.set_antialiased(False) # turn off antialising * Use the :func:`~matplotlib.pyplot.setp` command. The example below @@ -156,7 +156,7 @@ :func:`~matplotlib.pyplot.gcf` returns the current figure (:class:`matplotlib.figure.Figure` instance). Normally, you don't have to worry about this, because it is all taken care of behind the -scenes. Below is an script to create two subplots. +scenes. Below is a script to create two subplots. .. plot:: pyplots/pyplot_two_subplots.py :include-source: @@ -165,18 +165,16 @@ ``figure(1)`` will be created by default, just as a ``subplot(111)`` will be created by default if you don't manually specify an axes. The :func:`~matplotlib.pyplot.subplot` command specifies ``numrows, -numcols, fignum`` where ``fignum`` ranges from 1 to -``numrows*numcols``. The commas in the ``subplot command are optional + numcols, fignum`` where ``fignum`` ranges from 1 to +``numrows*numcols``. The commas in the ``subplot`` command are optional if ``numr... [truncated message content] |
From: <jd...@us...> - 2009-08-08 11:25:40
|
Revision: 7427 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7427&view=rev Author: jdh2358 Date: 2009-08-08 11:25:32 +0000 (Sat, 08 Aug 2009) Log Message: ----------- Merged revisions 7426 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint ........ r7426 | jdh2358 | 2009-08-08 06:00:41 -0500 (Sat, 08 Aug 2009) | 1 line replace list comps w/ numpy in mplot3d ........ Modified Paths: -------------- trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py trunk/matplotlib/lib/mpl_toolkits/mplot3d/proj3d.py Property Changed: ---------------- trunk/matplotlib/ Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7424 + /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7426 Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py =================================================================== --- trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py 2009-08-08 11:00:41 UTC (rev 7426) +++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/art3d.py 2009-08-08 11:25:32 UTC (rev 7427) @@ -92,6 +92,7 @@ def set_3d_properties(self, zs=0, zdir='z'): xs = self.get_xdata() ys = self.get_ydata() + try: zs = float(zs) zs = [zs for x in xs] @@ -116,7 +117,7 @@ '''Convert a path to a 3D segment.''' if not iterable(zs): - zs = [zs] * len(path) + zs = np.ones(len(path)) * zs seg = [] pathsegs = path.iter_segments(simplify=False, curves=False) @@ -131,7 +132,7 @@ ''' if not iterable(zs): - zs = [zs] * len(paths) + zs = np.ones(len(paths)) * zs segments = [] for path, pathz in zip(paths, zs): @@ -192,7 +193,8 @@ def set_3d_properties(self, verts, zs=0, zdir='z'): if not iterable(zs): - zs = [zs] * len(verts) + zs = np.ones(len(verts)) * zs + self._segment3d = [juggle_axes(x, y, z, zdir) \ for ((x, y), z) in zip(verts, zs)] self._facecolor3d = Patch.get_facecolor(self) Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py =================================================================== --- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2009-08-08 11:00:41 UTC (rev 7426) +++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/axes3d.py 2009-08-08 11:25:32 UTC (rev 7427) @@ -58,7 +58,7 @@ xticks=[], yticks=[], *args, **kwargs) self.M = None - + self._ready = 1 self.mouse_init() self.create_axes() @@ -184,7 +184,7 @@ def autoscale_view(self, scalex=True, scaley=True, scalez=True): # This method looks at the rectanglular volume (see above) # of data and decides how to scale the view portal to fit it. - + self.set_top_view() if not self._ready: return @@ -534,7 +534,7 @@ # Match length if not cbook.iterable(zs): - zs = [zs] * len(xs) + zs = np.ones(len(xs)) * zs lines = Axes.plot(self, xs, ys, *args[argsi:], **kwargs) for line in lines: @@ -552,7 +552,7 @@ By default it will be colored in shades of a solid color, but it also supports color mapping by supplying the *cmap* argument. - + ========== ================================================ Argument Description ========== ================================================ @@ -648,7 +648,7 @@ shade = np.array(shade) mask = ~np.isnan(shade) - if len(shade[mask]) > 0: + if len(shade[mask]) > 0: norm = Normalize(min(shade[mask]), max(shade[mask])) color = color.copy() color[3] = 1 @@ -679,7 +679,7 @@ rstride = kwargs.pop("rstride", 1) cstride = kwargs.pop("cstride", 1) - + had_data = self.has_data() rows, cols = Z.shape @@ -708,7 +708,7 @@ def _3d_extend_contour(self, cset, stride=5): ''' - Extend a contour in 3D by creating + Extend a contour in 3D by creating ''' levels = cset.levels @@ -742,7 +742,7 @@ v1 = np.array(topverts[0][i1]) - np.array(topverts[0][i2]) v2 = np.array(topverts[0][i1]) - np.array(botverts[0][i1]) normals.append(np.cross(v1, v2)) - + colors = self._shade_colors(color, normals) colors2 = self._shade_colors(color, normals) polycol = art3d.Poly3DCollection(polyverts, facecolors=colors, @@ -811,13 +811,13 @@ self.auto_scale_xyz(X, Y, Z, had_data) return cset - + contourf3D = contourf def add_collection3d(self, col, zs=0, zdir='z'): ''' Add a 3d collection object to the plot. - + 2D collection types are converted to a 3D version by modifying the object and adding z coordinate information. @@ -865,7 +865,7 @@ patches = Axes.scatter(self, xs, ys, *args, **kwargs) if not cbook.iterable(zs): is_2d = True - zs = [zs] * len(xs) + zs = np.ones(len(xs)) * zs else: is_2d = False art3d.patch_collection_2d_to_3d(patches, zs=zs, zdir=zdir) @@ -903,8 +903,9 @@ patches = Axes.bar(self, left, height, *args, **kwargs) if not cbook.iterable(zs): - zs = [zs] * len(left) + zs = np.ones(len(left))*zs + verts = [] verts_zs = [] for p, z in zip(patches, zs): Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py =================================================================== --- trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py 2009-08-08 11:00:41 UTC (rev 7426) +++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/axis3d.py 2009-08-08 11:25:32 UTC (rev 7427) @@ -22,6 +22,7 @@ def move_from_center(coord, centers, deltas, axmask=(True, True, True)): '''Return a coordinate that is moved by "deltas" away from the center.''' coord = copy.copy(coord) + #print coord, centers, deltas, axmask for i in range(3): if not axmask[i]: continue @@ -84,7 +85,7 @@ alpha=0.8, facecolor=(1,1,1,0), edgecolor=(1,1,1,0)) - + self.axes._set_artist_props(self.line) self.axes._set_artist_props(self.pane) self.gridlines = art3d.Line3DCollection([], ) @@ -141,7 +142,7 @@ # code from XAxis majorTicks = self.get_major_ticks() majorLocs = self.major.locator() - + # filter locations here so that no extra grid lines are drawn interval = self.get_view_interval() majorLocs = [loc for loc in majorLocs if \ @@ -152,19 +153,20 @@ # Determine bounds minx, maxx, miny, maxy, minz, maxz = self.axes.get_w_lims() - mins = (minx, miny, minz) - maxs = (maxx, maxy, maxz) - centers = [(maxv + minv) / 2 for minv, maxv in zip(mins, maxs)] - deltas = [(maxv - minv) / 12 for minv, maxv in zip(mins, maxs)] - mins = [minv - delta / 4 for minv, delta in zip(mins, deltas)] - maxs = [maxv + delta / 4 for maxv, delta in zip(maxs, deltas)] + mins = np.array((minx, miny, minz)) + maxs = np.array((maxx, maxy, maxz)) + centers = (maxs + mins) / 2. + deltas = (maxs - mins) / 12. + mins = mins - deltas / 4. + maxs = maxs + deltas / 4. # Determine which planes should be visible by the avg z value vals = mins[0], maxs[0], mins[1], maxs[1], mins[2], maxs[2] tc = self.axes.tunit_cube(vals, renderer.M) + #raise RuntimeError('WTF: p1=%s'%p1) avgz = [tc[p1][2] + tc[p2][2] + tc[p3][2] + tc[p4][2] for \ p1, p2, p3, p4 in self._PLANES] - highs = [avgz[2*i] < avgz[2*i+1] for i in range(3)] + highs = np.array([avgz[2*i] < avgz[2*i+1] for i in range(3)]) # Draw plane info = self._AXINFO[self.adir] @@ -178,18 +180,14 @@ self.pane.draw(renderer) # Determine grid lines - minmax = [] - for i, val in enumerate(highs): - if val: - minmax.append(maxs[i]) - else: - minmax.append(mins[i]) + minmax = np.where(highs, maxs, mins) # Draw main axis line juggled = art3d.juggle_axes(0, 2, 1, self.adir) - edgep1 = copy.copy(minmax) + edgep1 = minmax.copy() edgep1[juggled[0]] = get_flip_min_max(edgep1, juggled[0], mins, maxs) - edgep2 = copy.copy(edgep1) + + edgep2 = edgep1.copy() edgep2[juggled[1]] = get_flip_min_max(edgep2, juggled[1], mins, maxs) pep = proj3d.proj_trans_points([edgep1, edgep2], renderer.M) self.line.set_data((pep[0][0], pep[0][1]), (pep[1][0], pep[1][1])) @@ -198,15 +196,17 @@ # Grid points where the planes meet xyz0 = [] for val in majorLocs: - coord = copy.copy(minmax) + coord = minmax.copy() coord[index] = val xyz0.append(coord) # Draw labels dy = pep[1][1] - pep[1][0] dx = pep[0][1] - pep[0][0] - lxyz = [(v1 + v2) / 2 for v1, v2 in zip(edgep1, edgep2)] - labeldeltas = [1.3 * x for x in deltas] + + lxyz = 0.5*(edgep1 + edgep2) + + labeldeltas = 1.3 * deltas lxyz = move_from_center(lxyz, centers, labeldeltas) tlx, tly, tlz = proj3d.proj_transform(lxyz[0], lxyz[1], lxyz[2], \ renderer.M) @@ -293,7 +293,7 @@ def get_data_interval(self): 'return the Interval instance for this axis data limits' return self.axes.xy_dataLim.intervaly - + class ZAxis(Axis): def get_data_interval(self): 'return the Interval instance for this axis data limits' Modified: trunk/matplotlib/lib/mpl_toolkits/mplot3d/proj3d.py =================================================================== --- trunk/matplotlib/lib/mpl_toolkits/mplot3d/proj3d.py 2009-08-08 11:00:41 UTC (rev 7426) +++ trunk/matplotlib/lib/mpl_toolkits/mplot3d/proj3d.py 2009-08-08 11:25:32 UTC (rev 7427) @@ -10,15 +10,8 @@ import numpy as np import numpy.linalg as linalg -def cross(a, b): - """ - Cross product of two vectors - A x B = <Ay*Bz - Az*By, Az*Bx - Ax*Bz, Ax*By - Ay*Bx> - a x b = [a2b3 - a3b2, a3b1 - a1b3, a1b2 - a2b1] - """ - return np.array([a[1]*b[2] - a[2]*b[1], a[2]*b[0] - a[0]*b[2], \ - a[0]*b[1] - a[1]*b[0]]) + def line2d(p0, p1): """ Return 2D equation of line in the form ax+by+c = 0 @@ -130,9 +123,9 @@ ## old n = n / mod(n) - u = cross(V, n) + u = np.cross(V, n) u = u / mod(u) - v = cross(n, u) + v = np.cross(n, u) Mr = [[u[0],u[1],u[2],0], [v[0],v[1],v[2],0], [n[0],n[1],n[2],0], This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-08-08 18:25:00
|
Revision: 7434 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7434&view=rev Author: efiring Date: 2009-08-08 18:24:52 +0000 (Sat, 08 Aug 2009) Log Message: ----------- Merged revisions 7428-7433 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint ........ r7428 | jdh2358 | 2009-08-08 02:21:29 -1000 (Sat, 08 Aug 2009) | 1 line clean up mplot3d examples: use pyplot noy pylab and numpy rather than list comps and python random module ........ r7429 | jdh2358 | 2009-08-08 03:53:24 -1000 (Sat, 08 Aug 2009) | 1 line two new examples using a compund path for a histogram; one animated ........ r7430 | jdh2358 | 2009-08-08 03:58:52 -1000 (Sat, 08 Aug 2009) | 1 line two new examples using a compund path for a histogram; one animated ........ r7431 | jdh2358 | 2009-08-08 05:10:08 -1000 (Sat, 08 Aug 2009) | 1 line use a class helper method to make the compound path from polys ........ r7432 | jdh2358 | 2009-08-08 05:16:57 -1000 (Sat, 08 Aug 2009) | 1 line simplify poly array in example ........ r7433 | efiring | 2009-08-08 08:16:01 -1000 (Sat, 08 Aug 2009) | 2 lines Fix excessive line length in annotations.rst ........ Modified Paths: -------------- trunk/matplotlib/doc/users/annotations.rst trunk/matplotlib/examples/mplot3d/2dcollections3d_demo.py trunk/matplotlib/examples/mplot3d/bars3d_demo.py trunk/matplotlib/examples/mplot3d/contour3d_demo.py trunk/matplotlib/examples/mplot3d/contour3d_demo2.py trunk/matplotlib/examples/mplot3d/contourf3d_demo.py trunk/matplotlib/examples/mplot3d/hist3d_demo.py trunk/matplotlib/examples/mplot3d/lines3d_demo.py trunk/matplotlib/examples/mplot3d/polys3d_demo.py trunk/matplotlib/examples/mplot3d/scatter3d_demo.py trunk/matplotlib/examples/mplot3d/surface3d_demo.py trunk/matplotlib/examples/mplot3d/surface3d_demo2.py trunk/matplotlib/examples/mplot3d/text3d_demo.py trunk/matplotlib/examples/mplot3d/wire3d_demo.py trunk/matplotlib/lib/matplotlib/path.py Added Paths: ----------- trunk/matplotlib/examples/animation/histogram_tkagg.py trunk/matplotlib/examples/api/histogram_path_demo.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/examples/misc/multiprocess.py trunk/matplotlib/examples/mplot3d/contour3d_demo.py trunk/matplotlib/examples/mplot3d/contourf3d_demo.py trunk/matplotlib/examples/mplot3d/polys3d_demo.py trunk/matplotlib/examples/mplot3d/scatter3d_demo.py trunk/matplotlib/examples/mplot3d/surface3d_demo.py trunk/matplotlib/examples/mplot3d/wire3d_demo.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7426 + /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7433 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393,7395-7404,7407-7424 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433 Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433 Modified: trunk/matplotlib/doc/users/annotations.rst =================================================================== --- trunk/matplotlib/doc/users/annotations.rst 2009-08-08 18:16:01 UTC (rev 7433) +++ trunk/matplotlib/doc/users/annotations.rst 2009-08-08 18:24:52 UTC (rev 7434) @@ -56,17 +56,20 @@ properties in the optional keyword argument ``arrowprops``. -==================== =========================================================================== +==================== ===================================================== ``arrowprops`` key description -==================== =========================================================================== +==================== ===================================================== width the width of the arrow in points frac the fraction of the arrow length occupied by the head headwidth the width of the base of the arrow head in points -shrink move the tip and base some percent away from the annotated point and text -\*\*kwargs any key for :class:`matplotlib.patches.Polygon`, eg ``facecolor`` -==================== =========================================================================== +shrink move the tip and base some percent away from + the annotated point and text +\*\*kwargs any key for :class:`matplotlib.patches.Polygon`, + e.g. ``facecolor`` +==================== ===================================================== + In the example below, the ``xy`` point is in native coordinates (``xycoords`` defaults to 'data'). For a polar axes, this is in (theta, radius) space. The text in this example is placed in the @@ -78,4 +81,7 @@ .. plot:: pyplots/annotation_polar.py :include-source: -For more on all the wild and wonderful things you can do with annotations, including fancy arrows, see :ref:`plotting-guide-annotation` and :ref:`pylab_examples-annotation_demo`. +For more on all the wild and wonderful things you can do with +annotations, including fancy arrows, see :ref:`plotting-guide-annotation` +and :ref:`pylab_examples-annotation_demo`. + Copied: trunk/matplotlib/examples/animation/histogram_tkagg.py (from rev 7433, branches/v0_99_maint/examples/animation/histogram_tkagg.py) =================================================================== --- trunk/matplotlib/examples/animation/histogram_tkagg.py (rev 0) +++ trunk/matplotlib/examples/animation/histogram_tkagg.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -0,0 +1,70 @@ +""" +This example shows how to use a path patch to draw a bunch of +rectangles for an animated histogram +""" +import time +import numpy as np +import matplotlib +matplotlib.use('TkAgg') # do this before importing pylab + +import matplotlib.pyplot as plt +import matplotlib.patches as patches +import matplotlib.path as path + +fig = plt.figure() +ax = fig.add_subplot(111) + +# histogram our data with numpy +data = np.random.randn(1000) +n, bins = np.histogram(data, 100) + +# get the corners of the rectangles for the histogram +left = np.array(bins[:-1]) +right = np.array(bins[1:]) +bottom = np.zeros(len(left)) +top = bottom + n +nrects = len(left) + +# here comes the tricky part -- we have to set up the vertex and path +# codes arrays using moveto, lineto and closepoly + +# for each rect: 1 for the MOVETO, 3 for the LINETO, 1 for the +# CLOSEPOLY; the vert for the closepoly is ignored but we still need +# it to keep the codes aligned with the vertices +nverts = nrects*(1+3+1) +verts = np.zeros((nverts, 2)) +codes = np.ones(nverts, int) * path.Path.LINETO +codes[0::5] = path.Path.MOVETO +codes[4::5] = path.Path.CLOSEPOLY +verts[0::5,0] = left +verts[0::5,1] = bottom +verts[1::5,0] = left +verts[1::5,1] = top +verts[2::5,0] = right +verts[2::5,1] = top +verts[3::5,0] = right +verts[3::5,1] = bottom + +barpath = path.Path(verts, codes) +patch = patches.PathPatch(barpath, facecolor='green', edgecolor='yellow', alpha=0.5) +ax.add_patch(patch) + +ax.set_xlim(left[0], right[-1]) +ax.set_ylim(bottom.min(), top.max()) + +def animate(): + if animate.cnt>=100: + return + + animate.cnt += 1 + # simulate new data coming in + data = np.random.randn(1000) + n, bins = np.histogram(data, 100) + top = bottom + n + verts[1::5,1] = top + verts[2::5,1] = top + fig.canvas.draw() + fig.canvas.manager.window.after(100, animate) +animate.cnt = 0 +fig.canvas.manager.window.after(100, animate) +plt.show() Copied: trunk/matplotlib/examples/api/histogram_path_demo.py (from rev 7433, branches/v0_99_maint/examples/api/histogram_path_demo.py) =================================================================== --- trunk/matplotlib/examples/api/histogram_path_demo.py (rev 0) +++ trunk/matplotlib/examples/api/histogram_path_demo.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -0,0 +1,47 @@ +""" +This example shows how to use a path patch to draw a bunch of +rectangles. The technique of using lots of Rectangle instances, or +the faster method of using PolyCollections, were implemented before we +had proper paths with moveto/lineto, closepoly etc in mpl. Now that +we have them, we can draw collections of regularly shaped objects with +homogeous properties more efficiently with a PathCollection. This +example makes a histogram -- its more work to set up the vertex arrays +at the outset, but it should be much faster for large numbers of +objects +""" + +import numpy as np +import matplotlib.pyplot as plt +import matplotlib.patches as patches +import matplotlib.path as path + +fig = plt.figure() +ax = fig.add_subplot(111) + +# histogram our data with numpy +data = np.random.randn(1000) +n, bins = np.histogram(data, 50) + +# get the corners of the rectangles for the histogram +left = np.array(bins[:-1]) +right = np.array(bins[1:]) +bottom = np.zeros(len(left)) +top = bottom + n + + +# we need a (numrects x numsides x 2) numpy array for the path helper +# function to build a compound path +XY = np.array([[left,left,right,right], [bottom,top,top,bottom]]).T + +# get the Path object +barpath = path.Path.make_compound_path_from_polys(XY) + +# make a patch out of it +patch = patches.PathPatch(barpath, facecolor='blue', edgecolor='gray', alpha=0.8) +ax.add_patch(patch) + +# update the view limits +ax.set_xlim(left[0], right[-1]) +ax.set_ylim(bottom.min(), top.max()) + +plt.show() Property changes on: trunk/matplotlib/examples/misc/multiprocess.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424 + /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433 Modified: trunk/matplotlib/examples/mplot3d/2dcollections3d_demo.py =================================================================== --- trunk/matplotlib/examples/mplot3d/2dcollections3d_demo.py 2009-08-08 18:16:01 UTC (rev 7433) +++ trunk/matplotlib/examples/mplot3d/2dcollections3d_demo.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -1,8 +1,8 @@ from mpl_toolkits.mplot3d import Axes3D import numpy as np -import pylab +import matplotlib.pyplot as plt -fig = pylab.figure() +fig = plt.figure() ax = Axes3D(fig) x = np.linspace(0, 1, 100) @@ -20,5 +20,5 @@ ax.set_ylim3d(0, 1) ax.set_zlim3d(0, 1) -pylab.show() +plt.show() Modified: trunk/matplotlib/examples/mplot3d/bars3d_demo.py =================================================================== --- trunk/matplotlib/examples/mplot3d/bars3d_demo.py 2009-08-08 18:16:01 UTC (rev 7433) +++ trunk/matplotlib/examples/mplot3d/bars3d_demo.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -1,20 +1,17 @@ from mpl_toolkits.mplot3d import Axes3D -from matplotlib.collections import PolyCollection -from matplotlib.colors import colorConverter -import pylab -import random +import matplotlib.pyplot as plt import numpy as np -fig = pylab.figure() +fig = plt.figure() ax = Axes3D(fig) for c, z in zip(['r', 'g', 'b', 'y'], [30, 20, 10, 0]): xs = np.arange(20) - ys = [random.random() for x in xs] + ys = np.random.rand(20) ax.bar(xs, ys, zs=z, zdir='y', color=c, alpha=0.8) ax.set_xlabel('X') ax.set_ylabel('Y') ax.set_zlabel('Z') -pylab.show() +plt.show() Modified: trunk/matplotlib/examples/mplot3d/contour3d_demo.py =================================================================== --- trunk/matplotlib/examples/mplot3d/contour3d_demo.py 2009-08-08 18:16:01 UTC (rev 7433) +++ trunk/matplotlib/examples/mplot3d/contour3d_demo.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -1,12 +1,11 @@ from mpl_toolkits.mplot3d import axes3d -import pylab -import random +import matplotlib.pyplot as plt -fig = pylab.figure() +fig = plt.figure() ax = axes3d.Axes3D(fig) X, Y, Z = axes3d.get_test_data(0.05) cset = ax.contour(X, Y, Z) ax.clabel(cset, fontsize=9, inline=1) -pylab.show() +plt.show() Property changes on: trunk/matplotlib/examples/mplot3d/contour3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424 + /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433 Modified: trunk/matplotlib/examples/mplot3d/contour3d_demo2.py =================================================================== --- trunk/matplotlib/examples/mplot3d/contour3d_demo2.py 2009-08-08 18:16:01 UTC (rev 7433) +++ trunk/matplotlib/examples/mplot3d/contour3d_demo2.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -1,12 +1,11 @@ from mpl_toolkits.mplot3d import axes3d -import pylab -import random +import matplotlib.pyplot as plt -fig = pylab.figure() +fig = plt.figure() ax = axes3d.Axes3D(fig) X, Y, Z = axes3d.get_test_data(0.05) cset = ax.contour(X, Y, Z, 16, extend3d=True) ax.clabel(cset, fontsize=9, inline=1) -pylab.show() +plt.show() Modified: trunk/matplotlib/examples/mplot3d/contourf3d_demo.py =================================================================== --- trunk/matplotlib/examples/mplot3d/contourf3d_demo.py 2009-08-08 18:16:01 UTC (rev 7433) +++ trunk/matplotlib/examples/mplot3d/contourf3d_demo.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -1,12 +1,11 @@ from mpl_toolkits.mplot3d import axes3d -import pylab -import random +import matplotlib.pyplot as plt -fig = pylab.figure() +fig = plt.figure() ax = axes3d.Axes3D(fig) X, Y, Z = axes3d.get_test_data(0.05) cset = ax.contourf(X, Y, Z) ax.clabel(cset, fontsize=9, inline=1) -pylab.show() +plt.show() Property changes on: trunk/matplotlib/examples/mplot3d/contourf3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424 + /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433 Modified: trunk/matplotlib/examples/mplot3d/hist3d_demo.py =================================================================== --- trunk/matplotlib/examples/mplot3d/hist3d_demo.py 2009-08-08 18:16:01 UTC (rev 7433) +++ trunk/matplotlib/examples/mplot3d/hist3d_demo.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -1,27 +1,22 @@ from mpl_toolkits.mplot3d import Axes3D -from matplotlib.collections import PolyCollection -from matplotlib.colors import colorConverter -import pylab -import random +import matplotlib.pyplot as plt import numpy as np -fig = pylab.figure() +fig = plt.figure() ax = Axes3D(fig) -x = np.random.rand(100) * 4 -y = np.random.rand(100) * 4 +x, y = np.random.rand(2, 100) * 4 hist, xedges, yedges = np.histogram2d(x, y, bins=4) elements = (len(xedges) - 1) * (len(yedges) - 1) -xpos, ypos = np.meshgrid( - [xedges[i] + 0.25 for i in range(len(xedges) - 1)], - [yedges[i] + 0.25 for i in range(len(yedges) - 1)]) +xpos, ypos = np.meshgrid(xedges[:-1]+0.25, yedges[:-1]+0.25) + xpos = xpos.flatten() ypos = ypos.flatten() -zpos = [0] * elements -dx = [0.5] * elements -dy = [0.5] * elements +zpos = np.zeros(elements) +dx = 0.5 * np.ones_like(zpos) +dy = dx.copy() dz = hist.flatten() ax.bar3d(xpos, ypos, zpos, dx, dy, dz, color='b') -pylab.show() +plt.show() Modified: trunk/matplotlib/examples/mplot3d/lines3d_demo.py =================================================================== --- trunk/matplotlib/examples/mplot3d/lines3d_demo.py 2009-08-08 18:16:01 UTC (rev 7433) +++ trunk/matplotlib/examples/mplot3d/lines3d_demo.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -1,11 +1,11 @@ import matplotlib as mpl from mpl_toolkits.mplot3d import Axes3D import numpy as np -import pylab +import matplotlib.pyplot as plt mpl.rcParams['legend.fontsize'] = 10 -fig = pylab.figure() +fig = plt.figure() ax = Axes3D(fig) theta = np.linspace(-4 * np.pi, 4 * np.pi, 100) z = np.linspace(-2, 2, 100) @@ -15,5 +15,5 @@ ax.plot(x, y, z, label='parametric curve') ax.legend() -pylab.show() +plt.show() Modified: trunk/matplotlib/examples/mplot3d/polys3d_demo.py =================================================================== --- trunk/matplotlib/examples/mplot3d/polys3d_demo.py 2009-08-08 18:16:01 UTC (rev 7433) +++ trunk/matplotlib/examples/mplot3d/polys3d_demo.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -1,11 +1,10 @@ from mpl_toolkits.mplot3d import Axes3D from matplotlib.collections import PolyCollection from matplotlib.colors import colorConverter -import pylab -import random +import matplotlib.pyplot as plt import numpy as np -fig = pylab.figure() +fig = plt.figure() ax = Axes3D(fig) cc = lambda arg: colorConverter.to_rgba(arg, alpha=0.6) @@ -14,7 +13,7 @@ verts = [] zs = [0.0, 1.0, 2.0, 3.0] for z in zs: - ys = [random.random() for x in xs] + ys = np.random.rand(len(xs)) ys[0], ys[-1] = 0, 0 verts.append(zip(xs, ys)) @@ -27,5 +26,5 @@ ax.set_ylim3d(-1, 4) ax.set_zlim3d(0, 1) -pylab.show() +plt.show() Property changes on: trunk/matplotlib/examples/mplot3d/polys3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424 + /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433 Modified: trunk/matplotlib/examples/mplot3d/scatter3d_demo.py =================================================================== --- trunk/matplotlib/examples/mplot3d/scatter3d_demo.py 2009-08-08 18:16:01 UTC (rev 7433) +++ trunk/matplotlib/examples/mplot3d/scatter3d_demo.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -1,21 +1,23 @@ +import numpy as np from mpl_toolkits.mplot3d import Axes3D -import pylab -import random +import matplotlib.pyplot as plt -fig = pylab.figure() + +def randrange(n, vmin, vmax): + return (vmax-vmin)*np.random.rand(n) + vmin + +fig = plt.figure() ax = Axes3D(fig) n = 100 for c, zl, zh in [('r', -50, -25), ('b', -30, -5)]: - xs, ys, zs = zip(* - [(random.randrange(23, 32), - random.randrange(100), - random.randrange(zl, zh) - ) for i in range(n)]) + xs = randrange(n, 23, 32) + ys = randrange(n, 0, 100) + zs = randrange(n, zl, zh) ax.scatter(xs, ys, zs, c=c) ax.set_xlabel('X Label') ax.set_ylabel('Y Label') ax.set_zlabel('Z Label') -pylab.show() +plt.show() Property changes on: trunk/matplotlib/examples/mplot3d/scatter3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424 + /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433 Modified: trunk/matplotlib/examples/mplot3d/surface3d_demo.py =================================================================== --- trunk/matplotlib/examples/mplot3d/surface3d_demo.py 2009-08-08 18:16:01 UTC (rev 7433) +++ trunk/matplotlib/examples/mplot3d/surface3d_demo.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -1,10 +1,9 @@ from mpl_toolkits.mplot3d import Axes3D from matplotlib import cm -import pylab -import random +import matplotlib.pyplot as plt import numpy as np -fig = pylab.figure() +fig = plt.figure() ax = Axes3D(fig) X = np.arange(-5, 5, 0.25) Y = np.arange(-5, 5, 0.25) @@ -13,5 +12,5 @@ Z = np.sin(R) ax.plot_surface(X, Y, Z, rstride=1, cstride=1, cmap=cm.jet) -pylab.show() +plt.show() Property changes on: trunk/matplotlib/examples/mplot3d/surface3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424 + /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433 Modified: trunk/matplotlib/examples/mplot3d/surface3d_demo2.py =================================================================== --- trunk/matplotlib/examples/mplot3d/surface3d_demo2.py 2009-08-08 18:16:01 UTC (rev 7433) +++ trunk/matplotlib/examples/mplot3d/surface3d_demo2.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -1,9 +1,8 @@ from mpl_toolkits.mplot3d import Axes3D -import pylab -import random +import matplotlib.pyplot as plt import numpy as np -fig = pylab.figure() +fig = plt.figure() ax = Axes3D(fig) u = np.linspace(0, 2 * np.pi, 100) @@ -14,5 +13,5 @@ z = 10 * np.outer(np.ones(np.size(u)), np.cos(v)) ax.plot_surface(x, y, z, rstride=4, cstride=4, color='b') -pylab.show() +plt.show() Modified: trunk/matplotlib/examples/mplot3d/text3d_demo.py =================================================================== --- trunk/matplotlib/examples/mplot3d/text3d_demo.py 2009-08-08 18:16:01 UTC (rev 7433) +++ trunk/matplotlib/examples/mplot3d/text3d_demo.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -1,8 +1,7 @@ from mpl_toolkits.mplot3d import Axes3D -import pylab -import random +import matplotlib.pyplot as plt -fig = pylab.figure() +fig = plt.figure() ax = Axes3D(fig) zdirs = (None, 'x', 'y', 'z', (1, 1, 0), (1, 1, 1)) @@ -22,5 +21,5 @@ ax.set_ylabel('Y axis') ax.set_zlabel('Z axis') -pylab.show() +plt.show() Modified: trunk/matplotlib/examples/mplot3d/wire3d_demo.py =================================================================== --- trunk/matplotlib/examples/mplot3d/wire3d_demo.py 2009-08-08 18:16:01 UTC (rev 7433) +++ trunk/matplotlib/examples/mplot3d/wire3d_demo.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -1,12 +1,11 @@ from mpl_toolkits.mplot3d import axes3d -import pylab -import random +import matplotlib.pyplot as plt import numpy as np -fig = pylab.figure() +fig = plt.figure() ax = axes3d.Axes3D(fig) X, Y, Z = axes3d.get_test_data(0.05) ax.plot_wireframe(X, Y, Z, rstride=10, cstride=10) -pylab.show() +plt.show() Property changes on: trunk/matplotlib/examples/mplot3d/wire3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424 + /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433 Modified: trunk/matplotlib/lib/matplotlib/path.py =================================================================== --- trunk/matplotlib/lib/matplotlib/path.py 2009-08-08 18:16:01 UTC (rev 7433) +++ trunk/matplotlib/lib/matplotlib/path.py 2009-08-08 18:24:52 UTC (rev 7434) @@ -129,6 +129,34 @@ self._interpolation_steps = _interpolation_steps @classmethod + def make_compound_path_from_polys(cls, XY): + """ + (static method) Make a compound path object to draw a number + of polygons with equal numbers of sides XY is a (numpolys x + numsides x 2) numpy array of vertices. Return object is a + :class:`Path` + + .. plot:: mpl_examples/api/histogram_path_demo.py + + """ + + # for each poly: 1 for the MOVETO, (numsides-1) for the LINETO, 1 for the + # CLOSEPOLY; the vert for the closepoly is ignored but we still need + # it to keep the codes aligned with the vertices + numpolys, numsides, two = XY.shape + assert(two==2) + stride = numsides + 1 + nverts = numpolys * stride + verts = np.zeros((nverts, 2)) + codes = np.ones(nverts, int) * cls.LINETO + codes[0::stride] = cls.MOVETO + codes[numsides::stride] = cls.CLOSEPOLY + for i in range(numsides): + verts[i::stride] = XY[:,i] + + return cls(verts, codes) + + @classmethod def make_compound_path(cls, *args): """ (staticmethod) Make a compound path from a list of Path Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2009-08-09 04:50:19
|
Revision: 7437 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7437&view=rev Author: leejjoon Date: 2009-08-09 04:50:12 +0000 (Sun, 09 Aug 2009) Log Message: ----------- retrieve a sample image using cbook.get_sample_data function Modified Paths: -------------- trunk/matplotlib/examples/axes_grid/demo_axes_divider.py trunk/matplotlib/examples/axes_grid/demo_axes_grid.py trunk/matplotlib/examples/axes_grid/inset_locator_demo2.py trunk/matplotlib/examples/axes_grid/simple_axesgrid2.py trunk/matplotlib/examples/axes_grid/simple_rgb.py Removed Paths: ------------- trunk/matplotlib/lib/mpl_toolkits/axes_grid/demo_image.py Modified: trunk/matplotlib/examples/axes_grid/demo_axes_divider.py =================================================================== --- trunk/matplotlib/examples/axes_grid/demo_axes_divider.py 2009-08-09 04:34:08 UTC (rev 7436) +++ trunk/matplotlib/examples/axes_grid/demo_axes_divider.py 2009-08-09 04:50:12 UTC (rev 7437) @@ -1,7 +1,14 @@ import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.demo_image import get_demo_image -#import mpl_toolkits.imaging.axes_grid as imaging +def get_demo_image(): + import numpy as np + from matplotlib.cbook import get_sample_data + f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) + z = np.load(f) + # z is a numpy array of 15x15 + return z, (-3,4,-4,3) + + def demo_simple_image(ax): Z, extent = get_demo_image() Modified: trunk/matplotlib/examples/axes_grid/demo_axes_grid.py =================================================================== --- trunk/matplotlib/examples/axes_grid/demo_axes_grid.py 2009-08-09 04:34:08 UTC (rev 7436) +++ trunk/matplotlib/examples/axes_grid/demo_axes_grid.py 2009-08-09 04:50:12 UTC (rev 7437) @@ -1,7 +1,13 @@ import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.demo_image import get_demo_image from mpl_toolkits.axes_grid import AxesGrid +def get_demo_image(): + import numpy as np + from matplotlib.cbook import get_sample_data + f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) + z = np.load(f) + # z is a numpy array of 15x15 + return z, (-3,4,-4,3) def demo_simple_grid(fig): """ Modified: trunk/matplotlib/examples/axes_grid/inset_locator_demo2.py =================================================================== --- trunk/matplotlib/examples/axes_grid/inset_locator_demo2.py 2009-08-09 04:34:08 UTC (rev 7436) +++ trunk/matplotlib/examples/axes_grid/inset_locator_demo2.py 2009-08-09 04:50:12 UTC (rev 7437) @@ -5,7 +5,13 @@ import numpy as np -from mpl_toolkits.axes_grid.demo_image import get_demo_image +def get_demo_image(): + from matplotlib.cbook import get_sample_data + import numpy as np + f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) + z = np.load(f) + # z is a numpy array of 15x15 + return z, (-3,4,-4,3) fig = plt.figure(1, [5,4]) Modified: trunk/matplotlib/examples/axes_grid/simple_axesgrid2.py =================================================================== --- trunk/matplotlib/examples/axes_grid/simple_axesgrid2.py 2009-08-09 04:34:08 UTC (rev 7436) +++ trunk/matplotlib/examples/axes_grid/simple_axesgrid2.py 2009-08-09 04:50:12 UTC (rev 7437) @@ -1,7 +1,14 @@ import matplotlib.pyplot as plt from mpl_toolkits.axes_grid import AxesGrid -from mpl_toolkits.axes_grid.demo_image import get_demo_image +def get_demo_image(): + import numpy as np + from matplotlib.cbook import get_sample_data + f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) + z = np.load(f) + # z is a numpy array of 15x15 + return z, (-3,4,-4,3) + F = plt.figure(1, (5.5, 3.5)) grid = AxesGrid(F, 111, # similar to subplot(111) nrows_ncols = (1, 3), Modified: trunk/matplotlib/examples/axes_grid/simple_rgb.py =================================================================== --- trunk/matplotlib/examples/axes_grid/simple_rgb.py 2009-08-09 04:34:08 UTC (rev 7436) +++ trunk/matplotlib/examples/axes_grid/simple_rgb.py 2009-08-09 04:50:12 UTC (rev 7437) @@ -1,8 +1,15 @@ import matplotlib.pyplot as plt -from mpl_toolkits.axes_grid.demo_image import get_demo_image from mpl_toolkits.axes_grid.axes_rgb import RGBAxes +def get_demo_image(): + import numpy as np + from matplotlib.cbook import get_sample_data + f = get_sample_data("axes_grid/bivariate_normal.npy", asfileobj=False) + z = np.load(f) + # z is a numpy array of 15x15 + return z, (-3,4,-4,3) + def get_rgb(): Z, extent = get_demo_image() Deleted: trunk/matplotlib/lib/mpl_toolkits/axes_grid/demo_image.py =================================================================== --- trunk/matplotlib/lib/mpl_toolkits/axes_grid/demo_image.py 2009-08-09 04:34:08 UTC (rev 7436) +++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/demo_image.py 2009-08-09 04:50:12 UTC (rev 7437) @@ -1,17 +0,0 @@ -import numpy as np - -def get_demo_image(): - # prepare image - delta = 0.5 - - extent = (-3,4,-4,3) - x = np.arange(-3.0, 4.001, delta) - y = np.arange(-4.0, 3.001, delta) - X, Y = np.meshgrid(x, y) - import matplotlib.mlab as mlab - Z1 = mlab.bivariate_normal(X, Y, 1.0, 1.0, 0.0, 0.0) - Z2 = mlab.bivariate_normal(X, Y, 1.5, 0.5, 1, 1) - Z = (Z1 - Z2) * 10 - - return Z, extent - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2009-08-09 19:38:56
|
Revision: 7440 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7440&view=rev Author: leejjoon Date: 2009-08-09 19:38:48 +0000 (Sun, 09 Aug 2009) Log Message: ----------- AnnotationBbox implemented. Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/offsetbox.py trunk/matplotlib/lib/matplotlib/text.py trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py Added Paths: ----------- trunk/matplotlib/examples/pylab_examples/demo_annotation_box.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2009-08-09 19:25:49 UTC (rev 7439) +++ trunk/matplotlib/CHANGELOG 2009-08-09 19:38:48 UTC (rev 7440) @@ -1,3 +1,7 @@ +2009-08-09 AnnotationBbox added. Similar to Annotation, but works with + OffsetBox instead of Text. See the example + demo_annotation_box.py. -JJL + 2009-08-07 BboxImage implemented. Two examples, demo_bboximage.py and demo_ribbon_box.py added. - JJL Added: trunk/matplotlib/examples/pylab_examples/demo_annotation_box.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/demo_annotation_box.py (rev 0) +++ trunk/matplotlib/examples/pylab_examples/demo_annotation_box.py 2009-08-09 19:38:48 UTC (rev 7440) @@ -0,0 +1,94 @@ +import matplotlib.pyplot as plt +from matplotlib.offsetbox import TextArea, DrawingArea, OffsetImage, \ + AnnotationBbox +from matplotlib.cbook import get_sample_data + +import numpy as np + +if 1: + fig = plt.gcf() + fig.clf() + ax = plt.subplot(111) + + offsetbox = TextArea("Test 1", minimumdescent=False) + + xy = (0.5, 0.7) + + ax.plot(xy[0], xy[1], ".r") + + ab = AnnotationBbox(offsetbox, xy, + xybox=(-20, 40), + xycoords='data', + boxcoords="offset points", + arrowprops=dict(arrowstyle="->")) + ax.add_artist(ab) + + offsetbox = TextArea("Test", minimumdescent=False) + + ab = AnnotationBbox(offsetbox, xy, + xybox=(1.02, xy[1]), + xycoords='data', + boxcoords=("axes fraction", "data"), + box_alignment=(0.,0.5), + arrowprops=dict(arrowstyle="->")) + ax.add_artist(ab) + + + from matplotlib.patches import Circle + da = DrawingArea(20, 20, 0, 0) + p = Circle((10, 10), 10) + da.add_artist(p) + + xy = [0.3, 0.55] + ab = AnnotationBbox(da, xy, + xybox=(1.02, xy[1]), + xycoords='data', + boxcoords=("axes fraction", "data"), + box_alignment=(0.,0.5), + arrowprops=dict(arrowstyle="->")) + #arrowprops=None) + + ax.add_artist(ab) + + + arr = np.arange(100).reshape((10,10)) + im = OffsetImage(arr, zoom=2) + + ab = AnnotationBbox(im, xy, + xybox=(-50., 50.), + xycoords='data', + boxcoords="offset points", + pad=0.3, + arrowprops=dict(arrowstyle="->")) + #arrowprops=None) + + ax.add_artist(ab) + + + # another image + + + from matplotlib._png import read_png + fn = get_sample_data("lena.png", asfileobj=False) + arr_lena = read_png(fn) + + imagebox = OffsetImage(arr_lena, zoom=0.2) + + ab = AnnotationBbox(imagebox, xy, + xybox=(120., -80.), + xycoords='data', + boxcoords="offset points", + pad=0.5, + arrowprops=dict(arrowstyle="->", + connectionstyle="angle,angleA=0,angleB=90,rad=3") + ) + + + ax.add_artist(ab) + + ax.set_xlim(0, 1) + ax.set_ylim(0, 1) + + + plt.draw() + plt.show() Modified: trunk/matplotlib/lib/matplotlib/offsetbox.py =================================================================== --- trunk/matplotlib/lib/matplotlib/offsetbox.py 2009-08-09 19:25:49 UTC (rev 7439) +++ trunk/matplotlib/lib/matplotlib/offsetbox.py 2009-08-09 19:38:48 UTC (rev 7440) @@ -19,13 +19,21 @@ import matplotlib.artist as martist import matplotlib.text as mtext import numpy as np -from matplotlib.transforms import Bbox, BboxBase, TransformedBbox, BboxTransformTo +from matplotlib.transforms import Bbox, BboxBase, TransformedBbox, \ + IdentityTransform from matplotlib.font_manager import FontProperties -from matplotlib.patches import FancyBboxPatch +from matplotlib.patches import FancyBboxPatch, FancyArrowPatch from matplotlib import rcParams +import matplotlib.cbook as cbook + +#from bboximage import BboxImage +from matplotlib.image import BboxImage + from matplotlib.patches import bbox_artist as mbbox_artist + + DEBUG=False # for debuging use def bbox_artist(*args, **kwargs): @@ -744,7 +752,7 @@ def get_extent(self, renderer): # clear the offset transforms - _off = self.ref_offset_transform.to_values() # to be restored later + _off = self.offset_transform.to_values() # to be restored later self.ref_offset_transform.clear() self.offset_transform.clear() @@ -755,8 +763,10 @@ # adjust ref_offset_tansform self.ref_offset_transform.translate(-ub.x0, -ub.y0) + # restor offset transform - self.offset_transform.matrix_from_values(*_off) + mtx = self.offset_transform.matrix_from_values(*_off) + self.offset_transform.set_matrix(mtx) return ub.width, ub.height, 0., 0. @@ -890,10 +900,10 @@ else: return TransformedBbox(self._bbox_to_anchor, transform) - + def set_bbox_to_anchor(self, bbox, transform=None): """ set the bbox that the child will be anchored. @@ -901,7 +911,7 @@ *bbox* can be a Bbox instance, a list of [left, bottom, width, height], or a list of [left, bottom] where the width and height will be assumed to be zero. The bbox will be - transformed to display coordinate by the given transform. + transformed to display coordinate by the given transform. """ if bbox is None or isinstance(bbox, BboxBase): self._bbox_to_anchor = bbox @@ -951,6 +961,13 @@ self.set_offset(_offset) + def update_frame(self, bbox, fontsize=None): + self.patch.set_bounds(bbox.x0, bbox.y0, + bbox.width, bbox.height) + + if fontsize: + self.patch.set_mutation_scale(fontsize) + def draw(self, renderer): "draw the artist" @@ -962,11 +979,7 @@ if self._drawFrame: # update the location and size of the legend bbox = self.get_window_extent(renderer) - self.patch.set_bounds(bbox.x0, bbox.y0, - bbox.width, bbox.height) - - self.patch.set_mutation_scale(fontsize) - + self.update_frame(bbox, fontsize) self.patch.draw(renderer) @@ -1004,3 +1017,399 @@ container = parentbbox.padded(-borderpad) anchored_box = bbox.anchored(c, container=container) return anchored_box.x0, anchored_box.y0 + + +class AnchoredText(AnchoredOffsetbox): + """ + AnchoredOffsetbox with Text + """ + + def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, **kwargs): + """ + *s* : string + *loc* : location code + *prop* : font property + *pad* : pad between the text and the frame as fraction of the font size. + *borderpad* : pad between the frame and the axes (or bbox_to_anchor). + + other keyword parameters of AnchoredOffsetbox are also allowed. + """ + + self.txt = TextArea(s, textprops=prop, + minimumdescent=False) + fp = self.txt._text.get_fontproperties() + + super(AnchoredText, self).__init__(loc, pad=pad, borderpad=borderpad, + child=self.txt, + prop=fp, + **kwargs) + + + +class OffsetImage(OffsetBox): + def __init__(self, arr, + zoom=1, + cmap = None, + norm = None, + interpolation=None, + origin=None, + filternorm=1, + filterrad=4.0, + resample = False, + dpi_cor=True, + **kwargs + ): + + self._dpi_cor = dpi_cor + + self.image = BboxImage(bbox=self.get_window_extent, + cmap = cmap, + norm = norm, + interpolation=interpolation, + origin=origin, + filternorm=filternorm, + filterrad=filterrad, + resample = resample, + **kwargs + ) + + self._children = [self.image] + + self.set_zoom(zoom) + self.set_data(arr) + + OffsetBox.__init__(self) + + + def set_data(self, arr): + self._data = np.asarray(arr) + self.image.set_data(self._data) + + def get_data(self): + return self._data + + def set_zoom(self, zoom): + self._zoom = zoom + + def get_zoom(self): + return self._zoom + +# def set_axes(self, axes): +# self.image.set_axes(axes) +# martist.Artist.set_axes(self, axes) + +# def set_offset(self, xy): +# """ +# set offset of the container. + +# Accept : tuple of x,y cooridnate in disokay units. +# """ +# self._offset = xy + +# self.offset_transform.clear() +# self.offset_transform.translate(xy[0], xy[1]) + + + def get_offset(self): + """ + return offset of the container. + """ + return self._offset + + + def get_window_extent(self, renderer): + ''' + get the bounding box in display space. + ''' + w, h, xd, yd = self.get_extent(renderer) + ox, oy = self.get_offset() + return mtransforms.Bbox.from_bounds(ox-xd, oy-yd, w, h) + + + def get_extent(self, renderer): + + if self._dpi_cor: # True, do correction + dpi_cor = renderer.points_to_pixels(1.) + else: + dpi_cor = 1. + + zoom = self.get_zoom() + data = self.get_data() + ny, nx = data.shape[:2] + w, h = nx*zoom, ny*zoom + + return w, h, 0, 0 + + + + def draw(self, renderer): + """ + Draw the children + """ + + self.image.draw(renderer) + + #bbox_artist(self, renderer, fill=False, props=dict(pad=0.)) + + + +from matplotlib.text import _AnnotationBase + +class AnnotationBbox(martist.Artist, _AnnotationBase): + """ + Annotation-like class, but with offsetbox instead of Text. + """ + + zorder = 3 + + def __str__(self): + return "AnnotationBbox(%g,%g)"%(self.xy[0],self.xy[1]) + def __init__(self, offsetbox, xy, + xybox=None, + xycoords='data', + boxcoords=None, + frameon=True, pad=0.4, # BboxPatch + annotation_clip=None, + box_alignment=(0.5, 0.5), + bboxprops=None, + arrowprops=None, + fontsize=None, + **kwargs): + """ + *offsetbox* : OffsetBox instance + + *xycoords* : same as Annotation but can be a tuple of two + strings which are interpreted as x and y coordinates. + + *boxcoords* : similar to textcoords as Annotation but can be a + tuple of two strings which are interpreted as x and y + coordinates. + + *box_alignment* : a tuple of two floats for a vertical and + horizontal alignment of the offset box w.r.t. the *boxcoords*. + The lower-left corner is (0.0) and upper-right corner is (1.1). + + other parameters are identical to that of Annotation. + """ + self.offsetbox = offsetbox + + self.arrowprops = arrowprops + + self.set_fontsize(fontsize) + + + if arrowprops is not None: + self._arrow_relpos = self.arrowprops.pop("relpos", (0.5, 0.5)) + self.arrow_patch = FancyArrowPatch((0, 0), (1,1), + **self.arrowprops) + else: + self._arrow_relpos = None + self.arrow_patch = None + + _AnnotationBase.__init__(self, + xy, xytext=xybox, + xycoords=xycoords, textcoords=boxcoords, + annotation_clip=annotation_clip) + + martist.Artist.__init__(self, **kwargs) + + #self._fw, self._fh = 0., 0. # for alignment + self._box_alignment = box_alignment + + # frame + self.patch = FancyBboxPatch( + xy=(0.0, 0.0), width=1., height=1., + facecolor='w', edgecolor='k', + mutation_scale=self.prop.get_size_in_points(), + snap=True + ) + self.patch.set_boxstyle("square",pad=pad) + if bboxprops: + self.patch.set(**bboxprops) + self._drawFrame = frameon + + + __init__.__doc__ = cbook.dedent(__init__.__doc__) % martist.kwdocd + + def contains(self,event): + t,tinfo = self.offsetbox.contains(event) + if self.arrow is not None: + a,ainfo=self.arrow.contains(event) + t = t or a + + # self.arrow_patch is currently not checked as this can be a line - JJ + + return t,tinfo + + + def get_children(self): + children = [self.offsetbox, self.patch] + if self.arrow_patch: + children.append(self.arrow_patch) + return children + + def set_figure(self, fig): + + if self.arrow_patch is not None: + self.arrow_patch.set_figure(fig) + self.offsetbox.set_figure(fig) + martist.Artist.set_figure(self, fig) + + def set_fontsize(self, s=None): + """ + set fontsize in points + """ + if s is None: + s = rcParams["legend.fontsize"] + + self.prop=FontProperties(size=s) + + def get_fontsize(self, s=None): + """ + return fontsize in points + """ + return self.prop.get_size_in_points() + + def update_positions(self, renderer): + "Update the pixel positions of the annotated point and the text." + xy_pixel = self._get_position_xy(renderer) + self._update_position_xybox(renderer, xy_pixel) + + mutation_scale = renderer.points_to_pixels(self.get_fontsize()) + self.patch.set_mutation_scale(mutation_scale) + + if self.arrow_patch: + self.arrow_patch.set_mutation_scale(mutation_scale) + + + def _update_position_xybox(self, renderer, xy_pixel): + "Update the pixel positions of the annotation text and the arrow patch." + + x, y = self.xytext + if isinstance(self.textcoords, tuple): + xcoord, ycoord = self.textcoords + x1, y1 = self._get_xy(x, y, xcoord) + x2, y2 = self._get_xy(x, y, ycoord) + ox0, oy0 = x1, y2 + else: + ox0, oy0 = self._get_xy(x, y, self.textcoords) + + #self.offsetbox.set_bbox_to_anchor((ox0, oy0)) + w, h, xd, yd = self.offsetbox.get_extent(renderer) + + _fw, _fh = self._box_alignment + self.offsetbox.set_offset((ox0-_fw*w, oy0-_fh*h)) + + # update patch position + bbox = self.offsetbox.get_window_extent(renderer) + #self.offsetbox.set_offset((ox0-_fw*w, oy0-_fh*h)) + self.patch.set_bounds(bbox.x0, bbox.y0, + bbox.width, bbox.height) + + x, y = xy_pixel + + ox1, oy1 = x, y + + if self.arrowprops: + x0, y0 = x, y + + d = self.arrowprops.copy() + + # Use FancyArrowPatch if self.arrowprops has "arrowstyle" key. + + # adjust the starting point of the arrow relative to + # the textbox. + # TODO : Rotation needs to be accounted. + relpos = self._arrow_relpos + + ox0 = bbox.x0 + bbox.width * relpos[0] + oy0 = bbox.y0 + bbox.height * relpos[1] + + # The arrow will be drawn from (ox0, oy0) to (ox1, + # oy1). It will be first clipped by patchA and patchB. + # Then it will be shrinked by shirnkA and shrinkB + # (in points). If patch A is not set, self.bbox_patch + # is used. + + self.arrow_patch.set_positions((ox0, oy0), (ox1,oy1)) + fs = self.prop.get_size_in_points() + mutation_scale = d.pop("mutation_scale", fs) + mutation_scale = renderer.points_to_pixels(mutation_scale) + self.arrow_patch.set_mutation_scale(mutation_scale) + + patchA = d.pop("patchA", self.patch) + self.arrow_patch.set_patchA(patchA) + + + + def draw(self, renderer): + """ + Draw the :class:`Annotation` object to the given *renderer*. + """ + + if renderer is not None: + self._renderer = renderer + if not self.get_visible(): return + + xy_pixel = self._get_position_xy(renderer) + + if not self._check_xy(renderer, xy_pixel): + return + + self.update_positions(renderer) + + if self.arrow_patch is not None: + if self.arrow_patch.figure is None and self.figure is not None: + self.arrow_patch.figure = self.figure + self.arrow_patch.draw(renderer) + + if self._drawFrame: + self.patch.draw(renderer) + + self.offsetbox.draw(renderer) + + + + +if __name__ == "__main__": + + fig = plt.figure(1) + fig.clf() + ax = plt.subplot(121) + + #txt = ax.text(0.5, 0.5, "Test", size=30, ha="center", color="w") + kwargs = dict() + + a = np.arange(256).reshape(16,16)/256. + myimage = OffsetImage(a, + zoom=2, + norm = None, + origin=None, + **kwargs + ) + ax.add_artist(myimage) + + myimage.set_offset((100, 100)) + + + myimage2 = OffsetImage(a, + zoom=2, + norm = None, + origin=None, + **kwargs + ) + ann = AnnotationBbox(myimage2, (0.5, 0.5), + xybox=(30, 30), + xycoords='data', + boxcoords="offset points", + frameon=True, pad=0.4, # BboxPatch + bboxprops=dict(boxstyle="round", fc="y"), + fontsize=None, + arrowprops=dict(arrowstyle="->"), + ) + + ax.add_artist(ann) + + plt.draw() + plt.show() + Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2009-08-09 19:25:49 UTC (rev 7439) +++ trunk/matplotlib/lib/matplotlib/text.py 2009-08-09 19:38:48 UTC (rev 7440) @@ -1340,7 +1340,158 @@ artist.kwdocd['TextWithDash'] = artist.kwdoc(TextWithDash) -class Annotation(Text): +class _AnnotationBase(object): + def __init__(self, + xy, xytext=None, + xycoords='data', textcoords=None, + annotation_clip=None): + if xytext is None: + xytext = xy + if textcoords is None: + textcoords = xycoords + # we'll draw ourself after the artist we annotate by default + x,y = self.xytext = xytext + + self.xy = xy + self.xycoords = xycoords + self.textcoords = textcoords + self.set_annotation_clip(annotation_clip) + + def _get_xy(self, x, y, s): + if s=='data': + trans = self.axes.transData + x = float(self.convert_xunits(x)) + y = float(self.convert_yunits(y)) + return trans.transform_point((x, y)) + elif s=='offset points': + # convert the data point + dx, dy = self.xy + + # prevent recursion + if self.xycoords == 'offset points': + return self._get_xy(dx, dy, 'data') + + dx, dy = self._get_xy(dx, dy, self.xycoords) + + # convert the offset + dpi = self.figure.get_dpi() + x *= dpi/72. + y *= dpi/72. + + # add the offset to the data point + x += dx + y += dy + + return x, y + elif s=='polar': + theta, r = x, y + x = r*np.cos(theta) + y = r*np.sin(theta) + trans = self.axes.transData + return trans.transform_point((x,y)) + elif s=='figure points': + #points from the lower left corner of the figure + dpi = self.figure.dpi + l,b,w,h = self.figure.bbox.bounds + r = l+w + t = b+h + + x *= dpi/72. + y *= dpi/72. + if x<0: + x = r + x + if y<0: + y = t + y + return x,y + elif s=='figure pixels': + #pixels from the lower left corner of the figure + l,b,w,h = self.figure.bbox.bounds + r = l+w + t = b+h + if x<0: + x = r + x + if y<0: + y = t + y + return x, y + elif s=='figure fraction': + #(0,0) is lower left, (1,1) is upper right of figure + trans = self.figure.transFigure + return trans.transform_point((x,y)) + elif s=='axes points': + #points from the lower left corner of the axes + dpi = self.figure.dpi + l,b,w,h = self.axes.bbox.bounds + r = l+w + t = b+h + if x<0: + x = r + x*dpi/72. + else: + x = l + x*dpi/72. + if y<0: + y = t + y*dpi/72. + else: + y = b + y*dpi/72. + return x, y + elif s=='axes pixels': + #pixels from the lower left corner of the axes + + l,b,w,h = self.axes.bbox.bounds + r = l+w + t = b+h + if x<0: + x = r + x + else: + x = l + x + if y<0: + y = t + y + else: + y = b + y + return x, y + elif s=='axes fraction': + #(0,0) is lower left, (1,1) is upper right of axes + trans = self.axes.transAxes + return trans.transform_point((x, y)) + + def set_annotation_clip(self, b): + """ + set *annotation_clip* attribute. + + * True : the annotation will only be drawn when self.xy is inside the axes. + * False : the annotation will always be drawn regardless of its position. + * None : the self.xy will be checked only if *xycoords* is "data" + """ + self._annotation_clip = b + + def get_annotation_clip(self): + """ + Return *annotation_clip* attribute. + See :meth:`set_annotation_clip` for the meaning of return values. + """ + return self._annotation_clip + + def _get_position_xy(self, renderer): + "Return the pixel position of the the annotated point." + x, y = self.xy + return self._get_xy(x, y, self.xycoords) + + def _check_xy(self, renderer, xy_pixel): + """ + given the xy pixel coordinate, check if the annotation need to + be drawn. + """ + + b = self.get_annotation_clip() + if b or (b is None and self.xycoords == "data"): + # check if self.xy is inside the axes. + if not self.axes.contains_point(xy_pixel): + return False + + return True + + + + +class Annotation(Text, _AnnotationBase): """ A :class:`~matplotlib.text.Text` class to make annotating things in the figure, such as :class:`~matplotlib.figure.Figure`, @@ -1354,6 +1505,7 @@ xycoords='data', textcoords=None, arrowprops=None, + annotation_clip=None, **kwargs): """ Annotate the *x*, *y* point *xy* with text *s* at *x*, *y* @@ -1442,16 +1594,14 @@ %(Text)s """ - if xytext is None: - xytext = xy - if textcoords is None: - textcoords = xycoords - # we'll draw ourself after the artist we annotate by default - x,y = self.xytext = xytext + + _AnnotationBase.__init__(self, + xy, xytext=xytext, + xycoords=xycoords, textcoords=textcoords, + annotation_clip=annotation_clip) + + x,y = self.xytext Text.__init__(self, x, y, s, **kwargs) - self.xy = xy - self.xycoords = xycoords - self.textcoords = textcoords self.arrowprops = arrowprops @@ -1465,9 +1615,6 @@ else: self.arrow_patch = None - # if True, draw annotation only if self.xy is inside the axes - self._annotation_clip = None - __init__.__doc__ = cbook.dedent(__init__.__doc__) % artist.kwdocd def contains(self,event): @@ -1489,131 +1636,13 @@ self.arrow_patch.set_figure(fig) Artist.set_figure(self, fig) - def _get_xy(self, x, y, s): - if s=='data': - trans = self.axes.transData - x = float(self.convert_xunits(x)) - y = float(self.convert_yunits(y)) - return trans.transform_point((x, y)) - elif s=='offset points': - # convert the data point - dx, dy = self.xy - # prevent recursion - if self.xycoords == 'offset points': - return self._get_xy(dx, dy, 'data') - - dx, dy = self._get_xy(dx, dy, self.xycoords) - - # convert the offset - dpi = self.figure.get_dpi() - x *= dpi/72. - y *= dpi/72. - - # add the offset to the data point - x += dx - y += dy - - return x, y - elif s=='polar': - theta, r = x, y - x = r*np.cos(theta) - y = r*np.sin(theta) - trans = self.axes.transData - return trans.transform_point((x,y)) - elif s=='figure points': - #points from the lower left corner of the figure - dpi = self.figure.dpi - l,b,w,h = self.figure.bbox.bounds - r = l+w - t = b+h - - x *= dpi/72. - y *= dpi/72. - if x<0: - x = r + x - if y<0: - y = t + y - return x,y - elif s=='figure pixels': - #pixels from the lower left corner of the figure - l,b,w,h = self.figure.bbox.bounds - r = l+w - t = b+h - if x<0: - x = r + x - if y<0: - y = t + y - return x, y - elif s=='figure fraction': - #(0,0) is lower left, (1,1) is upper right of figure - trans = self.figure.transFigure - return trans.transform_point((x,y)) - elif s=='axes points': - #points from the lower left corner of the axes - dpi = self.figure.dpi - l,b,w,h = self.axes.bbox.bounds - r = l+w - t = b+h - if x<0: - x = r + x*dpi/72. - else: - x = l + x*dpi/72. - if y<0: - y = t + y*dpi/72. - else: - y = b + y*dpi/72. - return x, y - elif s=='axes pixels': - #pixels from the lower left corner of the axes - - l,b,w,h = self.axes.bbox.bounds - r = l+w - t = b+h - if x<0: - x = r + x - else: - x = l + x - if y<0: - y = t + y - else: - y = b + y - return x, y - elif s=='axes fraction': - #(0,0) is lower left, (1,1) is upper right of axes - trans = self.axes.transAxes - return trans.transform_point((x, y)) - - def set_annotation_clip(self, b): - """ - set *annotation_clip* attribute. - - * True : the annotation will only be drawn when self.xy is inside the axes. - * False : the annotation will always be drawn regardless of its position. - * None : the self.xy will be checked only if *xycoords* is "data" - """ - self._annotation_clip = b - - def get_annotation_clip(self): - """ - Return *annotation_clip* attribute. - See :meth:`set_annotation_clip` for the meaning of return values. - """ - return self._annotation_clip - - def update_positions(self, renderer): "Update the pixel positions of the annotated point and the text." xy_pixel = self._get_position_xy(renderer) self._update_position_xytext(renderer, xy_pixel) - def _get_position_xy(self, renderer): - "Return the pixel position of the the annotated point." - x, y = self.xy - return self._get_xy(x, y, self.xycoords) - - def _update_position_xytext(self, renderer, xy_pixel): "Update the pixel positions of the annotation text and the arrow patch." @@ -1698,21 +1727,6 @@ self.arrow.set_clip_box(self.get_clip_box()) - def _check_xy(self, renderer, xy_pixel): - """ - given the xy pixel coordinate, check if the annotation need to - be drawn. - """ - - b = self.get_annotation_clip() - if b or (b is None and self.xycoords == "data"): - # check if self.xy is inside the axes. - if not self.axes.contains_point(xy_pixel): - return False - - return True - - def draw(self, renderer): """ Draw the :class:`Annotation` object to the given *renderer*. Modified: trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py =================================================================== --- trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py 2009-08-09 19:25:49 UTC (rev 7439) +++ trunk/matplotlib/lib/mpl_toolkits/axes_grid/anchored_artists.py 2009-08-09 19:38:48 UTC (rev 7440) @@ -1,41 +1,35 @@ - -from matplotlib.font_manager import FontProperties -from matplotlib import rcParams from matplotlib.patches import Rectangle, Ellipse +import numpy as np + from matplotlib.offsetbox import AnchoredOffsetbox, AuxTransformBox, VPacker,\ - TextArea, DrawingArea + TextArea, AnchoredText, DrawingArea, AnnotationBbox -class AnchoredText(AnchoredOffsetbox): - def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, **kwargs): +class AnchoredDrawingArea(AnchoredOffsetbox): + """ + AnchoredOffsetbox with DrawingArea + """ - self.txt = TextArea(s, textprops=prop, - minimumdescent=False) - fp = self.txt._text.get_fontproperties() - - super(AnchoredText, self).__init__(loc, pad=pad, borderpad=borderpad, - child=self.txt, - prop=fp, - **kwargs) - - - -class AnchoredDrawingArea(AnchoredOffsetbox): def __init__(self, width, height, xdescent, ydescent, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True, **kwargs): + """ + *width*, *height*, *xdescent*, *ydescent* : the dimensions of the DrawingArea. + *prop* : font property. this is only used for scaling the paddings. + """ self.da = DrawingArea(width, height, xdescent, ydescent, clip=True) self.drawing_area = self.da - + super(AnchoredDrawingArea, self).__init__(loc, pad=pad, borderpad=borderpad, child=self.da, prop=None, frameon=frameon, **kwargs) + class AnchoredAuxTransformBox(AnchoredOffsetbox): def __init__(self, transform, loc, pad=0.4, borderpad=0.5, prop=None, frameon=True, **kwargs): @@ -49,6 +43,7 @@ **kwargs) + class AnchoredEllipse(AnchoredOffsetbox): def __init__(self, transform, width, height, angle, loc, pad=0.1, borderpad=0.1, prop=None, frameon=True, **kwargs): @@ -93,3 +88,73 @@ prop=prop, frameon=frameon, **kwargs) + +if __name__ == "__main__": + + import matplotlib.pyplot as plt + + fig = plt.gcf() + fig.clf() + ax = plt.subplot(111) + + offsetbox = AnchoredText("Test", loc=6, pad=0.3, + borderpad=0.3, prop=None) + xy = (0.5, 0.5) + ax.plot([0.5], [0.5], "xk") + ab = AnnotationBbox(offsetbox, xy, + xybox=(1., .5), + xycoords='data', + boxcoords=("axes fraction", "data"), + arrowprops=dict(arrowstyle="->")) + #arrowprops=None) + + ax.add_artist(ab) + + + from matplotlib.patches import Circle + ada = AnchoredDrawingArea(20, 20, 0, 0, + loc=6, pad=0.1, borderpad=0.3, frameon=True) + p = Circle((10, 10), 10) + ada.da.add_artist(p) + + ab = AnnotationBbox(ada, (0.3, 0.4), + xybox=(1., 0.4), + xycoords='data', + boxcoords=("axes fraction", "data"), + arrowprops=dict(arrowstyle="->")) + #arrowprops=None) + + ax.add_artist(ab) + + + arr = np.arange(100).reshape((10,10)) + im = AnchoredImage(arr, + loc=4, + pad=0.5, borderpad=0.2, prop=None, frameon=True, + zoom=1, + cmap = None, + norm = None, + interpolation=None, + origin=None, + extent=None, + filternorm=1, + filterrad=4.0, + resample = False, + ) + + ab = AnnotationBbox(im, (0.5, 0.5), + xybox=(-10., 10.), + xycoords='data', + boxcoords="offset points", + arrowprops=dict(arrowstyle="->")) + #arrowprops=None) + + ax.add_artist(ab) + + ax.set_xlim(0, 1) + ax.set_ylim(0, 1) + + + plt.draw() + plt.show() + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ef...@us...> - 2009-08-10 00:47:32
|
Revision: 7445 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7445&view=rev Author: efiring Date: 2009-08-10 00:47:21 +0000 (Mon, 10 Aug 2009) Log Message: ----------- Merged revisions 7442-7444 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint ........ r7442 | efiring | 2009-08-09 14:02:56 -1000 (Sun, 09 Aug 2009) | 2 lines patch from sage project: make unicode_safe safer ........ r7443 | efiring | 2009-08-09 14:19:19 -1000 (Sun, 09 Aug 2009) | 3 lines Patch from Jason, sage project: prevent failure with tiny arrows. Also deleting unwanted whitespace in bezier.py. ........ r7444 | efiring | 2009-08-09 14:31:30 -1000 (Sun, 09 Aug 2009) | 3 lines Sage patch, slightly modified, to improve tk/tcl detection. http://trac.sagemath.org/sage_trac/ticket/4176 ........ Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/bezier.py trunk/matplotlib/lib/matplotlib/cbook.py trunk/matplotlib/lib/matplotlib/patches.py trunk/matplotlib/setupext.py Property Changed: ---------------- trunk/matplotlib/ trunk/matplotlib/doc/pyplots/README trunk/matplotlib/doc/sphinxext/gen_gallery.py trunk/matplotlib/doc/sphinxext/gen_rst.py trunk/matplotlib/examples/misc/multiprocess.py trunk/matplotlib/examples/mplot3d/contour3d_demo.py trunk/matplotlib/examples/mplot3d/contourf3d_demo.py trunk/matplotlib/examples/mplot3d/polys3d_demo.py trunk/matplotlib/examples/mplot3d/scatter3d_demo.py trunk/matplotlib/examples/mplot3d/surface3d_demo.py trunk/matplotlib/examples/mplot3d/wire3d_demo.py trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py Property changes on: trunk/matplotlib ___________________________________________________________________ Modified: svnmerge-integrated - /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7433 + /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7444 Modified: svn:mergeinfo - /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433 + /branches/v0_91_maint:5753-5771 /branches/v0_98_5_maint:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444 Property changes on: trunk/matplotlib/doc/pyplots/README ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433 + /branches/v0_98_5_maint/doc/pyplots/README:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/pyplots/README:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444 Property changes on: trunk/matplotlib/doc/sphinxext/gen_gallery.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433 + /branches/v0_91_maint/doc/_templates/gen_gallery.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_gallery.py:6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_gallery.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444 Property changes on: trunk/matplotlib/doc/sphinxext/gen_rst.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433 + /branches/v0_91_maint/doc/examples/gen_rst.py:5753-5771 /branches/v0_98_5_maint/doc/sphinxext/gen_rst.py:6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/doc/sphinxext/gen_rst.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444 Property changes on: trunk/matplotlib/examples/misc/multiprocess.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433 + /branches/v0_91_maint/examples/misc/log.py:5753-5771 /branches/v0_98_5_maint/examples/misc/log.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/misc/multiprocess.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444 Property changes on: trunk/matplotlib/examples/mplot3d/contour3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433 + /branches/v0_91_maint/examples/mplot3d/contour.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contour.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contour3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444 Property changes on: trunk/matplotlib/examples/mplot3d/contourf3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433 + /branches/v0_91_maint/examples/mplot3d/contourf.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/contourf.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/contourf3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444 Property changes on: trunk/matplotlib/examples/mplot3d/polys3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433 + /branches/v0_91_maint/examples/mplot3d/polys.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/polys.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/polys3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444 Property changes on: trunk/matplotlib/examples/mplot3d/scatter3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433 + /branches/v0_91_maint/examples/mplot3d/scatter.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/scatter.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/scatter3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444 Property changes on: trunk/matplotlib/examples/mplot3d/surface3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433 + /branches/v0_91_maint/examples/mplot3d/surface.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/surface.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/surface3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444 Property changes on: trunk/matplotlib/examples/mplot3d/wire3d_demo.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433 + /branches/v0_91_maint/examples/mplot3d/wire.py:5753-5771 /branches/v0_98_5_maint/examples/mplot3d/wire.py:6581,6585,6587,6589-6609,6614,6616,6625,6652,6660-6662,6672-6673,6714-6715,6717-6732,6752-6754,6761-6773,6781,6792,6800,6802,6805,6809,6811,6822,6827,6850,6854,6856,6859,6861-6873,6883-6884,6886,6890-6891,6906-6909,6911-6912,6915-6916,6918,6920-6925,6927-6928,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080 /branches/v0_99_maint/examples/mplot3d/wire3d_demo.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444 Modified: trunk/matplotlib/lib/matplotlib/bezier.py =================================================================== --- trunk/matplotlib/lib/matplotlib/bezier.py 2009-08-10 00:31:30 UTC (rev 7444) +++ trunk/matplotlib/lib/matplotlib/bezier.py 2009-08-10 00:47:21 UTC (rev 7445) @@ -18,7 +18,7 @@ """ return a intersecting point between a line through (cx1, cy1) and having angle t1 and a line through (cx2, cy2) and angle t2. """ - + # line1 => sin_t1 * (x - cx1) - cos_t1 * (y - cy1) = 0. # line1 => sin_t1 * x + cos_t1 * y = sin_t1*cx1 - cos_t1*cy1 @@ -32,7 +32,7 @@ ad_bc = a*d-b*c if ad_bc == 0.: raise ValueError("Given lines do not intersect") - + #rhs_inverse a_, b_ = d, -b c_, d_ = -c, a @@ -53,7 +53,7 @@ if length == 0.: return cx, cy, cx, cy - + cos_t1, sin_t1 = sin_t, -cos_t cos_t2, sin_t2 = -sin_t, cos_t @@ -81,7 +81,7 @@ def split_de_casteljau(beta, t): """split a bezier segment defined by its controlpoints *beta* into two separate segment divided at *t* and return their control points. - + """ beta = np.asarray(beta) beta_list = [beta] @@ -101,20 +101,20 @@ -def find_bezier_t_intersecting_with_closedpath(bezier_point_at_t, inside_closedpath, +def find_bezier_t_intersecting_with_closedpath(bezier_point_at_t, inside_closedpath, t0=0., t1=1., tolerence=0.01): """ Find a parameter t0 and t1 of the given bezier path which bounds the intersecting points with a provided closed path(*inside_closedpath*). Search starts from *t0* and *t1* and it uses a simple bisecting algorithm therefore one of the end point must be inside the path while the orther doesn't. The search stop - when |t0-t1| gets smaller than the given tolerence. + when |t0-t1| gets smaller than the given tolerence. value for - bezier_point_at_t : a function which returns x, y coordinates at *t* - inside_closedpath : return True if the point is insed the path - + """ # inside_closedpath : function @@ -146,11 +146,11 @@ t0 = middle_t start = middle start_inside = middle_inside - + class BezierSegment: """ A simple class of a 2-dimensional bezier segment @@ -192,19 +192,19 @@ def split_bezier_intersecting_with_closedpath(bezier, - inside_closedpath, + inside_closedpath, tolerence=0.01): """ bezier : control points of the bezier segment inside_closedpath : a function which returns true if the point is inside the path """ - + bz = BezierSegment(bezier) bezier_point_at_t = bz.point_at_t t0, t1 = find_bezier_t_intersecting_with_closedpath(bezier_point_at_t, - inside_closedpath, + inside_closedpath, tolerence=tolerence) _left, _right = split_de_casteljau(bezier, (t0+t1)/2.) @@ -213,23 +213,23 @@ def find_r_to_boundary_of_closedpath(inside_closedpath, xy, - cos_t, sin_t, + cos_t, sin_t, rmin=0., rmax=1., tolerence=0.01): """ Find a radius r (centered at *xy*) between *rmin* and *rmax* at which it intersect with the path. - + inside_closedpath : function cx, cy : center cos_t, sin_t : cosine and sine for the angle - rmin, rmax : + rmin, rmax : """ cx, cy = xy def _f(r): return cos_t*r + cx, sin_t*r + cy - find_bezier_t_intersecting_with_closedpath(_f, inside_closedpath, + find_bezier_t_intersecting_with_closedpath(_f, inside_closedpath, t0=rmin, t1=rmax, tolerence=tolerence) @@ -238,7 +238,7 @@ def split_path_inout(path, inside, tolerence=0.01, reorder_inout=False): """ divide a path into two segment at the point where inside(x, y) - becomes False. + becomes False. """ path_iter = path.iter_segments() @@ -262,7 +262,7 @@ break ctl_points_old = ctl_points - + if bezier_path is None: raise ValueError("The path does not seem to intersect with the patch") @@ -286,7 +286,7 @@ verts_right = right[:] #i += 1 - + if path.codes is None: path_in = Path(concat([path.vertices[:i], verts_left])) path_out = Path(concat([verts_right, path.vertices[i:]])) @@ -297,16 +297,16 @@ path_out = Path(concat([verts_right, path.vertices[i:]]), concat([codes_right, path.codes[i:]])) - + if reorder_inout and begin_inside == False: path_in, path_out = path_out, path_in return path_in, path_out - - + + def inside_circle(cx, cy, r): r2 = r**2 def _f(xy): @@ -328,7 +328,7 @@ """ Given the quadraitc bezier control points *bezier2*, returns control points of quadrativ bezier lines roughly parralel to given - one separated by *width*. + one separated by *width*. """ # The parallel bezier lines constructed by following ways. @@ -374,7 +374,7 @@ """ Being similar to get_parallels, returns control points of two quadrativ bezier lines having a width roughly parralel to given - one separated by *width*. + one separated by *width*. """ xx1, yy1 = bezier2[2] @@ -389,17 +389,17 @@ x1, y1, x2, y2 = get_normal_points(cx, cy, cos_t, sin_t, length) - xx12, yy12 = (xx1+xx2)/2., (yy1+yy2)/2., - xx23, yy23 = (xx2+xx3)/2., (yy2+yy3)/2., + xx12, yy12 = (xx1+xx2)/2., (yy1+yy2)/2., + xx23, yy23 = (xx2+xx3)/2., (yy2+yy3)/2., dist = sqrt((xx12-xx23)**2 + (yy12-yy23)**2) cos_t, sin_t = (xx12-xx23)/dist, (yy12-yy23)/dist, - + xm1, ym1, xm2, ym2 = get_normal_points(xx2, yy2, cos_t, sin_t, length*shrink_factor) l_plus = [(x1, y1), (xm1, ym1), (xx1, yy1)] l_minus = [(x2, y2), (xm2, ym2), (xx1, yy1)] - + return l_plus, l_minus @@ -418,7 +418,7 @@ """ Being similar to get_parallels, returns control points of two quadrativ bezier lines having a width roughly parralel to given - one separated by *width*. + one separated by *width*. """ # c1, cm, c2 @@ -446,9 +446,9 @@ # find c12, c23 and c123 which are middle points of c1-cm, cm-c3 and c12-c23 c12x, c12y = (c1x+cmx)*.5, (c1y+cmy)*.5 - c23x, c23y = (cmx+c3x)*.5, (cmy+c3y)*.5 + c23x, c23y = (cmx+c3x)*.5, (cmy+c3y)*.5 c123x, c123y = (c12x+c23x)*.5, (c12y+c23y)*.5 - + # tangential angle of c123 (angle between c12 and c23) cos_t123, sin_t123 = get_cos_sin(c12x, c12y, c23x, c23y) @@ -481,7 +481,7 @@ return Path(p.vertices, c) else: return p - + def concatenate_paths(paths): """ concatenate list of paths into a single path. Modified: trunk/matplotlib/lib/matplotlib/cbook.py =================================================================== --- trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-10 00:31:30 UTC (rev 7444) +++ trunk/matplotlib/lib/matplotlib/cbook.py 2009-08-10 00:47:21 UTC (rev 7445) @@ -19,13 +19,21 @@ major, minor1, minor2, s, tmp = sys.version_info -# on some systems, locale.getpreferredencoding returns None, which can break unicode -preferredencoding = locale.getpreferredencoding() +# On some systems, locale.getpreferredencoding returns None, +# which can break unicode; and the sage project reports that +# some systems have incorrect locale specifications, e.g., +# an encoding instead of a valid locale name. +try: + preferredencoding = locale.getpreferredencoding() +except ValueError: + preferredencoding = None + def unicode_safe(s): if preferredencoding is None: return unicode(s) else: return unicode(s, preferredencoding) + class converter: """ Base class for handling string -> python type with support for Modified: trunk/matplotlib/lib/matplotlib/patches.py =================================================================== --- trunk/matplotlib/lib/matplotlib/patches.py 2009-08-10 00:31:30 UTC (rev 7444) +++ trunk/matplotlib/lib/matplotlib/patches.py 2009-08-10 00:47:21 UTC (rev 7445) @@ -2326,15 +2326,21 @@ x, y = path.vertices[0] insideA = inside_circle(x, y, shrinkA) - left, right = split_path_inout(path, insideA) - path = right + try: + left, right = split_path_inout(path, insideA) + path = right + except ValueError: + pass if shrinkB: x, y = path.vertices[-1] insideB = inside_circle(x, y, shrinkB) - left, right = split_path_inout(path, insideB) - path = left + try: + left, right = split_path_inout(path, insideB) + path = left + except ValueError: + pass return path Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/mathmpl.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433 + /branches/v0_91_maint/doc/sphinxext/mathmpl.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/mathmpl.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/mathmpl.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/only_directives.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433 + /branches/v0_91_maint/doc/sphinxext/only_directives.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/only_directives.py:6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/only_directives.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444 Property changes on: trunk/matplotlib/lib/matplotlib/sphinxext/plot_directive.py ___________________________________________________________________ Modified: svn:mergeinfo - /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433 + /branches/v0_91_maint/doc/sphinxext/plot_directive.py:5753-5771 /branches/v0_98_5_maint/lib/matplotlib/sphinxext/plot_directive.py:6920-6925,6934,6941,6946,6948,6950,6952,6960,6972,6984-6985,6990,6995,6997-7001,7014,7016,7018,7024-7025,7033,7035,7042,7072,7080,7176,7209-7211,7227,7245 /branches/v0_99_maint/lib/matplotlib/sphinxext/plot_directive.py:7338,7393,7395-7404,7407-7424,7428-7433,7442-7444 Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2009-08-10 00:31:30 UTC (rev 7444) +++ trunk/matplotlib/setupext.py 2009-08-10 00:47:21 UTC (rev 7445) @@ -545,7 +545,7 @@ else: add_base_flags(module) module.libraries.append('z') - + # put this last for library link order module.libraries.extend(std_libs) @@ -1037,6 +1037,7 @@ try: tcl_lib_dir, tk_lib_dir, tk_ver = query_tcltk() except: + tk_ver = '' result = hardcoded_tcl_config() else: result = parse_tcl_config(tcl_lib_dir, tk_lib_dir) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |