You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(115) |
Aug
(120) |
Sep
(137) |
Oct
(170) |
Nov
(461) |
Dec
(263) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(120) |
Feb
(74) |
Mar
(35) |
Apr
(74) |
May
(245) |
Jun
(356) |
Jul
(240) |
Aug
(115) |
Sep
(78) |
Oct
(225) |
Nov
(98) |
Dec
(271) |
2009 |
Jan
(132) |
Feb
(84) |
Mar
(74) |
Apr
(56) |
May
(90) |
Jun
(79) |
Jul
(83) |
Aug
(296) |
Sep
(214) |
Oct
(76) |
Nov
(82) |
Dec
(66) |
2010 |
Jan
(46) |
Feb
(58) |
Mar
(51) |
Apr
(77) |
May
(58) |
Jun
(126) |
Jul
(128) |
Aug
(64) |
Sep
(50) |
Oct
(44) |
Nov
(48) |
Dec
(54) |
2011 |
Jan
(68) |
Feb
(52) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2018 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
S | M | T | W | T | F | S |
---|---|---|---|---|---|---|
|
|
|
|
|
|
1
|
2
|
3
|
4
(1) |
5
(6) |
6
(1) |
7
(5) |
8
(4) |
9
(7) |
10
(2) |
11
(12) |
12
(2) |
13
(1) |
14
(4) |
15
|
16
|
17
(7) |
18
(2) |
19
(3) |
20
(8) |
21
(6) |
22
|
23
(9) |
24
(4) |
25
(9) |
26
(2) |
27
|
28
|
29
(2) |
30
(1) |
|
|
|
|
|
|
Revision: 6383 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6383&view=rev Author: jouni Date: 2008年11月09日 14:00:49 +0000 (2008年11月09日) Log Message: ----------- Fix a possible EINTR problem in dviread Modified Paths: -------------- trunk/matplotlib/CHANGELOG trunk/matplotlib/lib/matplotlib/dviread.py Modified: trunk/matplotlib/CHANGELOG =================================================================== --- trunk/matplotlib/CHANGELOG 2008年11月09日 13:17:41 UTC (rev 6382) +++ trunk/matplotlib/CHANGELOG 2008年11月09日 14:00:49 UTC (rev 6383) @@ -1,3 +1,6 @@ +2008年11月09日 Fix a possible EINTR problem in dviread, which might help + when saving pdf files from the qt backend. - JKS + 2008年10月24日 Added Jae Joon's fancy arrow, box and annotation enhancements -- see examples/pylab_examples/annotation_demo2.py Modified: trunk/matplotlib/lib/matplotlib/dviread.py =================================================================== --- trunk/matplotlib/lib/matplotlib/dviread.py 2008年11月09日 13:17:41 UTC (rev 6382) +++ trunk/matplotlib/lib/matplotlib/dviread.py 2008年11月09日 14:00:49 UTC (rev 6383) @@ -689,7 +689,9 @@ def __init__(self, filename): file = open(filename, 'rt') try: + matplotlib.verbose.report('Parsing TeX encoding ' + filename, 'debug-annoying') self.encoding = self._parse(file) + matplotlib.verbose.report('Result: ' + `self.encoding`, 'debug-annoying') finally: file.close() @@ -746,15 +748,33 @@ assert "'" not in filename cmd += "'" + filename + "'" + matplotlib.verbose.report('find_tex_file(%s): %s' \ + % (filename,cmd), 'debug') pipe = os.popen(cmd, 'r') - result = pipe.readline().rstrip() + result = "" + while True: + data = _read_nointr(pipe) + if data == "": + break + result += data pipe.close() + result = result.rstrip() - matplotlib.verbose.report('find_tex_file: %s -> %s' \ - % (filename, result), + matplotlib.verbose.report('find_tex_file result: %s' % result, 'debug') return result +def _read_nointr(pipe, bufsize=-1): + while True: + try: + return pipe.read(bufsize) + except OSError, e: + if e.errno == errno.EINTR: + continue + else: + raise + + # With multiple text objects per figure (e.g. tick labels) we may end # up reading the same tfm and vf files many times, so we implement a # simple cache. TODO: is this worth making persistent? This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6382 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6382&view=rev Author: jouni Date: 2008年11月09日 13:17:41 +0000 (2008年11月09日) Log Message: ----------- Clarify hist docstring Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年11月09日 13:16:39 UTC (rev 6381) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年11月09日 13:17:41 UTC (rev 6382) @@ -6243,8 +6243,8 @@ bottom=None, histtype='bar', align='mid', orientation='vertical', rwidth=None, log=False, **kwargs) - Compute the histogram of *x*. The return value is a tuple - (*n*, *bins*, *patches*) or ([*n0*, *n1*, ...], *bins*, + Compute and draw the histogram of *x*. The return value is a + tuple (*n*, *bins*, *patches*) or ([*n0*, *n1*, ...], *bins*, [*patches0*, *patches1*,...]) if the input contains multiple data. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6381 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6381&view=rev Author: jdh2358 Date: 2008年11月09日 13:16:39 +0000 (2008年11月09日) Log Message: ----------- fixed from_images to respect stride Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/figimage_demo.py trunk/matplotlib/examples/pylab_examples/layer_images.py trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/figure.py trunk/matplotlib/src/_image.cpp Modified: trunk/matplotlib/examples/pylab_examples/figimage_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/figimage_demo.py 2008年11月09日 00:24:29 UTC (rev 6380) +++ trunk/matplotlib/examples/pylab_examples/figimage_demo.py 2008年11月09日 13:16:39 UTC (rev 6381) @@ -12,12 +12,12 @@ Z.shape = 100,100 Z[:,50:] = 1. -im1 = plt.figimage(Z, xo=50, yo=0, cmap=cm.jet, origin='upper') -im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, cmap=cm.jet, origin='upper') +im1 = plt.figimage(Z, xo=50, yo=0, cmap=cm.jet, origin='lower') +im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, cmap=cm.jet, origin='lower') -fig.savefig('figimage_demo.png') -fig.savefig('figimage_demo.svg') -fig.savefig('figimage_demo.pdf') +#fig.savefig('figimage_demo.png') +#fig.savefig('figimage_demo.svg') +#fig.savefig('figimage_demo.pdf') plt.show() Modified: trunk/matplotlib/examples/pylab_examples/layer_images.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/layer_images.py 2008年11月09日 00:24:29 UTC (rev 6380) +++ trunk/matplotlib/examples/pylab_examples/layer_images.py 2008年11月09日 13:16:39 UTC (rev 6381) @@ -25,15 +25,17 @@ xmin, xmax, ymin, ymax = amin(x), amax(x), amin(y), amax(y) extent = xmin, xmax, ymin, ymax +fig = plt.figure(frameon=False) + Z1 = array(([0,1]*4 + [1,0]*4)*4); Z1.shape = 8,8 # chessboard im1 = imshow(Z1, cmap=cm.gray, interpolation='nearest', - extent=extent, origin='lower') + extent=extent) hold(True) Z2 = func3(X, Y) im2 = imshow(Z2, cmap=cm.jet, alpha=.9, interpolation='bilinear', - extent=extent, origin='lower') + extent=extent) #axis([xmin, xmax, ymin, ymax]) Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年11月09日 00:24:29 UTC (rev 6380) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年11月09日 13:16:39 UTC (rev 6381) @@ -1536,12 +1536,7 @@ ims = [(im.make_image(mag),0,0) for im in self.images if im.get_visible()] - #flip the images if their origin is "upper" - for _im, (im,_,_) in zip(self.images, ims): - if _im.origin=="upper": - im.flipud_out() - l, b, r, t = self.bbox.extents width = mag*((round(r) + 0.5) - (round(l) - 0.5)) height = mag*((round(t) + 0.5) - (round(b) - 0.5)) Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2008年11月09日 00:24:29 UTC (rev 6380) +++ trunk/matplotlib/lib/matplotlib/figure.py 2008年11月09日 13:16:39 UTC (rev 6381) @@ -753,11 +753,6 @@ ims = [(im.make_image(mag), im.ox*mag, im.oy*mag) for im in self.images] - for _im, (im,_,_) in zip(self.images, ims): - if _im.origin=="upper": - im.flipud_out() - - im = _image.from_images(self.bbox.height * mag, self.bbox.width * mag, ims) Modified: trunk/matplotlib/src/_image.cpp =================================================================== --- trunk/matplotlib/src/_image.cpp 2008年11月09日 00:24:29 UTC (rev 6380) +++ trunk/matplotlib/src/_image.cpp 2008年11月09日 13:16:39 UTC (rev 6381) @@ -104,7 +104,9 @@ args.verify_length(0); int stride = rbufOut->stride(); + //std::cout << "flip before: " << rbufOut->stride() << std::endl; rbufOut->attach(bufferOut, colsOut, rowsOut, -stride); + //std::cout << "flip after: " << rbufOut->stride() << std::endl; return Py::Object(); } @@ -744,18 +746,24 @@ rb.clear(agg::rgba(1, 1, 1, 1)); - for (size_t imnum=0; imnum< N; imnum++) { tup = Py::Tuple(tups[imnum]); Image* thisim = static_cast<Image*>(tup[0].ptr()); ox = Py::Int(tup[1]); oy = Py::Int(tup[2]); - + bool isflip = (thisim->rbufOut->stride())<0; + //std::cout << "from images " << isflip << "; stride=" << thisim->rbufOut->stride() << std::endl; size_t ind=0; for (size_t j=0; j<thisim->rowsOut; j++) { for (size_t i=0; i<thisim->colsOut; i++) { thisx = i+ox; - thisy = j+oy; + + if (isflip) + thisy = thisim->rowsOut - j + oy; + else + thisy = j+oy; + + if (thisx>=numcols || thisy>=numrows) { ind +=4; continue; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6380 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6380&view=rev Author: jdh2358 Date: 2008年11月09日 00:24:29 +0000 (2008年11月09日) Log Message: ----------- commited jae joons 2nd patch; figimage still sems broken for origin=up Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/layer_images.py trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/examples/pylab_examples/layer_images.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/layer_images.py 2008年11月09日 00:18:40 UTC (rev 6379) +++ trunk/matplotlib/examples/pylab_examples/layer_images.py 2008年11月09日 00:24:29 UTC (rev 6380) @@ -27,17 +27,19 @@ extent = xmin, xmax, ymin, ymax Z1 = array(([0,1]*4 + [1,0]*4)*4); Z1.shape = 8,8 # chessboard im1 = imshow(Z1, cmap=cm.gray, interpolation='nearest', - extent=extent) + extent=extent, origin='lower') hold(True) Z2 = func3(X, Y) im2 = imshow(Z2, cmap=cm.jet, alpha=.9, interpolation='bilinear', - extent=extent) + extent=extent, origin='lower') #axis([xmin, xmax, ymin, ymax]) -#savefig('layer_images') +savefig('layer_images.png') +savefig('layer_images.svg') +savefig('layer_images.pdf') show() Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年11月09日 00:18:40 UTC (rev 6379) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年11月09日 00:24:29 UTC (rev 6380) @@ -1537,9 +1537,11 @@ for im in self.images if im.get_visible()] #flip the images if their origin is "upper" - if self.images[0].origin=='upper': - im.flipud_out() + for _im, (im,_,_) in zip(self.images, ims): + if _im.origin=="upper": + im.flipud_out() + l, b, r, t = self.bbox.extents width = mag*((round(r) + 0.5) - (round(l) - 0.5)) height = mag*((round(t) + 0.5) - (round(b) - 0.5)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6379 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6379&view=rev Author: jdh2358 Date: 2008年11月09日 00:18:40 +0000 (2008年11月09日) Log Message: ----------- commited jae joons 2nd patch; figimage still sems broken for origin=up Modified Paths: -------------- trunk/matplotlib/examples/pylab_examples/figimage_demo.py trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/figure.py Modified: trunk/matplotlib/examples/pylab_examples/figimage_demo.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/figimage_demo.py 2008年11月09日 00:09:23 UTC (rev 6378) +++ trunk/matplotlib/examples/pylab_examples/figimage_demo.py 2008年11月09日 00:18:40 UTC (rev 6379) @@ -12,9 +12,12 @@ Z.shape = 100,100 Z[:,50:] = 1. -im1 = plt.figimage(Z, xo=50, yo=0, cmap=cm.jet) -im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, cmap=cm.jet) +im1 = plt.figimage(Z, xo=50, yo=0, cmap=cm.jet, origin='upper') +im2 = plt.figimage(Z, xo=100, yo=100, alpha=.8, cmap=cm.jet, origin='upper') +fig.savefig('figimage_demo.png') +fig.savefig('figimage_demo.svg') +fig.savefig('figimage_demo.pdf') plt.show() Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年11月09日 00:09:23 UTC (rev 6378) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年11月09日 00:18:40 UTC (rev 6379) @@ -1537,9 +1537,9 @@ for im in self.images if im.get_visible()] #flip the images if their origin is "upper" - [im.flipud_out() for _im, (im,_,_) in zip(self.images, ims) \ - if _im.origin=="upper"] - + if self.images[0].origin=='upper': + im.flipud_out() + l, b, r, t = self.bbox.extents width = mag*((round(r) + 0.5) - (round(l) - 0.5)) height = mag*((round(t) + 0.5) - (round(b) - 0.5)) Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2008年11月09日 00:09:23 UTC (rev 6378) +++ trunk/matplotlib/lib/matplotlib/figure.py 2008年11月09日 00:18:40 UTC (rev 6379) @@ -752,11 +752,15 @@ mag = renderer.get_image_magnification() ims = [(im.make_image(mag), im.ox*mag, im.oy*mag) for im in self.images] + + for _im, (im,_,_) in zip(self.images, ims): + if _im.origin=="upper": + im.flipud_out() + + im = _image.from_images(self.bbox.height * mag, self.bbox.width * mag, ims) - if self.images[0].origin=='upper': - im.flipud_out() im.is_grayscale = False l, b, w, h = self.bbox.bounds This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6378 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6378&view=rev Author: jdh2358 Date: 2008年11月09日 00:09:23 +0000 (2008年11月09日) Log Message: ----------- added jae joons layer images patch Modified Paths: -------------- trunk/matplotlib/doc/_templates/gallery.html trunk/matplotlib/doc/faq/environment_variables_faq.rst trunk/matplotlib/doc/faq/index.rst trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/mlab.py Modified: trunk/matplotlib/doc/_templates/gallery.html =================================================================== --- trunk/matplotlib/doc/_templates/gallery.html 2008年11月08日 18:41:25 UTC (rev 6377) +++ trunk/matplotlib/doc/_templates/gallery.html 2008年11月09日 00:09:23 UTC (rev 6378) @@ -159,8 +159,6 @@ <a href="examples/pylab_examples/customize_rc.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/customize_rc.png" border="0" alt="customize_rc"/></a> -<a href="examples/pylab_examples/dannys_example.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/dannys_example.png" border="0" alt="dannys_example"/></a> - <a href="examples/pylab_examples/dash_control.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/dash_control.png" border="0" alt="dash_control"/></a> <a href="examples/pylab_examples/dashpointlabel.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/dashpointlabel.png" border="0" alt="dashpointlabel"/></a> @@ -241,8 +239,6 @@ <a href="examples/pylab_examples/ganged_plots.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/ganged_plots.png" border="0" alt="ganged_plots"/></a> -<a href="examples/pylab_examples/geo_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/geo_demo.png" border="0" alt="geo_demo"/></a> - <a href="examples/pylab_examples/gradient_bar.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/gradient_bar.png" border="0" alt="gradient_bar"/></a> <a href="examples/pylab_examples/griddata_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/griddata_demo.png" border="0" alt="griddata_demo"/></a> @@ -457,8 +453,6 @@ <a href="examples/pylab_examples/step_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/step_demo.png" border="0" alt="step_demo"/></a> -<a href="examples/pylab_examples/stix_fonts_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/stix_fonts_demo.png" border="0" alt="stix_fonts_demo"/></a> - <a href="examples/pylab_examples/subplot_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_demo.png" border="0" alt="subplot_demo"/></a> <a href="examples/pylab_examples/subplot_toolbar.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/subplot_toolbar_00.png" border="0" alt="subplot_toolbar"/></a> @@ -467,12 +461,8 @@ <a href="examples/pylab_examples/subplots_adjust.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/subplots_adjust.png" border="0" alt="subplots_adjust"/></a> -<a href="examples/pylab_examples/symlog_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/symlog_demo.png" border="0" alt="symlog_demo"/></a> - <a href="examples/pylab_examples/table_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/table_demo.png" border="0" alt="table_demo"/></a> -<a href="examples/pylab_examples/tex_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/tex_demo.png" border="0" alt="tex_demo"/></a> - <a href="examples/pylab_examples/text_handles.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/text_handles.png" border="0" alt="text_handles"/></a> <a href="examples/pylab_examples/text_rotation.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/text_rotation.png" border="0" alt="text_rotation"/></a> @@ -487,8 +477,6 @@ <a href="examples/pylab_examples/unicode_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/unicode_demo.png" border="0" alt="unicode_demo"/></a> -<a href="examples/pylab_examples/usetex_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/usetex_demo.png" border="0" alt="usetex_demo"/></a> - <a href="examples/pylab_examples/vertical_ticklabels.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/vertical_ticklabels.png" border="0" alt="vertical_ticklabels"/></a> <a href="examples/pylab_examples/vline_demo.html"><img src="_static/plot_directive/mpl_examples/pylab_examples/thumbnails/vline_demo.png" border="0" alt="vline_demo"/></a> Modified: trunk/matplotlib/doc/faq/environment_variables_faq.rst =================================================================== --- trunk/matplotlib/doc/faq/environment_variables_faq.rst 2008年11月08日 18:41:25 UTC (rev 6377) +++ trunk/matplotlib/doc/faq/environment_variables_faq.rst 2008年11月09日 00:09:23 UTC (rev 6378) @@ -1,4 +1,4 @@ -.. _environment-variablesg: +.. _environment-variables: ********************* Environment Variables Modified: trunk/matplotlib/doc/faq/index.rst =================================================================== --- trunk/matplotlib/doc/faq/index.rst 2008年11月08日 18:41:25 UTC (rev 6377) +++ trunk/matplotlib/doc/faq/index.rst 2008年11月09日 00:09:23 UTC (rev 6378) @@ -15,6 +15,6 @@ :maxdepth: 2 installing_faq.rst + usage.rst + howto_faq.rst troubleshooting_faq.rst - howto_faq.rst - environment_variables_faq.rst Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年11月08日 18:41:25 UTC (rev 6377) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年11月09日 00:09:23 UTC (rev 6378) @@ -1536,15 +1536,16 @@ ims = [(im.make_image(mag),0,0) for im in self.images if im.get_visible()] - + #flip the images if their origin is "upper" + [im.flipud_out() for _im, (im,_,_) in zip(self.images, ims) \ + if _im.origin=="upper"] + l, b, r, t = self.bbox.extents width = mag*((round(r) + 0.5) - (round(l) - 0.5)) height = mag*((round(t) + 0.5) - (round(b) - 0.5)) im = mimage.from_images(height, width, ims) - if self.images[0].origin=='upper': - im.flipud_out() im.is_grayscale = False l, b, w, h = self.bbox.bounds Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2008年11月08日 18:41:25 UTC (rev 6377) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2008年11月09日 00:09:23 UTC (rev 6378) @@ -2013,6 +2013,7 @@ output to a new attribute name *outname*. The returned record array is identical to *r*, with extra arrays for each element in *summaryfuncs*. + """ names = list(r.dtype.names) @@ -2569,7 +2570,19 @@ length = max(len(colname),np.max(map(len,map(str,column)))) return 1, length+padding, "%d" # right justify - if ntype==np.float or ntype==np.float32 or ntype==np.float64 or ntype==np.float96 or ntype==np.float_: + # JDH: my powerbook does not have np.float96 using np 1.3.0 + """ + In [2]: np.__version__ + Out[2]: '1.3.0.dev5948' + + In [3]: !uname -a + Darwin Macintosh-5.local 9.4.0 Darwin Kernel Version 9.4.0: Mon Jun 9 19:30:53 PDT 2008; root:xnu-1228年5月20日~1/RELEASE_I386 i386 i386 + + In [4]: np.float96 + --------------------------------------------------------------------------- + AttributeError Traceback (most recent call la + """ + if ntype==np.float or ntype==np.float32 or ntype==np.float64 or (hasattr(np, 'float96') and (ntype==np.float96)) or ntype==np.float_: fmt = "%." + str(precision) + "f" length = max(len(colname),np.max(map(len,map(lambda x:fmt%x,column)))) return 1, length+padding, fmt # right justify This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6377 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6377&view=rev Author: efiring Date: 2008年11月08日 18:41:25 +0000 (2008年11月08日) Log Message: ----------- Fix bugs in unit-handling in axhspan and axvspan Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年11月08日 18:33:01 UTC (rev 6376) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年11月08日 18:41:25 UTC (rev 6377) @@ -2880,7 +2880,7 @@ self.transAxes, self.transData) # process the unit information - self._process_unit_info( [xmin, xmax], [ymin, ymax], **kwargs ) + self._process_unit_info( [xmin, xmax], [ymin, ymax], kwargs=kwargs ) # first we need to strip away the units xmin, xmax = self.convert_xunits( [xmin, xmax] ) @@ -2934,7 +2934,7 @@ self.transData, self.transAxes) # process the unit information - self._process_unit_info( [xmin, xmax], [ymin, ymax], **kwargs ) + self._process_unit_info( [xmin, xmax], [ymin, ymax], kwargs=kwargs ) # first we need to strip away the units xmin, xmax = self.convert_xunits( [xmin, xmax] ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6376 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6376&view=rev Author: efiring Date: 2008年11月08日 18:33:01 +0000 (2008年11月08日) Log Message: ----------- Improve error reporting when pygtk or gtk+ headers are missing. Modified Paths: -------------- trunk/matplotlib/setupext.py Modified: trunk/matplotlib/setupext.py =================================================================== --- trunk/matplotlib/setupext.py 2008年11月08日 17:08:25 UTC (rev 6375) +++ trunk/matplotlib/setupext.py 2008年11月08日 18:33:01 UTC (rev 6376) @@ -235,7 +235,8 @@ def get_pkgconfig(module, packages, flags="--libs --cflags", - pkg_config_exec='pkg-config'): + pkg_config_exec='pkg-config', + report_error=False): """Loosely based on an article in the Python Cookbook: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/502261""" if not has_pkgconfig(): @@ -247,8 +248,8 @@ '-D': 'define_macros', '-U': 'undef_macros'} - status, output = commands.getstatusoutput( - "%s %s %s" % (pkg_config_exec, flags, packages)) + cmd = "%s %s %s" % (pkg_config_exec, flags, packages) + status, output = commands.getstatusoutput(cmd) if status == 0: for token in output.split(): attr = _flags.get(token[:2], None) @@ -266,6 +267,9 @@ if token not in module.extra_link_args: module.extra_link_args.append(token) return True + if report_error: + print_status("pkg-config", "looking for %s" % packages) + print_message(output) return False def get_pkgconfig_version(package): @@ -642,6 +646,7 @@ explanation = ( "Could not find Gtk+ headers in any of %s" % ", ".join(["'%s'" % x for x in module.include_dirs])) + gotit = False def ver2str(tup): return ".".join([str(x) for x in tup]) @@ -718,8 +723,10 @@ if sys.platform != 'win32': # If Gtk+ is installed, pkg-config is required to be installed add_base_flags(module) - get_pkgconfig(module, 'pygtk-2.0 gtk+-2.0') - + ok = get_pkgconfig(module, 'pygtk-2.0 gtk+-2.0', report_error=True) + if not ok: + print_message( + "You may need to install 'dev' package(s) to provide header files.") # visual studio doesn't need the math library if sys.platform == 'win32' and win32_compiler == 'msvc' and 'm' in module.libraries: module.libraries.remove('m') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6375 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6375&view=rev Author: jswhit Date: 2008年11月08日 17:08:25 +0000 (2008年11月08日) Log Message: ----------- add docstring for mmap NetCDFFile keyword. Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008年11月08日 17:02:38 UTC (rev 6374) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008年11月08日 17:08:25 UTC (rev 6375) @@ -3763,6 +3763,9 @@ ``cache`` is a location (a directory) for caching data, so that repeated accesses to the same URL avoid the network. + The keyword ``mmap`` is only valid for local netCDF files. When + ``mmap=True`` (default), the mmap module is used to access the data. + This may be slow for very large netCDF variables. """ import netcdf if file.startswith('http'): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6374 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6374&view=rev Author: jswhit Date: 2008年11月08日 17:02:38 +0000 (2008年11月08日) Log Message: ----------- add mmap keyword to NetCDFFile (as yet undocumented) Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008年11月07日 16:53:31 UTC (rev 6373) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008年11月08日 17:02:38 UTC (rev 6374) @@ -3735,7 +3735,7 @@ else: return corners -def NetCDFFile(file, mode='r', maskandscale=True, cache=None,\ +def NetCDFFile(file, mode='r', maskandscale=True, cache=None, mmap=True,\ username=None, password=None, verbose=False): """NetCDF File reader/writer. API is the same as Scientific.IO.NetCDF. @@ -3769,7 +3769,7 @@ return netcdf._RemoteFile(file,maskandscale=maskandscale,\ cache=cache,username=username,password=password,verbose=verbose) else: - return netcdf.netcdf_file(file,mode=mode,maskandscale=maskandscale) + return netcdf.netcdf_file(file,mode=mode,mmap=mmap,maskandscale=maskandscale) def num2date(times,units='days since 0001年01月01日 00:00:00',calendar='proleptic_gregorian'): """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6373 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6373&view=rev Author: jswhit Date: 2008年11月07日 16:53:31 +0000 (2008年11月07日) Log Message: ----------- update to version 1.0.6 Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pupynere.py Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pupynere.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pupynere.py 2008年11月07日 14:52:04 UTC (rev 6372) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/pupynere.py 2008年11月07日 16:53:31 UTC (rev 6373) @@ -127,9 +127,10 @@ attribute of the ``netcdf_file`` object. """ - def __init__(self, filename, mode='r', maskandscale=False): + def __init__(self, filename, mode='r', mmap=True, maskandscale=False): + self.filename = filename + self.use_mmap = mmap self._maskandscale = maskandscale - self.filename = filename assert mode in 'rw', "Mode must be either 'r' or 'w'." self.mode = mode @@ -202,7 +203,7 @@ def _write_numrecs(self): # Get highest record count from all record variables. for var in self.variables.values(): - if not var._shape[0] and len(var.data) > self._recs: + if var.isrec and len(var.data) > self._recs: self.__dict__['_recs'] = len(var.data) self._pack_int(self._recs) @@ -210,8 +211,9 @@ if self.dimensions: self.fp.write(NC_DIMENSION) self._pack_int(len(self.dimensions)) - for name, length in self.dimensions.items(): + for name in self._dims: self._pack_string(name) + length = self.dimensions[name] self._pack_int(length or 0) # replace None with 0 for record dimension else: self.fp.write(ABSENT) @@ -236,7 +238,7 @@ # Sort variables non-recs first, then recs. variables = self.variables.items() - variables.sort(key=lambda (k, v): v._shape and v._shape[0] is not None) + variables.sort(key=lambda (k, v): v._shape and not v.isrec) variables.reverse() variables = [k for (k, v) in variables] @@ -247,7 +249,7 @@ # each record variable, so we can calculate recsize. self.__dict__['_recsize'] = sum([ var._vsize for var in self.variables.values() - if var._shape[0] is None]) + if var.isrec]) # Set the data for all variables. for name in variables: self._write_var_data(name) @@ -268,13 +270,16 @@ nc_type = REVERSE[var.typecode()] self.fp.write(nc_type) - if var._shape[0]: + if not var.isrec: vsize = var.data.size * var.data.itemsize vsize += -vsize % 4 else: # record variable - vsize = var.data[0].size * var.data.itemsize + try: + vsize = var.data[0].size * var.data.itemsize + except IndexError: + vsize = 0 rec_vars = len([var for var in self.variables.values() - if var._shape[0] is None]) + if var.isrec]) if rec_vars > 1: vsize += -vsize % 4 self.variables[name].__dict__['_vsize'] = vsize @@ -294,7 +299,7 @@ self.fp.seek(the_beguine) # Write data. - if var._shape[0]: + if not var.isrec: self.fp.write(var.data.tostring()) count = var.data.size * var.data.itemsize self.fp.write('0' * (var._vsize - count)) @@ -405,9 +410,16 @@ # Data will be set later. data = None else: - mm = mmap(self.fp.fileno(), begin_+vsize, access=ACCESS_READ) - data = ndarray.__new__(ndarray, shape, dtype=dtype_, - buffer=mm, offset=begin_, order=0) + if self.use_mmap: + mm = mmap(self.fp.fileno(), begin_+vsize, access=ACCESS_READ) + data = ndarray.__new__(ndarray, shape, dtype=dtype_, + buffer=mm, offset=begin_, order=0) + else: + pos = self.fp.tell() + self.fp.seek(begin_) + data = fromstring(self.fp.read(vsize), dtype=dtype_) + data.shape = shape + self.fp.seek(pos) # Add variable. self.variables[name] = netcdf_variable( @@ -420,9 +432,16 @@ dtypes['formats'] = dtypes['formats'][:1] # Build rec array. - mm = mmap(self.fp.fileno(), begin+self._recs*self._recsize, access=ACCESS_READ) - rec_array = ndarray.__new__(ndarray, (self._recs,), dtype=dtypes, - buffer=mm, offset=begin, order=0) + if self.use_mmap: + mm = mmap(self.fp.fileno(), begin+self._recs*self._recsize, access=ACCESS_READ) + rec_array = ndarray.__new__(ndarray, (self._recs,), dtype=dtypes, + buffer=mm, offset=begin, order=0) + else: + pos = self.fp.tell() + self.fp.seek(begin) + rec_array = fromstring(self.fp.read(self._recs*self._recsize), dtype=dtypes) + rec_array.shape = (self._recs,) + self.fp.seek(pos) for var in rec_vars: self.variables[var].__dict__['data'] = rec_array[var] @@ -546,6 +565,10 @@ self.__dict__[attr] = value @property + def isrec(self): + return self.data.shape and not self._shape[0] + + @property def shape(self): return self.data.shape @@ -569,7 +592,7 @@ if self._maskandscale: data = _maskandscale(self,data) # Expand data for record vars? - if not self._shape[0]: + if self.isrec: if isinstance(index, tuple): rec_index = index[0] else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6372 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6372&view=rev Author: mdboom Date: 2008年11月07日 14:52:04 +0000 (2008年11月07日) Log Message: ----------- Committed Andrew Straw's patch to support hyperlinks. Currently only the SVG backend, but the infrastructure is there for other backends to support it. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/artist.py trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/backend_bases.py trunk/matplotlib/lib/matplotlib/backends/backend_ps.py trunk/matplotlib/lib/matplotlib/backends/backend_svg.py trunk/matplotlib/lib/matplotlib/collections.py trunk/matplotlib/lib/matplotlib/image.py trunk/matplotlib/lib/matplotlib/patches.py trunk/matplotlib/lib/matplotlib/text.py trunk/matplotlib/src/_backend_agg.cpp Added Paths: ----------- trunk/matplotlib/examples/pylab_examples/hyperlinks.py Added: trunk/matplotlib/examples/pylab_examples/hyperlinks.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/hyperlinks.py (rev 0) +++ trunk/matplotlib/examples/pylab_examples/hyperlinks.py 2008年11月07日 14:52:04 UTC (rev 6372) @@ -0,0 +1,33 @@ +#!/usr/bin/env python +# -*- noplot -*- + +""" +This example demonstrates how to set a hyperlinks on various kinds of elements. + +This currently only works with the SVG backend. +""" + +import numpy as np +import matplotlib.cm as cm +import matplotlib.mlab as mlab +import matplotlib.pyplot as plt + +f = plt.figure() +s = plt.scatter([1,2,3],[4,5,6]) +s.set_urls(['http://www.bbc.co.uk/news','http://www.google.com',None]) +f.canvas.print_figure('scatter.svg') + +f = plt.figure() +delta = 0.025 +x = y = np.arange(-3.0, 3.0, delta) +X, Y = np.meshgrid(x, y) +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 = Z2-Z1 # difference of Gaussians + +im = plt.imshow(Z, interpolation='bilinear', cmap=cm.gray, + origin='lower', extent=[-3,3,-3,3]) + +im.set_url('http://www.google.com') +f.canvas.print_figure('image.svg') + Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2008年11月07日 13:31:25 UTC (rev 6371) +++ trunk/matplotlib/lib/matplotlib/artist.py 2008年11月07日 14:52:04 UTC (rev 6372) @@ -50,6 +50,7 @@ self._propobservers = {} # a dict from oids to funcs self.axes = None self._remove_method = None + self._url = None def remove(self): """ @@ -313,6 +314,18 @@ """ return self.figure is not None + def get_url(self): + """ + Returns the url + """ + return self._url + + def set_url(self, url): + """ + Sets the url for the artist + """ + self._url = url + def get_figure(self): """ Return the :class:`~matplotlib.figure.Figure` instance the Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年11月07日 13:31:25 UTC (rev 6371) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年11月07日 14:52:04 UTC (rev 6372) @@ -5480,7 +5480,7 @@ def imshow(self, X, cmap=None, norm=None, aspect=None, interpolation=None, alpha=1.0, vmin=None, vmax=None, origin=None, extent=None, shape=None, filternorm=1, - filterrad=4.0, imlim=None, resample=None, **kwargs): + filterrad=4.0, imlim=None, resample=None, url=None, **kwargs): """ call signature:: @@ -5601,6 +5601,7 @@ im.set_clim(vmin, vmax) else: im.autoscale_None() + im.set_url(url) xmin, xmax, ymin, ymax = im.get_extent() Modified: trunk/matplotlib/lib/matplotlib/backend_bases.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backend_bases.py 2008年11月07日 13:31:25 UTC (rev 6371) +++ trunk/matplotlib/lib/matplotlib/backend_bases.py 2008年11月07日 14:52:04 UTC (rev 6372) @@ -107,7 +107,7 @@ def draw_path_collection(self, master_transform, cliprect, clippath, clippath_trans, paths, all_transforms, offsets, offsetTrans, facecolors, edgecolors, linewidths, - linestyles, antialiaseds): + linestyles, antialiaseds, urls): """ Draws a collection of paths, selecting drawing properties from the lists *facecolors*, *edgecolors*, *linewidths*, @@ -136,7 +136,7 @@ for xo, yo, path_id, gc, rgbFace in self._iter_collection( path_ids, cliprect, clippath, clippath_trans, offsets, offsetTrans, facecolors, edgecolors, - linewidths, linestyles, antialiaseds): + linewidths, linestyles, antialiaseds, urls): path, transform = path_id transform = transforms.Affine2D(transform.get_matrix()).translate(xo, yo) self.draw_path(gc, path, transform, rgbFace) @@ -164,7 +164,7 @@ return self.draw_path_collection( master_transform, cliprect, clippath, clippath_trans, paths, [], offsets, offsetTrans, facecolors, edgecolors, - linewidths, [], [antialiased]) + linewidths, [], [antialiased], [None]) def _iter_collection_raw_paths(self, master_transform, paths, all_transforms): """ @@ -198,7 +198,7 @@ def _iter_collection(self, path_ids, cliprect, clippath, clippath_trans, offsets, offsetTrans, facecolors, edgecolors, - linewidths, linestyles, antialiaseds): + linewidths, linestyles, antialiaseds, urls): """ This is a helper method (along with :meth:`_iter_collection_raw_paths`) to make it easier to write @@ -232,6 +232,7 @@ Nlinewidths = len(linewidths) Nlinestyles = len(linestyles) Naa = len(antialiaseds) + Nurls = len(urls) if (Nfacecolors == 0 and Nedgecolors == 0) or Npaths == 0: return @@ -268,6 +269,9 @@ gc.set_alpha(rgbFace[-1]) rgbFace = rgbFace[:3] gc.set_antialiased(antialiaseds[i % Naa]) + + if Nurls: + gc.set_url(urls[i % Nurls]) yield xo, yo, path_id, gc, rgbFace @@ -433,6 +437,7 @@ self._linewidth = 1 self._rgb = (0.0, 0.0, 0.0) self._hatch = None + self._url = None def copy_properties(self, gc): 'Copy properties from gc to self' @@ -447,6 +452,7 @@ self._linewidth = gc._linewidth self._rgb = gc._rgb self._hatch = gc._hatch + self._url = gc._url def get_alpha(self): """ @@ -521,6 +527,12 @@ matlab format string, a html hex color string, or a rgb tuple """ return self._rgb + + def get_url(self): + """ + returns a url if one is set, None otherwise + """ + return self._url def set_alpha(self, alpha): """ @@ -621,6 +633,12 @@ raise ValueError('Unrecognized linestyle: %s' % style) self._linestyle = style self.set_dashes(offset, dashes) + + def set_url(self, url): + """ + Sets the url for links in compatible backends + """ + self._url = url def set_hatch(self, hatch): """ Modified: trunk/matplotlib/lib/matplotlib/backends/backend_ps.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年11月07日 13:31:25 UTC (rev 6371) +++ trunk/matplotlib/lib/matplotlib/backends/backend_ps.py 2008年11月07日 14:52:04 UTC (rev 6372) @@ -531,7 +531,7 @@ def draw_path_collection(self, master_transform, cliprect, clippath, clippath_trans, paths, all_transforms, offsets, offsetTrans, facecolors, edgecolors, linewidths, - linestyles, antialiaseds): + linestyles, antialiaseds, urls): write = self._pswriter.write path_codes = [] @@ -548,7 +548,7 @@ for xo, yo, path_id, gc, rgbFace in self._iter_collection( path_codes, cliprect, clippath, clippath_trans, offsets, offsetTrans, facecolors, edgecolors, - linewidths, linestyles, antialiaseds): + linewidths, linestyles, antialiaseds, urls): ps = "%g %g %s" % (xo, yo, path_id) self._draw_ps(ps, gc, rgbFace) Modified: trunk/matplotlib/lib/matplotlib/backends/backend_svg.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2008年11月07日 13:31:25 UTC (rev 6371) +++ trunk/matplotlib/lib/matplotlib/backends/backend_svg.py 2008年11月07日 14:52:04 UTC (rev 6372) @@ -67,9 +67,13 @@ else: clippath = 'clip-path="url(#%s)"' % clipid + if gc.get_url() is not None: + self._svgwriter.write('<a xlink:href="%s">' % gc.get_url()) style = self._get_style(gc, rgbFace) self._svgwriter.write ('<%s style="%s" %s %s/>\n' % ( element, style, clippath, details)) + if gc.get_url() is not None: + self._svgwriter.write('</a>') def _get_font(self, prop): key = hash(prop) @@ -224,7 +228,7 @@ def draw_path_collection(self, master_transform, cliprect, clippath, clippath_trans, paths, all_transforms, offsets, offsetTrans, facecolors, edgecolors, linewidths, - linestyles, antialiaseds): + linestyles, antialiaseds, urls): write = self._svgwriter.write path_codes = [] @@ -242,8 +246,11 @@ for xo, yo, path_id, gc, rgbFace in self._iter_collection( path_codes, cliprect, clippath, clippath_trans, offsets, offsetTrans, facecolors, edgecolors, - linewidths, linestyles, antialiaseds): + linewidths, linestyles, antialiaseds, urls): clipid = self._get_gc_clip_svg(gc) + url = gc.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) @@ -251,6 +258,8 @@ self._svgwriter.write ('<use style="%s" %s/>\n' % (style, details)) if clipid is not None: write('</g>') + if url is not None: + self._svgwriter.write('</a>') self._path_collection_id += 1 @@ -274,6 +283,9 @@ h,w = im.get_size_out() + url = getattr(im, '_url', None) + if url is not None: + self._svgwriter.write('<a xlink:href="%s">' % url) self._svgwriter.write ( '<image x="%f" y="%f" width="%f" height="%f" ' '%s xlink:href="'%(x/trans[0], (self.height-y)/trans[3]-h, w, h, transstr) @@ -298,6 +310,8 @@ self._svgwriter.write(filename) self._svgwriter.write('"/>\n') + if url is not None: + self._svgwriter.write('</a>') def draw_text(self, gc, x, y, s, prop, angle, ismath): if ismath: Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2008年11月07日 13:31:25 UTC (rev 6371) +++ trunk/matplotlib/lib/matplotlib/collections.py 2008年11月07日 14:52:04 UTC (rev 6372) @@ -71,6 +71,7 @@ norm = None, # optional for ScalarMappable cmap = None, # ditto pickradius = 5.0, + urls = None, **kwargs ): """ @@ -86,6 +87,7 @@ self.set_linewidth(linewidths) self.set_linestyle(linestyles) self.set_antialiased(antialiaseds) + self.set_urls(urls) self._uniform_offsets = None self._offsets = np.array([], np.float_) @@ -203,7 +205,7 @@ paths, self.get_transforms(), offsets, transOffset, self.get_facecolor(), self.get_edgecolor(), self._linewidths, - self._linestyles, self._antialiaseds) + self._linestyles, self._antialiaseds, self._urls) renderer.close_group(self.__class__.__name__) def contains(self, mouseevent): @@ -227,6 +229,14 @@ def set_pickradius(self,pickradius): self.pickradius = 5 def get_pickradius(self): return self.pickradius + def set_urls(self, urls): + if urls is None: + self._urls = [None,] + else: + self._urls = urls + + def get_urls(self): return self._urls + def set_offsets(self, offsets): """ Set the offsets for the collection. *offsets* can be a scalar Modified: trunk/matplotlib/lib/matplotlib/image.py =================================================================== --- trunk/matplotlib/lib/matplotlib/image.py 2008年11月07日 13:31:25 UTC (rev 6371) +++ trunk/matplotlib/lib/matplotlib/image.py 2008年11月07日 14:52:04 UTC (rev 6372) @@ -88,13 +88,10 @@ self.set_filterrad(filterrad) self._filterrad = filterrad - - self.set_interpolation(interpolation) self.set_resample(resample) self.axes = ax - self._imcache = None self.update(kwargs) @@ -234,9 +231,11 @@ self.axes.get_yscale() != 'linear'): warnings.warn("Images are not supported on non-linear axes.") 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(), - *self.get_transformed_clip_path_and_affine()) + clippath, affine) def contains(self, mouseevent): """Test whether the mouse event occured within the image. Modified: trunk/matplotlib/lib/matplotlib/patches.py =================================================================== --- trunk/matplotlib/lib/matplotlib/patches.py 2008年11月07日 13:31:25 UTC (rev 6371) +++ trunk/matplotlib/lib/matplotlib/patches.py 2008年11月07日 14:52:04 UTC (rev 6372) @@ -278,6 +278,7 @@ gc.set_antialiased(self._antialiased) self._set_gc_clip(gc) gc.set_capstyle('projecting') + gc.set_url(self._url) if (not self.fill or self._facecolor is None or (cbook.is_string_like(self._facecolor) and self._facecolor.lower()=='none')): Modified: trunk/matplotlib/lib/matplotlib/text.py =================================================================== --- trunk/matplotlib/lib/matplotlib/text.py 2008年11月07日 13:31:25 UTC (rev 6371) +++ trunk/matplotlib/lib/matplotlib/text.py 2008年11月07日 14:52:04 UTC (rev 6372) @@ -464,6 +464,7 @@ gc = renderer.new_gc() gc.set_foreground(self._color) gc.set_alpha(self._alpha) + gc.set_url(self._url) if self.get_clip_on(): gc.set_clip_rectangle(self.clipbox) Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008年11月07日 13:31:25 UTC (rev 6371) +++ trunk/matplotlib/src/_backend_agg.cpp 2008年11月07日 14:52:04 UTC (rev 6372) @@ -1154,7 +1154,7 @@ Py::Object RendererAgg::draw_path_collection(const Py::Tuple& args) { _VERBOSE("RendererAgg::draw_path_collection"); - args.verify_length(13); + args.verify_length(14); //segments, trans, clipbox, colors, linewidths, antialiaseds agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0]); @@ -1170,7 +1170,8 @@ Py::SeqBase<Py::Float> linewidths = args[10]; Py::SeqBase<Py::Object> linestyles_obj = args[11]; Py::SeqBase<Py::Int> antialiaseds = args[12]; - + // We don't actually care about urls for Agg, so just ignore it. + // Py::SeqBase<Py::Object> urls = args[13]; PathListGenerator path_generator(paths); try { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6371 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6371&view=rev Author: mdboom Date: 2008年11月07日 13:31:25 +0000 (2008年11月07日) Log Message: ----------- Minor docstring fix. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/artist.py Modified: trunk/matplotlib/lib/matplotlib/artist.py =================================================================== --- trunk/matplotlib/lib/matplotlib/artist.py 2008年11月07日 12:36:37 UTC (rev 6370) +++ trunk/matplotlib/lib/matplotlib/artist.py 2008年11月07日 13:31:25 UTC (rev 6371) @@ -569,8 +569,8 @@ pyplot signature: findobj(o=gcf(), match=None) - recursively find all :class:matplotlib.artist.Artist instances - contained in self + Recursively find all :class:matplotlib.artist.Artist instances + contained in self. *match* can be @@ -812,16 +812,16 @@ def findobj(self, match=None): """ - recursively find all :class:matplotlib.artist.Artist instances - contained in self + Recursively find all :class:`matplotlib.artist.Artist` + instances contained in *self*. - if *match* is not None, it can be + If *match* is not None, it can be - function with signature ``boolean = match(artist)`` - - class instance: eg Line2D + - class instance: eg :class:`~matplotlib.lines.Line2D` - used to filter matches + used to filter matches. """ if match is None: # always return True @@ -861,7 +861,6 @@ getp(o) # get all the object properties getp(o, 'linestyle') # get the linestyle property - *o* is a :class:`Artist` instance, eg :class:`~matplotllib.lines.Line2D` or an instance of a :class:`~matplotlib.axes.Axes` or :class:`matplotlib.text.Text`. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6370 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6370&view=rev Author: jswhit Date: 2008年11月07日 12:36:37 +0000 (2008年11月07日) Log Message: ----------- Added masked array support to shiftgrid, fix cut and paste error in previous commit. Patch provided by Jesper Larsen. Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008年11月07日 12:30:08 UTC (rev 6369) +++ trunk/toolkits/basemap/Changelog 2008年11月07日 12:36:37 UTC (rev 6370) @@ -1,4 +1,6 @@ version 0.99.2 (not yet released) + * Added masked array support to shiftgrid function + (thanks to Jesper Larsen). * defer import of netcdf stuff till it is needed (in NetCDFFile function). * Added McBryde-Thomas Flat Polar Quartic (projection = Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008年11月07日 12:30:08 UTC (rev 6369) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008年11月07日 12:36:37 UTC (rev 6370) @@ -3680,13 +3680,13 @@ raise ValueError, 'lon0 outside of range of lonsin' i0 = np.argmin(np.fabs(lonsin-lon0)) if hasattr(datain,'mask'): - datout = ma.zeros((nlats,nlons+1),datain.dtype) + dataout = ma.zeros(datain.shape,datain.dtype) else: - datout = np.zeros((nlats,nlons+1),datain.dtype) + dataout = np.zeros(datain.shape,datain.dtype) if hasattr(lonsin,'mask'): - lonsout = ma.zeros(nlons+1,lonsin.dtype) + lonsout = ma.zeros(lonsin.shape,lonsin.dtype) else: - lonsout = np.zeros(nlons+1,lonsin.dtype) + lonsout = np.zeros(lonsin.shape,lonsin.dtype) if start: lonsout[0:len(lonsin)-i0] = lonsin[i0:] else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6369 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6369&view=rev Author: jswhit Date: 2008年11月07日 12:30:08 +0000 (2008年11月07日) Log Message: ----------- added masked array support to addcyclic function (thanks to Jesper Larsen) Modified Paths: -------------- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py Modified: trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py =================================================================== --- trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008年11月06日 22:53:02 UTC (rev 6368) +++ trunk/toolkits/basemap/lib/mpl_toolkits/basemap/__init__.py 2008年11月07日 12:30:08 UTC (rev 6369) @@ -3679,8 +3679,14 @@ if lon0 < lonsin[0] or lon0 > lonsin[-1]: raise ValueError, 'lon0 outside of range of lonsin' i0 = np.argmin(np.fabs(lonsin-lon0)) - dataout = np.zeros(datain.shape,datain.dtype) - lonsout = np.zeros(lonsin.shape,lonsin.dtype) + if hasattr(datain,'mask'): + datout = ma.zeros((nlats,nlons+1),datain.dtype) + else: + datout = np.zeros((nlats,nlons+1),datain.dtype) + if hasattr(lonsin,'mask'): + lonsout = ma.zeros(nlons+1,lonsin.dtype) + else: + lonsout = np.zeros(nlons+1,lonsin.dtype) if start: lonsout[0:len(lonsin)-i0] = lonsin[i0:] else: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6368 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6368&view=rev Author: ryanmay Date: 2008年11月06日 22:53:02 +0000 (2008年11月06日) Log Message: ----------- Improve the docstrings for mlab.psd and mlab.csd. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mlab.py Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2008年11月05日 17:12:03 UTC (rev 6367) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2008年11月06日 22:53:02 UTC (rev 6368) @@ -238,39 +238,52 @@ a = y.mean() - b*x.mean() return y - (b*x + a) - - def psd(x, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning, noverlap=0): """ - The power spectral density by Welches average periodogram method. - The vector x is divided into NFFT length segments. Each segment - is detrended by function detrend and windowed by function window. - noperlap gives the length of the overlap between segments. The - absolute(fft(segment))**2 of each segment are averaged to compute Pxx, - with a scaling to correct for power loss due to windowing. + The power spectral density by Welch's average periodogram method. + The vector *x* is divided into *NFFT* length blocks. Each block + is detrended by the function *detrend* and windowed by the function + *window*. *noverlap* gives the length of the overlap between blocks. + The absolute(fft(block))**2 of each segment are averaged to compute + *Pxx*, with a scaling to correct for power loss due to windowing. - Fs is the sampling frequency (samples per time unit). It is used - to calculate the Fourier frequencies, freqs, in cycles per time - unit. + If len(*x*) < *NFFT*, it will be zero padded to *NFFT*. + *x* + Array or sequence containing the data + *NFFT* - The length of the FFT window. Must be even; a power 2 is most efficient. + The number of data points used in each block for the FFT. + Must be even; a power 2 is most efficient. The default value is 256. + *Fs* + The sampling frequency (samples per time unit). It is used + to calculate the Fourier frequencies, freqs, in cycles per time + unit. The default value is 2. + *detrend* - is a function, unlike in matlab where it is a vector. + Any callable function (unlike in matlab where it is a vector). + For examples, see :func:`detrend`, :func:`detrend_none`, and + :func:`detrend_mean`. The default is :func:`detrend_none`. *window* - can be a function or a vector of length NFFT. To create window - vectors see numpy.blackman, numpy.hamming, numpy.bartlett, - scipy.signal, scipy.signal.get_window etc. + A function or a vector of length *NFFT*. To create window + vectors see :func:`window_hanning`, :func:`window_none`, + :func:`numpy.blackman`, :func:`numpy.hamming`, + :func:`numpy.bartlett`, :func:`scipy.signal`, + :func:`scipy.signal.get_window`, etc. The default is + :func:`window_hanning`. - If len(*x*) < *NFFT*, it will be zero padded to *NFFT*. + *noverlap* + The number of points of overlap between blocks. The default value + is 0 (no overlap). Returns the tuple (*Pxx*, *freqs*). - Refs: Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986) - + Refs: + Bendat & Piersol -- Random Data: Analysis and Measurement + Procedures, John Wiley & Sons (1986) """ # I think we could remove this condition without hurting anything. if NFFT % 2: @@ -317,26 +330,50 @@ def csd(x, y, NFFT=256, Fs=2, detrend=detrend_none, window=window_hanning, noverlap=0): """ - The cross spectral density Pxy by Welches average periodogram + The cross power spectral density by Welch's average periodogram method. The vectors *x* and *y* are divided into *NFFT* length - segments. Each segment is detrended by function *detrend* and - windowed by function *window*. *noverlap* gives the length of the - overlap between segments. The product of the direct FFTs of *x* - and *y* are averaged over each segment to compute *Pxy*, with a - scaling to correct for power loss due to windowing. *Fs* is the - sampling frequency. + blocks. Each block is detrended by the function *detrend* and + windowed by the function *window*. *noverlap* gives the length + of the overlap between blocks. The product of the direct FFTs + of *x* and *y* are averaged over each segment to compute *Pxy*, + with a scaling to correct for power loss due to windowing. - *NFFT* must be even; a power of 2 is most efficient + If len(*x*) < *NFFT* or len(*y*) < *NFFT*, they will be zero + padded to *NFFT*. - *window* can be a function or a vector of length *NFFT*. To create - window vectors see :func:`numpy.blackman`, :func:`numpy.hamming`, - :func:`numpy.bartlett`, :func:`scipy.signal`, - :func:`scipy.signal.get_window` etc. + *x*, *y* + Array or sequence containing the data - Returns the tuple (*Pxy*, *freqs*) + *NFFT* + The number of data points used in each block for the FFT. + Must be even; a power 2 is most efficient. The default value is 256. + *Fs* + The sampling frequency (samples per time unit). It is used + to calculate the Fourier frequencies, freqs, in cycles per time + unit. The default value is 2. + + *detrend* + Any callable function (unlike in matlab where it is a vector). + For examples, see :func:`detrend`, :func:`detrend_none`, and + :func:`detrend_mean`. The default is :func:`detrend_none`. + + *window* + A function or a vector of length *NFFT*. To create window + vectors see :func:`window_hanning`, :func:`window_none`, + :func:`numpy.blackman`, :func:`numpy.hamming`, + :func:`numpy.bartlett`, :func:`scipy.signal`, + :func:`scipy.signal.get_window`, etc. The default is + :func:`window_hanning`. + + *noverlap* + The number of points of overlap between blocks. The default value + is 0 (no overlap). + + Returns the tuple (*Pxy*, *freqs*). + Refs: - Bendat & Piersol -- Random Data: Analysis and Measurement + Bendat & Piersol -- Random Data: Analysis and Measurement Procedures, John Wiley & Sons (1986) """ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6367 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6367&view=rev Author: ryanmay Date: 2008年11月05日 17:12:03 +0000 (2008年11月05日) Log Message: ----------- Revert the DraggableRectangle exercise solution to use the Rectangle.xy attribute now that it exists. This agrees with the exercise description. Modified Paths: -------------- trunk/matplotlib/doc/users/event_handling.rst Modified: trunk/matplotlib/doc/users/event_handling.rst =================================================================== --- trunk/matplotlib/doc/users/event_handling.rst 2008年11月05日 17:09:55 UTC (rev 6366) +++ trunk/matplotlib/doc/users/event_handling.rst 2008年11月05日 17:12:03 UTC (rev 6367) @@ -182,8 +182,8 @@ contains, attrd = self.rect.contains(event) if not contains: return - x0, y0 = self.rect.get_x(), self.rect.get_y() - print 'event contains', x0, y0 + print 'event contains', self.rect.xy + x0, y0 = self.rect.xy self.press = x0, y0, event.xdata, event.ydata def on_motion(self, event): @@ -257,8 +257,8 @@ if DraggableRectangle.lock is not None: return contains, attrd = self.rect.contains(event) if not contains: return - x0, y0 = self.rect.get_x(), self.rect.get_y() - print 'event contains', x0, y0 + print 'event contains', self.rect.xy + x0, y0 = self.rect.xy self.press = x0, y0, event.xdata, event.ydata DraggableRectangle.lock = self This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6366 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6366&view=rev Author: ryanmay Date: 2008年11月05日 17:09:55 +0000 (2008年11月05日) Log Message: ----------- Re-add the xy attribute to the Rectangle class (disappeared during the transforms refactor). Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/patches.py Modified: trunk/matplotlib/lib/matplotlib/patches.py =================================================================== --- trunk/matplotlib/lib/matplotlib/patches.py 2008年11月05日 15:15:28 UTC (rev 6365) +++ trunk/matplotlib/lib/matplotlib/patches.py 2008年11月05日 17:09:55 UTC (rev 6366) @@ -478,6 +478,10 @@ "Return the bottom coord of the rectangle" return self._y + def get_xy(self): + "Return the left and bottom coords of the rectangle" + return self._x, self._y + def get_width(self): "Return the width of the rectangle" return self._width @@ -502,6 +506,14 @@ """ self._y = y + def set_xy(self, xy): + """ + Set the left and bottom coords of the rectangle + + ACCEPTS: 2-item sequence + """ + self._x, self._y = xy + def set_width(self, w): """ Set the width rectangle @@ -536,6 +548,8 @@ def get_bbox(self): return transforms.Bbox.from_bounds(self._x, self._y, self._width, self._height) + xy = property(get_xy, set_xy) + class RegularPolygon(Patch): """ A regular polygon patch. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6365 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6365&view=rev Author: mdboom Date: 2008年11月05日 15:15:28 +0000 (2008年11月05日) Log Message: ----------- Fix bug in zoom rectangle with twin axes Modified Paths: -------------- branches/v0_91_maint/CHANGELOG branches/v0_91_maint/lib/matplotlib/backend_bases.py Modified: branches/v0_91_maint/CHANGELOG =================================================================== --- branches/v0_91_maint/CHANGELOG 2008年11月05日 15:15:10 UTC (rev 6364) +++ branches/v0_91_maint/CHANGELOG 2008年11月05日 15:15:28 UTC (rev 6365) @@ -1,3 +1,5 @@ +2008年11月05日 Fix bug with zoom to rectangle and twin axes - MGD + 2008年10月05日 Fix problem with AFM files that don't specify the font's full name or family name. - JKS Modified: branches/v0_91_maint/lib/matplotlib/backend_bases.py =================================================================== --- branches/v0_91_maint/lib/matplotlib/backend_bases.py 2008年11月05日 15:15:10 UTC (rev 6364) +++ branches/v0_91_maint/lib/matplotlib/backend_bases.py 2008年11月05日 15:15:28 UTC (rev 6365) @@ -903,7 +903,7 @@ # can't delete the artist while h: print "Removing",h - if h.remove(): + if h.remove(): self.draw_idle() break parent = None @@ -912,7 +912,7 @@ parent = p break h = parent - + def onHilite(self, ev): """ Mouse event processor which highlights the artists @@ -1087,7 +1087,7 @@ # a) otherwise we'd have cyclical imports, since all of these # classes inherit from FigureCanvasBase # b) so we don't import a bunch of stuff the user may never use - + def print_emf(self, *args, **kwargs): from backends.backend_emf import FigureCanvasEMF # lazy import emf = self.switch_backends(FigureCanvasEMF) @@ -1097,7 +1097,7 @@ from backends.backend_ps import FigureCanvasPS # lazy import ps = self.switch_backends(FigureCanvasPS) return ps.print_eps(*args, **kwargs) - + def print_pdf(self, *args, **kwargs): from backends.backend_pdf import FigureCanvasPdf # lazy import pdf = self.switch_backends(FigureCanvasPdf) @@ -1107,7 +1107,7 @@ from backends.backend_agg import FigureCanvasAgg # lazy import agg = self.switch_backends(FigureCanvasAgg) return agg.print_png(*args, **kwargs) - + def print_ps(self, *args, **kwargs): from backends.backend_ps import FigureCanvasPS # lazy import ps = self.switch_backends(FigureCanvasPS) @@ -1123,12 +1123,12 @@ from backends.backend_svg import FigureCanvasSVG # lazy import svg = self.switch_backends(FigureCanvasSVG) return svg.print_svg(*args, **kwargs) - + def print_svgz(self, *args, **kwargs): from backends.backend_svg import FigureCanvasSVG # lazy import svg = self.switch_backends(FigureCanvasSVG) return svg.print_svgz(*args, **kwargs) - + def get_supported_filetypes(self): return self.filetypes @@ -1138,7 +1138,7 @@ groupings.setdefault(name, []).append(ext) groupings[name].sort() return groupings - + def print_figure(self, filename, dpi=None, facecolor='w', edgecolor='w', orientation='portrait', format=None, **kwargs): """ @@ -1176,7 +1176,7 @@ if dpi is None: dpi = rcParams['savefig.dpi'] - + origDPI = self.figure.dpi.get() origfacecolor = self.figure.get_facecolor() origedgecolor = self.figure.get_edgecolor() @@ -1199,12 +1199,12 @@ self.figure.set_edgecolor(origedgecolor) self.figure.set_canvas(self) self.figure.canvas.draw() - + return result def get_default_filetype(self): raise NotImplementedError - + def set_window_title(self, title): """ Set the title text of the window containing the figure. Note that @@ -1696,6 +1696,8 @@ for cur_xypress in self._xypress: x, y = event.x, event.y lastx, lasty, a, ind, lim, trans = cur_xypress + if a._sharex or a._sharey: + continue # ignore singular clicks - 5 pixels is a threshold if abs(x-lastx)<5 or abs(y-lasty)<5: self._xypress = None This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6364 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6364&view=rev Author: mdboom Date: 2008年11月05日 15:15:10 +0000 (2008年11月05日) Log Message: ----------- Minor docstring fix. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/axes.py Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2008年11月05日 14:43:29 UTC (rev 6363) +++ trunk/matplotlib/lib/matplotlib/axes.py 2008年11月05日 15:15:10 UTC (rev 6364) @@ -6931,23 +6931,23 @@ class SubplotBase: """ - Base class for subplots, which are Axes instances with additional - methods to facilitate generating and manipulating a set of Axes - within a figure. + Base class for subplots, which are :class:`Axes` instances with + additional methods to facilitate generating and manipulating a set + of :class:`Axes` within a figure. """ def __init__(self, fig, *args, **kwargs): """ - fig is a figure instance + *fig* is a :class:`matplotlib.figure.Figure` instance. - args is numRows, numCols, plotNum - where the array of subplots in the figure has dimensions - numRows, numCols, and where plotNum is the number of the - subplot being created. plotNum starts at 1 in the upper - right corner and increases to the right. + *args* is the tuple (*numRows*, *numCols*, *plotNum*), where + the array of subplots in the figure has dimensions *numRows*, + *numCols*, and where *plotNum* is the number of the subplot + being created. *plotNum* starts at 1 in the upper right + corner and increases to the right. - If numRows<=numCols<=plotNum<10, args can be the decimal - integer numRows*100 + numCols*10 + plotNum. + If *numRows* <= *numCols* <= *plotNum* < 10, *args* can be the + decimal integer *numRows* * 100 + *numCols* * 10 + *plotNum*. """ self.figure = fig @@ -6982,7 +6982,7 @@ # COVERAGE NOTE: Never used internally or from examples def change_geometry(self, numrows, numcols, num): - 'change subplot geometry, eg from 1,1,1 to 2,2,3' + 'change subplot geometry, eg. from 1,1,1 to 2,2,3' self._rows = numrows self._cols = numcols self._num = num-1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6363 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6363&view=rev Author: dmkaplan Date: 2008年11月05日 14:43:29 +0000 (2008年11月05日) Log Message: ----------- Adding a small script that demonstrates the utility of transform_angles method added in last commit (from dmkaplan). Added Paths: ----------- trunk/matplotlib/examples/pylab_examples/text_rotation_relative_to_line.py Added: trunk/matplotlib/examples/pylab_examples/text_rotation_relative_to_line.py =================================================================== --- trunk/matplotlib/examples/pylab_examples/text_rotation_relative_to_line.py (rev 0) +++ trunk/matplotlib/examples/pylab_examples/text_rotation_relative_to_line.py 2008年11月05日 14:43:29 UTC (rev 6363) @@ -0,0 +1,36 @@ +#!/usr/bin/env python +""" +Text objects in matplotlib are normally rotated with respect to the +screen coordinate system (i.e., 45 degrees rotation plots text along a +line that is inbetween horizontal and vertical no matter how the axes +are changed). However, at times one wants to rotate text with respect +to something on the plot. In this case, the correct angle won't be +the angle of that object in the plot coordinate system, but the angle +that that object APPEARS in the screen coordinate system. This angle +is found by transforming the angle from the plot to the screen +coordinate system, as shown in the example below. +""" +from pylab import * + +# Plot diagonal line (45 degrees) +h = plot( r_[:10], r_[:10] ) + +# set limits so that it no longer looks on screen to be 45 degrees +xlim([-10,20]) + +# Locations to plot text +l1 = array((1,1)) +l2 = array((5,5)) + +# Rotate angle +angle = 45 +trans_angle = gca().transData.transform_angles(array((45,)), + l2.reshape((1,2)))[0] + +# Plot text +th1 = text(l1[0],l1[1],'text not rotated correctly',fontsize=16, + rotation=angle) +th2 = text(l2[0],l2[1],'text not rotated correctly',fontsize=16, + rotation=trans_angle) + +show() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6362 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6362&view=rev Author: dmkaplan Date: 2008年11月05日 14:02:07 +0000 (2008年11月05日) Log Message: ----------- Added a method to class Transforms in transform.py that transforms angles. The generic method uses a generic algorithm involving pushing off from a group of locations to determine new angles. This should work with almost any transform, but much quicker algorithms can be found for affine transforms. These algorithms have not yet been added though, so the generic method will be used until they are. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/transforms.py Modified: trunk/matplotlib/lib/matplotlib/transforms.py =================================================================== --- trunk/matplotlib/lib/matplotlib/transforms.py 2008年11月04日 13:38:15 UTC (rev 6361) +++ trunk/matplotlib/lib/matplotlib/transforms.py 2008年11月05日 14:02:07 UTC (rev 6362) @@ -1131,6 +1131,63 @@ """ return Path(self.transform_non_affine(path.vertices), path.codes) + def transform_angles(self, angles, pts, radians=False, pushoff=1e-5): + """ + Performs transformation on a set of angles anchored at + specific locations. + + The *angles* must be a column vector (i.e., numpy array). + + The *pts* must be a two-column numpy array of x,y positions + (angle transforms currently only work in 2D). This array must + have the same number of rows as *angles*. + + *radians* indicates whether or not input angles are given in + radians (True) or degrees (False; the default). + + *pushoff* is the distance to move away from *pts* for + determining transformed angles (see discussion of method + below). + + The transformed angles are returned in an array with the same + size as *angles*. + + The generic version of this method uses a very generic + algorithm that transforms *pts*, as well as locations very + close to *pts*, to find the angle in the transformed system. + """ + # Must be 2D + if self.input_dims <> 2 or self.output_dims <> 2: + raise NotImplementedError('Only defined in 2D') + + # pts must be array with 2 columns for x,y + assert pts.shape[1] == 2 + + # angles must be a column vector and have same number of + # rows as pts + assert np.prod(angles.shape) == angles.shape[0] == pts.shape[0] + + # Convert to radians if desired + if not radians: + angles = angles / 180.0 * np.pi + + # Move a short distance away + pts2 = pts + pushoff * np.c_[ np.cos(angles), np.sin(angles) ] + + # Transform both sets of points + tpts = self.transform( pts ) + tpts2 = self.transform( pts2 ) + + # Calculate transformed angles + d = tpts2 - tpts + a = np.arctan2( d[:,1], d[:,0] ) + + # Convert back to degrees if desired + if not radians: + a = a * 180.0 / np.pi + + return a + def inverted(self): """ Return the corresponding inverse transformation. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6361 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6361&view=rev Author: mmetz_bn Date: 2008年11月04日 13:38:15 +0000 (2008年11月04日) Log Message: ----------- sqrtm implemented in scipy Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/mlab.py Modified: trunk/matplotlib/lib/matplotlib/mlab.py =================================================================== --- trunk/matplotlib/lib/matplotlib/mlab.py 2008年10月31日 14:54:42 UTC (rev 6360) +++ trunk/matplotlib/lib/matplotlib/mlab.py 2008年11月04日 13:38:15 UTC (rev 6361) @@ -1811,7 +1811,7 @@ """ Deprecated - needs clean room implementation """ - raise NotImplementedError('Deprecated - needs clean room implementation') + raise NotImplementedError('Deprecated - see scipy.linalg.sqrtm') def mfuncC(f, x): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.