Revision: 5863 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5863&view=rev Author: efiring Date: 2008年07月25日 03:41:21 +0000 (2008年7月25日) Log Message: ----------- Removed body of unmasked_index_ranges from lines.py. This should have been part of changeset 5812. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2008年07月25日 02:40:12 UTC (rev 5862) +++ trunk/matplotlib/lib/matplotlib/lines.py 2008年07月25日 03:41:21 UTC (rev 5863) @@ -17,60 +17,20 @@ from transforms import Affine2D, Bbox, TransformedPath from matplotlib import rcParams - # special-purpose marker identifiers: (TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN, CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN) = range(8) + # COVERAGE NOTE: Never called internally or from examples def unmasked_index_ranges(mask, compressed = True): - ''' - Calculate the good data ranges in a masked 1-D np.array, based on - mask. + warnings.warn("Import this directly from matplotlib.cbook", + DeprecationWarning) + # Warning added 2008年07月22日 + from matplotlib.cbook import unmasked_index_ranges as _unmasked_index_ranges + return _unmasked_index_ranges(mask, compressed=compressed) - Returns Nx2 :class:`numpy.array` with each row the start and stop - indices for slices of the compressed :class:`numpy.array` - corresponding to each of *N* uninterrupted runs of unmasked - values. If optional argument *compressed* is *False*, it returns - the start and stop indices into the original :class:`numpy.array`, - not the compressed :class:`numpy.array`. Returns *None* if there - are no unmasked values. - Example:: - - y = ma.array(np.arange(5), mask = [0,0,1,0,0]) - #ii = unmasked_index_ranges(y.mask()) - ii = unmasked_index_ranges(ma.getmask(y)) - # returns [[0,2,] [2,4,]] - - y.compressed().filled()[ii[1,0]:ii[1,1]] - # returns np.array [3,4,] - # (The 'filled()' method converts the masked np.array to a numerix np.array.) - - #i0, i1 = unmasked_index_ranges(y.mask(), compressed=False) - i0, i1 = unmasked_index_ranges(ma.getmask(y), compressed=False) - # returns [[0,3,] [2,5,]] - - y.filled()[ii[1,0]:ii[1,1]] - # returns np.array [3,4,] - - ''' - m = np.concatenate(((1,), mask, (1,))) - indices = np.arange(len(mask) + 1) - mdif = m[1:] - m[:-1] - i0 = np.compress(mdif == -1, indices) - i1 = np.compress(mdif == 1, indices) - assert len(i0) == len(i1) - if len(i1) == 0: - return None - if not compressed: - return np.concatenate((i0[:, np.newaxis], i1[:, np.newaxis]), axis=1) - seglengths = i1 - i0 - breakpoints = np.cumsum(seglengths) - ic0 = np.concatenate(((0,), breakpoints[:-1])) - ic1 = breakpoints - return np.concatenate((ic0[:, np.newaxis], ic1[:, np.newaxis]), axis=1) - def segment_hits(cx,cy,x,y,radius): """Determine if any line segments are within radius of a point. Returns the list of line segments that are within that radius. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 5893 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5893&view=rev Author: pkienzle Date: 2008年07月26日 22:23:06 +0000 (2008年7月26日) Log Message: ----------- fix contains() method for Lines Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2008年07月26日 19:32:47 UTC (rev 5892) +++ trunk/matplotlib/lib/matplotlib/lines.py 2008年07月26日 22:23:06 UTC (rev 5893) @@ -236,33 +236,43 @@ if not is_numlike(self.pickradius): raise ValueError,"pick radius should be a distance" + # Make sure we have data to plot if self._invalid: self.recache() if len(self._xy)==0: return False,{} - tpath = self._transformed_path.get_fully_transformed_path() - xyt = tpath.vertices - xt = xyt[:, 0] - yt = xyt[:, 1] + # Convert points to pixels + path, affine = self._transformed_path.get_transformed_path_and_affine() + path = affine.transform_path(path) + xy = path.vertices + xt = xy[:, 0] + yt = xy[:, 1] + + # Convert pick radius from points to pixels if self.figure == None: - print str(self),' has no figure set' + warning.warn('no figure set when check if mouse is on line') pixels = self.pickradius else: pixels = self.figure.dpi/72. * self.pickradius + # Check for collision if self._linestyle in ['None',None]: # If no line, return the nearby point(s) - d = np.sqrt((xt-mouseevent.x)**2 + (yt-mouseevent.y)**2) - ind, = np.nonzero(np.less_equal(d, pixels)) + d = (xt-mouseevent.x)**2 + (yt-mouseevent.y)**2 + ind, = np.nonzero(np.less_equal(d, pixels**2)) else: # If line, return the nearby segment(s) ind = segment_hits(mouseevent.x,mouseevent.y,xt,yt,pixels) - if 0: - print 'linestyle',self._linestyle - print 'xt', xt, mouseevent.x - print 'yt', yt, mouseevent.y - print 'dx,dy', (xt-mouseevent.x)**2., (yt-mouseevent.y)**2. + + # Debugging message + if False and self._label != u'': + print "Checking line",self._label,"at",mouseevent.x,mouseevent.y + print 'xt', xt + print 'yt', yt + #print 'dx,dy', (xt-mouseevent.x)**2., (yt-mouseevent.y)**2. print 'ind',ind + + # Return the point(s) within radius return len(ind)>0,dict(ind=ind) def get_pickradius(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6547 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6547&view=rev Author: jdh2358 Date: 2008年12月10日 14:55:05 +0000 (2008年12月10日) Log Message: ----------- updated linestyle and markerstyle doc strings Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2008年12月10日 14:39:44 UTC (rev 6546) +++ trunk/matplotlib/lib/matplotlib/lines.py 2008年12月10日 14:55:05 UTC (rev 6547) @@ -74,6 +74,14 @@ return np.concatenate((points,lines)) class Line2D(Artist): + """ + A line - the line can have both a solid linestyle connecting all + the vertices, and a marker at each vertex. Additionally, the + drawing of the solid line is influenced by the drawstyle, eg one + can create "stepped" lines in various styles. + + + """ lineStyles = _lineStyles = { # hidden names deprecated '-' : '_draw_solid', '--' : '_draw_dashed', @@ -178,6 +186,11 @@ The kwargs are :class:`~matplotlib.lines.Line2D` properties: %(Line2D)s + + See :meth:`set_linestyle` for a decription of the line styles, + :meth:`set_marker` for a description of the markers, and + :meth:`set_drawstyle` for a description of the draw styles. + """ Artist.__init__(self) @@ -589,11 +602,27 @@ def set_linestyle(self, linestyle): """ - Set the linestyle of the line + Set the linestyle of the line (also accepts drawstyles) + + ================ ================= + linestyle description + ================ ================= + '-' solid + '--' dashed + '-.' dash_dot + ':' dotted + 'None' draw nothing + ' ' draw nothing + '' draw nothing + ================ ================= + 'steps' is equivalent to 'steps-pre' and is maintained for backward-compatibility. + .. seealso:: + :meth:`set_drawstyle` + ACCEPTS: [ '-' | '--' | '-.' | ':' | 'None' | ' ' | '' ] and any drawstyle in combination with a linestyle, e.g. 'steps--'. """ @@ -622,6 +651,44 @@ """ Set the line marker + ========= ========================== + marker description + ========= ========================== + '.' point + ',' pixel + 'o' circle + 'v' triangle_down + '^' triangle_up + '<' triangle_left + '>' triangle_right + '1' tri_down + '2' tri_up + '3' tri_left + '4' tri_right + 's' square + 'p' pentagon + '*' star + 'h' hexagon1 + 'H' hexagon2 + '+' plus + 'x' x + 'D' diamond + 'd' thin_diamond + '|' vline + '_' hline + TICKLEFT tickleft + TICKRIGHT tickright + TICKUP tickup + TICKDOWN tickdown + CARETLEFT caretleft + CARETRIGHT caretright + CARETUP caretup + CARETDOWN caretdown + 'None' nothing + ' ' nothing + '' nothing + ========= ========================== + ACCEPTS: [ '+' | '*' | ',' | '.' | '1' | '2' | '3' | '4' | '<' | '>' | 'D' | 'H' | '^' | '_' | 'd' | 'h' | 'o' | 'p' | 's' | 'v' | 'x' | '|' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6562 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6562&view=rev Author: leejjoon Date: 2008年12月11日 17:45:45 +0000 (2008年12月11日) Log Message: ----------- fixed typo in Line2D.set_marker doc. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2008年12月11日 03:25:31 UTC (rev 6561) +++ trunk/matplotlib/lib/matplotlib/lines.py 2008年12月11日 17:45:45 UTC (rev 6562) @@ -651,9 +651,9 @@ """ Set the line marker - ========= ========================== + ========== ========================== marker description - ========= ========================== + ========== ========================== '.' point ',' pixel 'o' circle @@ -687,7 +687,7 @@ 'None' nothing ' ' nothing '' nothing - ========= ========================== + ========== ========================== ACCEPTS: [ '+' | '*' | ',' | '.' | '1' | '2' | '3' | '4' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6566 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6566&view=rev Author: mdboom Date: 2008年12月11日 20:44:12 +0000 (2008年12月11日) Log Message: ----------- added some docs for linestyles and markers Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2008年12月11日 20:32:04 UTC (rev 6565) +++ trunk/matplotlib/lib/matplotlib/lines.py 2008年12月11日 20:44:12 UTC (rev 6566) @@ -690,6 +690,7 @@ ========== ========================== + ACCEPTS: [ '+' | '*' | ',' | '.' | '1' | '2' | '3' | '4' | '<' | '>' | 'D' | 'H' | '^' | '_' | 'd' | 'h' | 'o' | 'p' | 's' | 'v' | 'x' | '|' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6567 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6567&view=rev Author: mdboom Date: 2008年12月11日 20:44:23 +0000 (2008年12月11日) Log Message: ----------- fixed typo in Line2D.set_marker doc. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2008年12月11日 20:44:12 UTC (rev 6566) +++ trunk/matplotlib/lib/matplotlib/lines.py 2008年12月11日 20:44:23 UTC (rev 6567) @@ -690,7 +690,6 @@ ========== ========================== - ACCEPTS: [ '+' | '*' | ',' | '.' | '1' | '2' | '3' | '4' | '<' | '>' | 'D' | 'H' | '^' | '_' | 'd' | 'h' | 'o' | 'p' | 's' | 'v' | 'x' | '|' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6568 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6568&view=rev Author: mdboom Date: 2008年12月11日 20:44:32 +0000 (2008年12月11日) Log Message: ----------- added some docs for linestyles and markers Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2008年12月11日 20:44:23 UTC (rev 6567) +++ trunk/matplotlib/lib/matplotlib/lines.py 2008年12月11日 20:44:32 UTC (rev 6568) @@ -690,6 +690,7 @@ ========== ========================== + ACCEPTS: [ '+' | '*' | ',' | '.' | '1' | '2' | '3' | '4' | '<' | '>' | 'D' | 'H' | '^' | '_' | 'd' | 'h' | 'o' | 'p' | 's' | 'v' | 'x' | '|' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6864 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6864&view=rev Author: mdboom Date: 2009年02月02日 16:19:33 +0000 (2009年2月02日) Log Message: ----------- Fix bug in markevery where markers were being recursively removed. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2009年02月02日 12:42:08 UTC (rev 6863) +++ trunk/matplotlib/lib/matplotlib/lines.py 2009年02月02日 16:19:33 UTC (rev 6864) @@ -509,12 +509,16 @@ else: startind, stride = 0, markevery if tpath.codes is not None: - tpath.codes = tpath.codes[startind::stride] - tpath.vertices = tpath.vertices[startind::stride] + codes = tpath.codes[startind::stride] + else: + codes = None + vertices = tpath.vertices[startind::stride] + subsampled = Path(vertices, codes) + else: + subsampled = tpath - markerFunc = getattr(self, funcname) - markerFunc(renderer, gc, tpath, affine.frozen()) + markerFunc(renderer, gc, subsampled, affine.frozen()) renderer.close_group('line2d') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6866 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6866&view=rev Author: mdboom Date: 2009年02月02日 17:12:27 +0000 (2009年2月02日) Log Message: ----------- Fix markevery -- the tuple form was not working (if it ever was). Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2009年02月02日 16:29:37 UTC (rev 6865) +++ trunk/matplotlib/lib/matplotlib/lines.py 2009年02月02日 17:12:27 UTC (rev 6866) @@ -508,12 +508,12 @@ startind, stride = markevery else: startind, stride = 0, markevery - if tpath.codes is not None: - codes = tpath.codes[startind::stride] - else: - codes = None - vertices = tpath.vertices[startind::stride] - subsampled = Path(vertices, codes) + if tpath.codes is not None: + codes = tpath.codes[startind::stride] + else: + codes = None + vertices = tpath.vertices[startind::stride] + subsampled = Path(vertices, codes) else: subsampled = tpath This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7497 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7497&view=rev Author: efiring Date: 2009年08月18日 02:41:43 +0000 (2009年8月18日) Log Message: ----------- Remove unmasked_index_ranges from lines.py; it is still in cbook.py Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2009年08月15日 23:51:39 UTC (rev 7496) +++ trunk/matplotlib/lib/matplotlib/lines.py 2009年08月18日 02:41:43 UTC (rev 7497) @@ -26,15 +26,6 @@ CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN) = range(8) -# COVERAGE NOTE: Never called internally or from examples -def unmasked_index_ranges(mask, compressed = True): - warnings.warn("Import this directly from matplotlib.cbook", - DeprecationWarning) - # Warning added 2008年07月22日 - from matplotlib.cbook import unmasked_index_ranges as _unmasked_index_ranges - return _unmasked_index_ranges(mask, compressed=compressed) - - def segment_hits(cx, cy, x, y, radius): """ Determine if any line segments are within radius of a This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7505 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7505&view=rev Author: efiring Date: 2009年08月18日 22:18:59 +0000 (2009年8月18日) Log Message: ----------- Small cleanup of logic in handling drawstyle in Line2D Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2009年08月18日 22:13:11 UTC (rev 7504) +++ trunk/matplotlib/lib/matplotlib/lines.py 2009年08月18日 22:18:59 UTC (rev 7505) @@ -99,6 +99,8 @@ drawStyles = {} drawStyles.update(_drawStyles_l) drawStyles.update(_drawStyles_s) + # Need a list ordered with long names first: + drawStyleKeys = _drawStyles_l.keys() + _drawStyles_s.keys() markers = _markers = { # hidden names deprecated '.' : '_draw_point', @@ -712,15 +714,14 @@ any drawstyle in combination with a linestyle, e.g. 'steps--'. """ - # handle long drawstyle names before short ones ! - for ds in flatten([k.keys() for k in (self._drawStyles_l, - self._drawStyles_s)], is_string_like): + for ds in self.drawStyleKeys: # long names are first in the list if linestyle.startswith(ds): self.set_drawstyle(ds) if len(linestyle) > len(ds): linestyle = linestyle[len(ds):] else: linestyle = '-' + break if linestyle not in self._lineStyles: if linestyle in ls_mapper: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8053 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8053&view=rev Author: efiring Date: 2009年12月27日 23:18:51 +0000 (2009年12月27日) Log Message: ----------- fix whitespace, one docstring in lines.py Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2009年12月22日 23:43:09 UTC (rev 8052) +++ trunk/matplotlib/lib/matplotlib/lines.py 2009年12月27日 23:18:51 UTC (rev 8053) @@ -233,7 +233,7 @@ self.set_markerfacecolor(markerfacecolor) self.set_markeredgecolor(markeredgecolor) self.set_markeredgewidth(markeredgewidth) - self.set_fillstyle(fillstyle) + self.set_fillstyle(fillstyle) self._point_size_reduction = 0.5 @@ -323,9 +323,9 @@ def get_fillstyle(self): """ - return the marker fillstyle + return the marker fillstyle """ - return self._fillstyle + return self._fillstyle def set_fillstyle(self, fs): """ @@ -335,7 +335,7 @@ ACCEPTS: ['full' | 'left' | 'right' | 'bottom' | 'top'] """ assert fs in ['full', 'left' , 'right' , 'bottom' , 'top'] - self._fillstyle = fs + self._fillstyle = fs def set_markevery(self, every): """ @@ -396,7 +396,7 @@ """ Set the x and y data - ACCEPTS: 2D array + ACCEPTS: 2D array (rows are x, y) or two 1D arrays """ if len(args)==1: x, y = args[0] @@ -931,8 +931,8 @@ def _draw_point(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': + fs = self.get_fillstyle() + if fs!='full': raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') w = renderer.points_to_pixels(self._markersize) * \ @@ -946,8 +946,8 @@ _draw_pixel_transform = Affine2D().translate(-0.5, -0.5) def _draw_pixel(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': + fs = self.get_fillstyle() + if fs!='full': raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') rgbFace = self._get_rgb_face() @@ -958,8 +958,8 @@ def _draw_circle(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': + fs = self.get_fillstyle() + if fs!='full': raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') w = renderer.points_to_pixels(self._markersize) * 0.5 @@ -974,8 +974,8 @@ _triangle_path = Path([[0.0, 1.0], [-1.0, -1.0], [1.0, -1.0], [0.0, 1.0]]) def _draw_triangle_up(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': + fs = self.get_fillstyle() + if fs!='full': raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) @@ -987,8 +987,8 @@ def _draw_triangle_down(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': + fs = self.get_fillstyle() + if fs!='full': raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) @@ -1000,8 +1000,8 @@ def _draw_triangle_left(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': + fs = self.get_fillstyle() + if fs!='full': raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) @@ -1013,8 +1013,8 @@ def _draw_triangle_right(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': + fs = self.get_fillstyle() + if fs!='full': raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) @@ -1030,8 +1030,8 @@ side = renderer.points_to_pixels(self._markersize) transform = Affine2D().translate(-0.5, -0.5).scale(side) rgbFace = self._get_rgb_face() - fs = self.get_fillstyle() - if fs=='full': + fs = self.get_fillstyle() + if fs=='full': renderer.draw_markers(gc, Path.unit_rectangle(), transform, path, path_trans, rgbFace) else: @@ -1052,8 +1052,8 @@ path, path_trans, None) def _draw_diamond(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': + fs = self.get_fillstyle() + if fs!='full': raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) side = renderer.points_to_pixels(self._markersize) @@ -1064,8 +1064,8 @@ def _draw_thin_diamond(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': + fs = self.get_fillstyle() + if fs!='full': raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') gc.set_snap(renderer.points_to_pixels(self._markersize) >= 3.0) offset = renderer.points_to_pixels(self._markersize) @@ -1077,8 +1077,8 @@ def _draw_pentagon(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': + fs = self.get_fillstyle() + if fs!='full': raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) offset = 0.5 * renderer.points_to_pixels(self._markersize) @@ -1088,8 +1088,8 @@ path, path_trans, rgbFace) def _draw_star(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': + fs = self.get_fillstyle() + if fs!='full': raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) offset = 0.5 * renderer.points_to_pixels(self._markersize) @@ -1101,8 +1101,8 @@ def _draw_hexagon1(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': + fs = self.get_fillstyle() + if fs!='full': raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) offset = 0.5 * renderer.points_to_pixels(self._markersize) @@ -1113,8 +1113,8 @@ def _draw_hexagon2(self, renderer, gc, path, path_trans): - fs = self.get_fillstyle() - if fs!='full': + fs = self.get_fillstyle() + if fs!='full': raise NotImplementedError('non-full markers have not been implemented for this marker style yet; please contribute') gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) offset = 0.5 * renderer.points_to_pixels(self._markersize) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8055 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8055&view=rev Author: efiring Date: 2009年12月28日 01:34:06 +0000 (2009年12月28日) Log Message: ----------- Fix bug in Line2D from last commit: restore full recache in unit chane callback Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2009年12月28日 00:21:50 UTC (rev 8054) +++ trunk/matplotlib/lib/matplotlib/lines.py 2009年12月28日 01:34:06 UTC (rev 8055) @@ -388,9 +388,9 @@ def set_axes(self, ax): Artist.set_axes(self, ax) if ax.xaxis is not None: - self._xcid = ax.xaxis.callbacks.connect('units', self.recache) + self._xcid = ax.xaxis.callbacks.connect('units', self.recache_always) if ax.yaxis is not None: - self._ycid = ax.yaxis.callbacks.connect('units', self.recache) + self._ycid = ax.yaxis.callbacks.connect('units', self.recache_always) set_axes.__doc__ = Artist.set_axes.__doc__ def set_data(self, *args): @@ -407,8 +407,11 @@ self.set_xdata(x) self.set_ydata(y) - def recache(self): - if self._invalidx: + def recache_always(self): + self.recache(always=True) + + def recache(self, always=False): + if always or self._invalidx: xconv = self.convert_xunits(self._xorig) if ma.isMaskedArray(self._xorig): x = ma.asarray(xconv, float) @@ -417,7 +420,7 @@ x = x.ravel() else: x = self._x - if self._invalidy: + if always or self._invalidy: yconv = self.convert_yunits(self._yorig) if ma.isMaskedArray(self._yorig): y = ma.asarray(yconv, float) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8076 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8076&view=rev Author: mdboom Date: 2010年01月11日 19:23:13 +0000 (2010年1月11日) Log Message: ----------- Fix centering of mathtext markers (thanks, tcb) Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2010年01月11日 12:28:15 UTC (rev 8075) +++ trunk/matplotlib/lib/matplotlib/lines.py 2010年01月11日 19:23:13 UTC (rev 8076) @@ -898,7 +898,7 @@ height = ymax - ymin max_dim = max(width, height) path_trans = Affine2D() \ - .translate(0.5 * -width, 0.5 * -height) \ + .translate(-xmin + 0.5 * -width, -ymin + 0.5 * -height) \ .scale((renderer.points_to_pixels(self.get_markersize()) / max_dim)) rgbFace = self._get_rgb_face() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8168 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8168&view=rev Author: jdh2358 Date: 2010年03月02日 02:24:34 +0000 (2010年3月02日) Log Message: ----------- fix alt kwarg for set_mfc Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2010年03月02日 01:47:54 UTC (rev 8167) +++ trunk/matplotlib/lib/matplotlib/lines.py 2010年03月02日 02:24:34 UTC (rev 8168) @@ -1586,7 +1586,7 @@ def set_mfc(self, val): 'alias for set_markerfacecolor' - self.set_markerfacecolor(val, alt=alt) + self.set_markerfacecolor(val) def set_mfcalt(self, val): 'alias for set_markerfacecoloralt' This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8170 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8170&view=rev Author: jdh2358 Date: 2010年03月02日 13:12:16 +0000 (2010年3月02日) Log Message: ----------- fixed invalidx bug in Line2D get_xydata Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2010年03月02日 02:42:58 UTC (rev 8169) +++ trunk/matplotlib/lib/matplotlib/lines.py 2010年03月02日 13:12:16 UTC (rev 8170) @@ -659,7 +659,7 @@ """ Return the *xy* data as a Nx2 numpy array. """ - if self._invalidy or self.invalidx: + if self._invalidy or self._invalidx: self.recache() return self._xy @@ -831,7 +831,7 @@ def set_markerfacecolor(self, fc): """ - Set the marker face color. + Set the marker face color. ACCEPTS: any matplotlib color """ @@ -842,7 +842,7 @@ def set_markerfacecoloralt(self, fc): """ - Set the alternate marker face color. + Set the alternate marker face color. ACCEPTS: any matplotlib color """ @@ -1020,7 +1020,7 @@ path, path_trans, rgbFace) transform = transform.rotate_deg(180.) renderer.draw_markers(gc, righthalf, transform, - path, path_trans, rgbFace_alt) + path, path_trans, rgbFace_alt) _draw_pixel_transform = Affine2D().translate(-0.5, -0.5) @@ -1041,7 +1041,7 @@ rgbFace = self._get_rgb_face() fs = self.get_fillstyle() if fs=='full': - renderer.draw_markers(gc, Path.unit_circle(), transform, + renderer.draw_markers(gc, Path.unit_circle(), transform, path, path_trans, rgbFace) else: rgbFace_alt = self._get_rgb_face(alt=True) @@ -1118,8 +1118,8 @@ path, path_trans, rgbFace) renderer.draw_markers(gc, mpath_alt, transform, path, path_trans, rgbFace_alt) - + def _draw_triangle_up(self, renderer, gc, path, path_trans): self._draw_triangle(renderer, gc, path, path_trans, 'up') @@ -1190,8 +1190,8 @@ path, path_trans, rgbFace) renderer.draw_markers(gc, left, transform, path, path_trans, rgbFace_alt) - + def _draw_thin_diamond(self, renderer, gc, path, path_trans): gc.set_snap(renderer.points_to_pixels(self._markersize) >= 3.0) offset = renderer.points_to_pixels(self._markersize) @@ -1238,7 +1238,7 @@ path, path_trans, rgbFace) else: verts = polypath.vertices - + y = (1+np.sqrt(5))/4. top = Path([verts[0], verts[1], verts[4], verts[0]]) bottom = Path([verts[1], verts[2], verts[3], verts[4], verts[1]]) @@ -1299,7 +1299,7 @@ def _draw_hexagon1(self, renderer, gc, path, path_trans): - gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) + gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) offset = 0.5 * renderer.points_to_pixels(self._markersize) transform = Affine2D().scale(offset) @@ -1338,7 +1338,7 @@ def _draw_hexagon2(self, renderer, gc, path, path_trans): - gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) + gc.set_snap(renderer.points_to_pixels(self._markersize) >= 5.0) offset = 0.5 * renderer.points_to_pixels(self._markersize) transform = Affine2D().scale(offset).rotate_deg(30) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8289 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8289&view=rev Author: efiring Date: 2010年04月29日 21:43:53 +0000 (2010年4月29日) Log Message: ----------- Line2D: don't use subslices with markevery Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2010年04月29日 16:18:09 UTC (rev 8288) +++ trunk/matplotlib/lib/matplotlib/lines.py 2010年04月29日 21:43:53 UTC (rev 8289) @@ -456,7 +456,8 @@ self._subslice = False if (self.axes and len(x) > 100 and self._is_sorted(x) and self.axes.name == 'rectilinear' and - self.axes.get_xscale() == 'linear'): + self.axes.get_xscale() == 'linear' and + self._markevery is None): self._subslice = True if hasattr(self, '_path'): interpolation_steps = self._path._interpolation_steps This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8358 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8358&view=rev Author: efiring Date: 2010年06月01日 02:20:53 +0000 (2010年6月01日) Log Message: ----------- Line2D: fix point picking with zoom and pan, when line-clipping is in effect. Closes 2871992. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2010年06月01日 01:30:19 UTC (rev 8357) +++ trunk/matplotlib/lib/matplotlib/lines.py 2010年06月01日 02:20:53 UTC (rev 8358) @@ -305,6 +305,8 @@ # If line, return the nearby segment(s) ind = segment_hits(mouseevent.x,mouseevent.y,xt,yt,pixels) + ind += self.ind_offset + # Debugging message if False and self._label != u'': print "Checking line",self._label,"at",mouseevent.x,mouseevent.y @@ -496,12 +498,14 @@ def draw(self, renderer): if self._invalidy or self._invalidx: self.recache() + self.ind_offset = 0 # Needed for contains() method. if self._subslice and self.axes: # Need to handle monotonically decreasing case also... x0, x1 = self.axes.get_xbound() i0, = self._x.searchsorted([x0], 'left') i1, = self._x.searchsorted([x1], 'right') subslice = slice(max(i0-1, 0), i1+1) + self.ind_offset = subslice.start self._transform_path(subslice) if self._transformed_path is None: self._transform_path() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8730 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8730&view=rev Author: ryanmay Date: 2010年10月06日 16:03:48 +0000 (2010年10月06日) Log Message: ----------- contains() was relying on some attributes being set by draw(). Add code to make contains() not cause a traceback if draw() has not been called. Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/lines.py Modified: trunk/matplotlib/lib/matplotlib/lines.py =================================================================== --- trunk/matplotlib/lib/matplotlib/lines.py 2010年10月06日 16:00:27 UTC (rev 8729) +++ trunk/matplotlib/lib/matplotlib/lines.py 2010年10月06日 16:03:48 UTC (rev 8730) @@ -248,6 +248,7 @@ # chance to init axes (and hence unit support) self.update(kwargs) self.pickradius = pickradius + self.ind_offset = 0 if is_numlike(self._picker): self.pickradius = self._picker @@ -283,6 +284,8 @@ if len(self._xy)==0: return False,{} # Convert points to pixels + if self._transformed_path is None: + self._transform_path() path, affine = self._transformed_path.get_transformed_path_and_affine() path = affine.transform_path(path) xy = path.vertices This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.