From: <jd...@us...> - 2009-08-30 16:25:54
|
Revision: 7601 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7601&view=rev Author: jdh2358 Date: 2009-08-30 16:25:46 +0000 (Sun, 30 Aug 2009) Log Message: ----------- Merged revisions 7598,7600 via svnmerge from https://matplotlib.svn.sourceforge.net/svnroot/matplotlib/branches/v0_99_maint ........ r7598 | jdh2358 | 2009-08-30 08:35:12 -0500 (Sun, 30 Aug 2009) | 1 line applied Gael's ginput patch ........ r7600 | jdh2358 | 2009-08-30 11:22:38 -0500 (Sun, 30 Aug 2009) | 1 line some unit cleanup; fix sf bug 2846058 ........ Modified Paths: -------------- trunk/matplotlib/examples/units/annotate_with_units.py trunk/matplotlib/examples/units/bar_demo2.py trunk/matplotlib/examples/units/radian_demo.py trunk/matplotlib/lib/matplotlib/axes.py trunk/matplotlib/lib/matplotlib/blocking_input.py trunk/matplotlib/lib/matplotlib/collections.py trunk/matplotlib/lib/matplotlib/figure.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-7590 + /branches/mathtex:1-7263 /branches/v0_98_5_maint:1-7253 /branches/v0_99_maint:1-7600 Modified: trunk/matplotlib/examples/units/annotate_with_units.py =================================================================== --- trunk/matplotlib/examples/units/annotate_with_units.py 2009-08-30 16:22:38 UTC (rev 7600) +++ trunk/matplotlib/examples/units/annotate_with_units.py 2009-08-30 16:25:46 UTC (rev 7601) @@ -1,8 +1,7 @@ - -import pylab +import matplotlib.pyplot as plt from basic_units import cm -fig = pylab.figure() +fig = plt.figure() ax = fig.add_subplot(111) @@ -23,5 +22,5 @@ ax.set_xlim(0*cm, 4*cm) ax.set_ylim(0*cm, 4*cm) -pylab.show() +plt.show() Modified: trunk/matplotlib/examples/units/bar_demo2.py =================================================================== --- trunk/matplotlib/examples/units/bar_demo2.py 2009-08-30 16:22:38 UTC (rev 7600) +++ trunk/matplotlib/examples/units/bar_demo2.py 2009-08-30 16:25:46 UTC (rev 7601) @@ -25,11 +25,11 @@ ax3 = fig.add_subplot(2,2,3) ax3.bar(cms, cms, bottom=bottom, width=width, xunits=inch, yunits=cm) -ax3.set_xlim(3, 6) # scalars are interpreted in current units +ax3.set_xlim(2, 6) # scalars are interpreted in current units ax4 = fig.add_subplot(2,2,4) ax4.bar(cms, cms, bottom=bottom, width=width, xunits=inch, yunits=inch) #fig.savefig('simple_conversion_plot.png') -ax4.set_xlim(3*cm, 6*cm) # cm are converted to inches +ax4.set_xlim(2*cm, 6*cm) # cm are converted to inches show() Modified: trunk/matplotlib/examples/units/radian_demo.py =================================================================== --- trunk/matplotlib/examples/units/radian_demo.py 2009-08-30 16:22:38 UTC (rev 7600) +++ trunk/matplotlib/examples/units/radian_demo.py 2009-08-30 16:25:46 UTC (rev 7601) @@ -7,15 +7,15 @@ from basic_units import radians, degrees, cos from matplotlib.pyplot import figure, show -x = np.arange(0, 15, 0.01) * radians +x = [val*radians for val in np.arange(0, 15, 0.01)] fig = figure() fig.subplots_adjust(hspace=0.3) ax = fig.add_subplot(211) -ax.plot(x, cos(x), xunits=radians) +line1, = ax.plot(x, cos(x), xunits=radians) ax = fig.add_subplot(212) -ax.plot(x, cos(x), xunits=degrees) +line2, = ax.plot(x, cos(x), xunits=degrees) show() Modified: trunk/matplotlib/lib/matplotlib/axes.py =================================================================== --- trunk/matplotlib/lib/matplotlib/axes.py 2009-08-30 16:22:38 UTC (rev 7600) +++ trunk/matplotlib/lib/matplotlib/axes.py 2009-08-30 16:25:46 UTC (rev 7601) @@ -203,11 +203,25 @@ if self.axes.xaxis is not None and self.axes.yaxis is not None: bx = self.axes.xaxis.update_units(x) by = self.axes.yaxis.update_units(y) - if bx: - x = self.axes.convert_xunits(x) - if by: - y = self.axes.convert_yunits(y) + if self.command!='plot': + # the Line2D class can handle unitized data, with + # support for post hoc unit changes etc. Other mpl + # artists, eg Polygon which _process_plot_var_args + # also serves on calls to fill, cannot. So this is a + # hack to say: if you are not "plot", which is + # creating Line2D, then convert the data now to + # floats. If you are plot, pass the raw data through + # to Line2D which will handle the conversion. So + # polygons will not support post hoc conversions of + # the unit type since they are not storing the orig + # data. Hopefully we can rationalize this at a later + # date - JDH + if bx: + x = self.axes.convert_xunits(x) + if by: + y = self.axes.convert_yunits(y) + x = np.atleast_1d(x) #like asanyarray, but converts scalar to array y = np.atleast_1d(y) if x.shape[0] != y.shape[0]: @@ -4270,10 +4284,14 @@ if self.xaxis is not None: left = self.convert_xunits( left ) width = self.convert_xunits( width ) + if xerr is not None: + xerr = self.convert_xunits( xerr ) if self.yaxis is not None: bottom = self.convert_yunits( bottom ) height = self.convert_yunits( height ) + if yerr is not None: + yerr = self.convert_yunits( yerr ) if align == 'edge': pass Modified: trunk/matplotlib/lib/matplotlib/blocking_input.py =================================================================== --- trunk/matplotlib/lib/matplotlib/blocking_input.py 2009-08-30 16:22:38 UTC (rev 7600) +++ trunk/matplotlib/lib/matplotlib/blocking_input.py 2009-08-30 16:25:46 UTC (rev 7601) @@ -17,9 +17,6 @@ Note: Subclass of BlockingMouseInput. Used by clabel """ -import time -import numpy as np - from matplotlib import path, verbose from matplotlib.cbook import is_sequence_of_strings @@ -151,7 +148,7 @@ button = event.button if button == self.button_pop: - self.mouse_event_pop(event,-1) + self.mouse_event_pop(event) elif button == self.button_stop: self.mouse_event_stop(event) else: @@ -162,7 +159,7 @@ Process a key click event. This maps certain keys to appropriate mouse click events. ''' - + event = self.events[-1] key = event.key.lower() Modified: trunk/matplotlib/lib/matplotlib/collections.py =================================================================== --- trunk/matplotlib/lib/matplotlib/collections.py 2009-08-30 16:22:38 UTC (rev 7600) +++ trunk/matplotlib/lib/matplotlib/collections.py 2009-08-30 16:25:46 UTC (rev 7601) @@ -819,7 +819,9 @@ def set_segments(self, segments): if segments is None: return _segments = [] + for seg in segments: + if not np.ma.isMaskedArray(seg): seg = np.asarray(seg, np.float_) _segments.append(seg) Modified: trunk/matplotlib/lib/matplotlib/figure.py =================================================================== --- trunk/matplotlib/lib/matplotlib/figure.py 2009-08-30 16:22:38 UTC (rev 7600) +++ trunk/matplotlib/lib/matplotlib/figure.py 2009-08-30 16:25:46 UTC (rev 7601) @@ -12,12 +12,11 @@ """ import numpy as np -import time import artist from artist import Artist, allow_rasterization from axes import Axes, SubplotBase, subplot_class_factory -from cbook import flatten, allequal, Stack, iterable, dedent +from cbook import flatten, allequal, Stack, iterable import _image import colorbar as cbar from image import FigureImage @@ -1118,6 +1117,12 @@ Right clicking cancels last input. + The buttons used for the various actions (adding points, removing + points, terminating the inputs) can be overriden via the + arguments *mouse_add*, *mouse_pop* and *mouse_stop*, that give + the associated mouse button: 1 for left, 2 for middle, 3 for + right. + The keyboard can also be used to select points in case your mouse does not have one or more of the buttons. The delete and backspace keys act like right clicking (i.e., remove last point), the enter key This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |