From f2fcd0c398d7e3afcb8c78fd893cadc73ffa8174 Mon Sep 17 00:00:00 2001 From: Nelle Varoquaux Date: Fri, 1 Mar 2013 11:49:18 +0100 Subject: [PATCH 1/4] PEP8 fixes on the markers module --- lib/matplotlib/markers.py | 201 ++++++++++++++++++++++---------------- 1 file changed, 116 insertions(+), 85 deletions(-) diff --git a/lib/matplotlib/markers.py b/lib/matplotlib/markers.py index ec41869b22ed..ae2b703f83ff 100644 --- a/lib/matplotlib/markers.py +++ b/lib/matplotlib/markers.py @@ -18,7 +18,8 @@ (TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN, CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN) = range(8) -class MarkerStyle: + +class MarkerStyle(object): style_table = """ ============================== =============================================== marker description @@ -59,42 +60,42 @@ class MarkerStyle: # TODO: Automatically generate this accepts = """ACCEPTS: [ %s | ``'$...$'`` | *tuple* | *Nx2 array* ]""" - markers = { - '.' : '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', - '8' : 'octagon', - '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', - None : 'nothing', - ' ' : 'nothing', - '' : 'nothing' + markers = { + '.': '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', + '8': 'octagon', + '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', + None: 'nothing', + ' ': 'nothing', + '': 'nothing' } # Just used for informational purposes. is_filled() @@ -102,8 +103,8 @@ class MarkerStyle: filled_markers = ( 'o', 'v', '^', '<', '>', '8', 's', 'p', '*', 'h', 'H', 'D', 'd') - fillstyles = ('full', 'left' , 'right' , 'bottom' , 'top', 'none') - _half_fillstyles = ('left' , 'right' , 'bottom' , 'top') + fillstyles = ('full', 'left', 'right', 'bottom', 'top', 'none') + _half_fillstyles = ('left', 'right', 'bottom', 'top') # TODO: Is this ever used as a non-constant? _point_size_reduction = 0.5 @@ -124,7 +125,7 @@ def __setstate__(self, statedict): self._recache() def _recache(self): - self._path = Path(np.empty((0,2))) + self._path = Path(np.empty((0, 2))) self._transform = IdentityTransform() self._alt_path = None self._alt_transform = None @@ -173,7 +174,7 @@ def set_marker(self, marker): self._marker_function = self._set_path_marker else: try: - _ = Path(marker) + Path(marker) self._marker_function = self._set_vertices except ValueError: raise ValueError('Unrecognized marker style {}'.format(marker)) @@ -201,7 +202,8 @@ def _set_nothing(self): def _set_custom_marker(self, path): verts = path.vertices - rescale = max(np.max(np.abs(verts[:,0])), np.max(np.abs(verts[:,1]))) + rescale = max(np.max(np.abs(verts[:, 0])), + np.max(np.abs(verts[:, 1]))) self._transform = Affine2D().scale(1.0 / rescale) self._path = path @@ -253,7 +255,7 @@ def _set_mathtext_path(self): # Font size is irrelevant here, it will be rescaled based on # the drawn size later props = FontProperties(size=1.0) - text = TextPath(xy=(0,0), s=self.get_marker(), fontproperties=props, + text = TextPath(xy=(0, 0), s=self.get_marker(), fontproperties=props, usetex=rcParams['text.usetex']) if len(text.vertices) == 0: return @@ -274,7 +276,7 @@ def _half_fill(self): result = fs in self._half_fillstyles return result - def _set_circle(self, reduction = 1.0): + def _set_circle(self, reduction=1.0): self._transform = Affine2D().scale(0.5 * reduction) self._snap_threshold = 6.0 fs = self.get_fillstyle() @@ -282,10 +284,14 @@ def _set_circle(self, reduction = 1.0): self._path = Path.unit_circle() else: # build a right-half circle - if fs=='bottom': rotate = 270. - elif fs=='top': rotate = 90. - elif fs=='left': rotate = 180. - else: rotate = 0. + if fs == 'bottom': + rotate = 270. + elif fs == 'top': + rotate = 90. + elif fs == 'left': + rotate = 180. + else: + rotate = 0. self._path = self._alt_path = Path.unit_circle_righthalf() self._transform.rotate_deg(rotate) @@ -306,17 +312,18 @@ def _set_pixel(self): self._snap_threshold = None def _set_point(self): - self._set_circle(reduction = self._point_size_reduction) + self._set_circle(reduction=self._point_size_reduction) _triangle_path = Path( [[0.0, 1.0], [-1.0, -1.0], [1.0, -1.0], [0.0, 1.0]], [Path.MOVETO, Path.LINETO, Path.LINETO, Path.CLOSEPOLY]) # Going down halfway looks to small. Golden ratio is too far. _triangle_path_u = Path( - [[0.0, 1.0], [-3/5., -1/5.], [3/5., -1/5.], [0.0, 1.0]], + [[0.0, 1.0], [-3 / 5., -1 / 5.], [3 / 5., -1 / 5.], [0.0, 1.0]], [Path.MOVETO, Path.LINETO, Path.LINETO, Path.CLOSEPOLY]) _triangle_path_d = Path( - [[-3/5., -1/5.], [3/5., -1/5.], [1.0, -1.0], [-1.0, -1.0], [-3/5., -1/5.]], + [[-3 / 5., -1 / 5.], [3 / 5., -1 / 5.], [1.0, -1.0], [-1.0, -1.0], + [-3 / 5., -1 / 5.]], [Path.MOVETO, Path.LINETO, Path.LINETO, Path.LINETO, Path.CLOSEPOLY]) _triangle_path_l = Path( [[0.0, 1.0], [0.0, -1.0], [-1.0, -1.0], [0.0, 1.0]], @@ -324,6 +331,7 @@ def _set_point(self): _triangle_path_r = Path( [[0.0, 1.0], [0.0, -1.0], [1.0, -1.0], [0.0, 1.0]], [Path.MOVETO, Path.LINETO, Path.LINETO, Path.CLOSEPOLY]) + def _set_triangle(self, rot, skip): self._transform = Affine2D().scale(0.5, 0.5).rotate_deg(rot) self._snap_threshold = 5.0 @@ -337,18 +345,18 @@ def _set_triangle(self, rot, skip): self._triangle_path_d, self._triangle_path_r] - if fs=='top': - self._path = mpaths[(0+skip) % 4] - self._alt_path = mpaths[(2+skip) % 4] - elif fs=='bottom': - self._path = mpaths[(2+skip) % 4] - self._alt_path = mpaths[(0+skip) % 4] - elif fs=='left': - self._path = mpaths[(1+skip) % 4] - self._alt_path = mpaths[(3+skip) % 4] + if fs == 'top': + self._path = mpaths[(0 + skip) % 4] + self._alt_path = mpaths[(2 + skip) % 4] + elif fs == 'bottom': + self._path = mpaths[(2 + skip) % 4] + self._alt_path = mpaths[(0 + skip) % 4] + elif fs == 'left': + self._path = mpaths[(1 + skip) % 4] + self._alt_path = mpaths[(3 + skip) % 4] else: - self._path = mpaths[(3+skip) % 4] - self._alt_path = mpaths[(1+skip) % 4] + self._path = mpaths[(3 + skip) % 4] + self._alt_path = mpaths[(1 + skip) % 4] self._alt_transform = self._transform @@ -376,13 +384,19 @@ def _set_square(self): # build a bottom filled square out of two rectangles, one # filled. Use the rotation to support left, right, bottom # or top - if fs=='bottom': rotate = 0. - elif fs=='top': rotate = 180. - elif fs=='left': rotate = 270. - else: rotate = 90. + if fs == 'bottom': + rotate = 0. + elif fs == 'top': + rotate = 180. + elif fs == 'left': + rotate = 270. + else: + rotate = 90. - self._path = Path([[0.0, 0.0], [1.0, 0.0], [1.0, 0.5], [0.0, 0.5], [0.0, 0.0]]) - self._alt_path = Path([[0.0, 0.5], [1.0, 0.5], [1.0, 1.0], [0.0, 1.0], [0.0, 0.5]]) + self._path = Path([[0.0, 0.0], [1.0, 0.0], [1.0, 0.5], + [0.0, 0.5], [0.0, 0.0]]) + self._alt_path = Path([[0.0, 0.5], [1.0, 0.5], [1.0, 1.0], + [0.0, 1.0], [0.0, 0.5]]) self._transform.rotate_deg(rotate) self._alt_transform = self._transform @@ -396,12 +410,17 @@ def _set_diamond(self): self._path = Path.unit_rectangle() else: self._path = Path([[0.0, 0.0], [1.0, 0.0], [1.0, 1.0], [0.0, 0.0]]) - self._alt_path = Path([[0.0, 0.0], [0.0, 1.0], [1.0, 1.0], [0.0, 0.0]]) + self._alt_path = Path([[0.0, 0.0], [0.0, 1.0], + [1.0, 1.0], [0.0, 0.0]]) - if fs=='bottom': rotate = 270. - elif fs=='top': rotate = 90. - elif fs=='left': rotate = 180. - else: rotate = 0. + if fs == 'bottom': + rotate = 270. + elif fs == 'top': + rotate = 90. + elif fs == 'left': + rotate = 180. + else: + rotate = 0. self._transform.rotate_deg(rotate) self._alt_transform = self._transform @@ -424,11 +443,11 @@ def _set_pentagon(self): else: verts = polypath.vertices - y = (1+np.sqrt(5))/4. + 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]]) - left = Path([verts[0], verts[1], verts[2], [0,-y], verts[0]]) - right = Path([verts[0], verts[4], verts[3], [0,-y], verts[0]]) + left = Path([verts[0], verts[1], verts[2], [0, -y], verts[0]]) + right = Path([verts[0], verts[4], verts[3], [0, -y], verts[0]]) if fs == 'top': mpath, mpath_alt = top, bottom @@ -488,7 +507,7 @@ def _set_hexagon1(self): verts = polypath.vertices # not drawing inside lines - x = np.abs(np.cos(5*np.pi/6.)) + x = np.abs(np.cos(5 * np.pi / 6.)) top = Path(np.vstack(([-x, 0], verts[(1, 0, 5), :], [x, 0]))) bottom = Path(np.vstack(([-x, 0], verts[2:5, :], [x, 0]))) left = Path(verts[(0, 1, 2, 3), :]) @@ -522,10 +541,11 @@ def _set_hexagon2(self): verts = polypath.vertices # not drawing inside lines - x, y = np.sqrt(3)/4, 3/4. + x, y = np.sqrt(3) / 4, 3 / 4. top = Path(verts[(1, 0, 5, 4, 1), :]) bottom = Path(verts[(1, 2, 3, 4), :]) - left = Path(np.vstack(([x, y], verts[(0, 1, 2), :], [-x, -y], [x, y]))) + left = Path(np.vstack(([x, y], verts[(0, 1, 2), :], + [-x, -y], [x, y]))) right = Path(np.vstack(([x, y], verts[(5, 4, 3), :], [-x, -y]))) if fs == 'top': @@ -554,14 +574,18 @@ def _set_octagon(self): self._transform.rotate_deg(22.5) self._path = polypath else: - x = np.sqrt(2.)/4. + x = np.sqrt(2.) / 4. half = Path([[0, -1], [0, 1], [-x, 1], [-1, x], [-1, -x], [-x, -1], [0, -1]]) - if fs=='bottom': rotate = 90. - elif fs=='top': rotate = 270. - elif fs=='right': rotate = 180. - else: rotate = 0. + if fs == 'bottom': + rotate = 90. + elif fs == 'top': + rotate = 270. + elif fs == 'right': + rotate = 180. + else: + rotate = 0. self._transform.rotate_deg(rotate) self._path = self._alt_path = half @@ -570,6 +594,7 @@ def _set_octagon(self): self._joinstyle = 'miter' _line_marker_path = Path([[0.0, -1.0], [0.0, 1.0]]) + def _set_vline(self): self._transform = Affine2D().scale(0.5) self._snap_threshold = 1.0 @@ -583,6 +608,7 @@ def _set_hline(self): self._path = self._line_marker_path _tickhoriz_path = Path([[0.0, 0.0], [1.0, 0.0]]) + def _set_tickleft(self): self._transform = Affine2D().scale(-1.0, 1.0) self._snap_threshold = 1.0 @@ -596,6 +622,7 @@ def _set_tickright(self): self._path = self._tickhoriz_path _tickvert_path = Path([[-0.0, 0.0], [-0.0, 1.0]]) + def _set_tickup(self): self._transform = Affine2D().scale(1.0, 1.0) self._snap_threshold = 1.0 @@ -612,6 +639,7 @@ def _set_tickdown(self): [0.0, -1.0], [0.0, 1.0]], [Path.MOVETO, Path.LINETO, Path.MOVETO, Path.LINETO]) + def _set_plus(self): self._transform = Affine2D().scale(0.5) self._snap_threshold = 1.0 @@ -624,6 +652,7 @@ def _set_plus(self): [Path.MOVETO, Path.LINETO, Path.MOVETO, Path.LINETO, Path.MOVETO, Path.LINETO]) + def _set_tri_down(self): self._transform = Affine2D().scale(0.5) self._snap_threshold = 5.0 @@ -649,6 +678,7 @@ def _set_tri_right(self): self._path = self._tri_path _caret_path = Path([[-1.0, 1.5], [0.0, 0.0], [1.0, 1.5]]) + def _set_caretdown(self): self._transform = Affine2D().scale(0.5) self._snap_threshold = 3.0 @@ -681,6 +711,7 @@ def _set_caretright(self): [-1.0, 1.0], [1.0, -1.0]], [Path.MOVETO, Path.LINETO, Path.MOVETO, Path.LINETO]) + def _set_x(self): self._transform = Affine2D().scale(0.5) self._snap_threshold = 3.0 @@ -688,7 +719,7 @@ def _set_x(self): self._path = self._x_path _styles = [(repr(x), y) for x, y in MarkerStyle.markers.items()] -_styles.sort(key = lambda x: x[1]) +_styles.sort(key=lambda x: x[1]) MarkerStyle.style_table = ( MarkerStyle.style_table % '\n'.join(['%-30s %-33s' % ('``%s``' % x, y) for (x, y) in _styles])) From 0210aa51efa33f932e668daea0e69023a727aebe Mon Sep 17 00:00:00 2001 From: Nelle Varoquaux Date: Fri, 1 Mar 2013 12:31:01 +0100 Subject: [PATCH 2/4] MEP10 - documentation improvements on the markers module --- doc/api/markers_api.rst | 12 ++++ lib/matplotlib/lines.py | 8 ++- lib/matplotlib/markers.py | 116 ++++++++++++++++++++++++++------------ 3 files changed, 97 insertions(+), 39 deletions(-) create mode 100644 doc/api/markers_api.rst diff --git a/doc/api/markers_api.rst b/doc/api/markers_api.rst new file mode 100644 index 000000000000..7dfcb2eac38b --- /dev/null +++ b/doc/api/markers_api.rst @@ -0,0 +1,12 @@ +******* +Markers* +****** + + +:mod:`matplotlib.markers` +======================== + +.. automodule:: matplotlib.markers + :members: + :undoc-members: + :show-inheritance: diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index b30e89111580..9640eb492f01 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -816,9 +816,13 @@ def set_marker(self, marker): """ Set the line marker - %(MarkerTable)s + Parameters + ----------- + + marker: marker style + See `~matplotlib.markers` for full description of possible + argument - %(MarkerAccepts)s """ self._marker.set_marker(marker) diff --git a/lib/matplotlib/markers.py b/lib/matplotlib/markers.py index ae2b703f83ff..13104b980c9a 100644 --- a/lib/matplotlib/markers.py +++ b/lib/matplotlib/markers.py @@ -2,42 +2,60 @@ This module contains functions to handle markers. Used by both the marker functionality of `~matplotlib.axes.Axes.plot` and `~matplotlib.axes.Axes.scatter`. -""" - -import textwrap -import numpy as np - -from cbook import is_math_text, is_string_like, is_numlike, iterable -import docstring -from matplotlib import rcParams -from path import Path -from transforms import IdentityTransform, Affine2D +All possible markers are defined here: -# special-purpose marker identifiers: -(TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN, - CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN) = range(8) - - -class MarkerStyle(object): - style_table = """ ============================== =============================================== marker description ============================== =============================================== -%s +"." 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 +"8" octagon +"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 +None nothing +" " nothing +"" nothing ``'$...$'`` render the string using mathtext. -*verts* a list of (x, y) pairs used for Path vertices. -path a :class:`~matplotlib.path.Path` instance. -(*numsides*, *style*, *angle*) see below +`verts` a list of (x, y) pairs used for Path vertices. +path a `~matplotlib.path.Path` instance. +(`numsides`, `style`, `angle`) see below ============================== =============================================== -The marker can also be a tuple (*numsides*, *style*, *angle*), which +The marker can also be a tuple (`numsides`, `style`, `angle`), which will create a custom, regular symbol. - *numsides*: + `numsides`: the number of sides - *style*: + `style`: the style of the regular symbol: ===== ============================================= @@ -46,19 +64,41 @@ class MarkerStyle(object): 0 a regular polygon 1 a star-like symbol 2 an asterisk - 3 a circle (*numsides* and *angle* is ignored) + 3 a circle (`numsides` and `angle` is ignored) ===== ============================================= - *angle*: + `angle`: the angle of rotation of the symbol, in degrees -For backward compatibility, the form (*verts*, 0) is also accepted, -but it is equivalent to just *verts* for giving a raw set of vertices +For backward compatibility, the form (`verts`, 0) is also accepted, +but it is equivalent to just `verts` for giving a raw set of vertices that define the shape. """ +import numpy as np + +from cbook import is_math_text, is_string_like, is_numlike, iterable +import docstring +from matplotlib import rcParams +from path import Path +from transforms import IdentityTransform, Affine2D + +# special-purpose marker identifiers: +(TICKLEFT, TICKRIGHT, TICKUP, TICKDOWN, + CARETLEFT, CARETRIGHT, CARETUP, CARETDOWN) = range(8) + + +class MarkerStyle(object): + """ + Markers object + + """ + # FIXME: get rid of this + style_table = """""" + # TODO: Automatically generate this - accepts = """ACCEPTS: [ %s | ``'$...$'`` | *tuple* | *Nx2 array* ]""" + # Get rid of this + accepts = """""" markers = { '.': 'point', @@ -110,6 +150,16 @@ class MarkerStyle(object): _point_size_reduction = 0.5 def __init__(self, marker=None, fillstyle='full'): + """ + + Parameters + ---------- + marker : string or array_like, optional, default: None + See the descriptions of possible markers in the module docstring. + + fillstyle : string, optional, default: 'full' + 'full', 'left", 'right', 'bottom', 'top', 'none' + """ self._fillstyle = fillstyle self.set_marker(marker) self.set_fillstyle(fillstyle) @@ -720,13 +770,5 @@ def _set_x(self): _styles = [(repr(x), y) for x, y in MarkerStyle.markers.items()] _styles.sort(key=lambda x: x[1]) -MarkerStyle.style_table = ( - MarkerStyle.style_table % - '\n'.join(['%-30s %-33s' % ('``%s``' % x, y) for (x, y) in _styles])) - -MarkerStyle.accepts = textwrap.fill( - MarkerStyle.accepts % - ' | '.join(['``%s``' % x for (x, y) in _styles])) - docstring.interpd.update(MarkerTable=MarkerStyle.style_table) docstring.interpd.update(MarkerAccepts=MarkerStyle.accepts) From 2e62806a7313368d10aef267ea0008fb263e8194 Mon Sep 17 00:00:00 2001 From: Nelle Varoquaux Date: Mon, 4 Mar 2013 10:18:56 +0100 Subject: [PATCH 3/4] DOC improvements on the markers module --- lib/matplotlib/lines.py | 6 +++--- lib/matplotlib/markers.py | 39 ++++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index 9640eb492f01..1face41eef41 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -451,9 +451,9 @@ def recache(self, always=False): 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' and - self._markevery is None): + self.axes.name == 'rectilinear' and + self.axes.get_xscale() == 'linear' and + self._markevery is None): self._subslice = True if hasattr(self, '_path'): interpolation_steps = self._path._interpolation_steps diff --git a/lib/matplotlib/markers.py b/lib/matplotlib/markers.py index 13104b980c9a..d8f9acdd807b 100644 --- a/lib/matplotlib/markers.py +++ b/lib/matplotlib/markers.py @@ -78,7 +78,6 @@ import numpy as np from cbook import is_math_text, is_string_like, is_numlike, iterable -import docstring from matplotlib import rcParams from path import Path from transforms import IdentityTransform, Affine2D @@ -89,16 +88,6 @@ class MarkerStyle(object): - """ - Markers object - - """ - # FIXME: get rid of this - style_table = """""" - - # TODO: Automatically generate this - # Get rid of this - accepts = """""" markers = { '.': 'point', @@ -151,6 +140,15 @@ class MarkerStyle(object): def __init__(self, marker=None, fillstyle='full'): """ + MarkerStyle + + Attributes + ---------- + markers : list of known markes + + fillstyles : list of known fillstyles + + filled_markers : list of known filled markers. Parameters ---------- @@ -195,8 +193,16 @@ def get_fillstyle(self): return self._fillstyle def set_fillstyle(self, fillstyle): - # TODO: Raise exception for markers where fillstyle doesn't make sense - assert fillstyle in self.fillstyles + """ + Sets fillstyle + + Parameters + ---------- + fillstyle : string amongst known fillstyles + """ + if fillstyle not in self.fillstyles: + raise ValueError("Unrecognized fillstyle %s" + % ' '.join(self.fillstyles)) self._fillstyle = fillstyle self._recache() @@ -211,7 +217,7 @@ def get_marker(self): def set_marker(self, marker): if (iterable(marker) and len(marker) in (2, 3) and - marker[1] in (0, 1, 2, 3)): + marker[1] in (0, 1, 2, 3)): self._marker_function = self._set_tuple_marker elif isinstance(marker, np.ndarray): self._marker_function = self._set_vertices @@ -767,8 +773,3 @@ def _set_x(self): self._snap_threshold = 3.0 self._filled = False self._path = self._x_path - -_styles = [(repr(x), y) for x, y in MarkerStyle.markers.items()] -_styles.sort(key=lambda x: x[1]) -docstring.interpd.update(MarkerTable=MarkerStyle.style_table) -docstring.interpd.update(MarkerAccepts=MarkerStyle.accepts) From ace102306ef7489c4d64e5f736eb6e59b3c7c71f Mon Sep 17 00:00:00 2001 From: Nelle Varoquaux Date: Mon, 4 Mar 2013 10:27:41 +0100 Subject: [PATCH 4/4] DOC axes now refers to the Markers module instead of concatenating docstrings --- lib/matplotlib/axes.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/matplotlib/axes.py b/lib/matplotlib/axes.py index d80d5459da76..d0d7c9156c01 100644 --- a/lib/matplotlib/axes.py +++ b/lib/matplotlib/axes.py @@ -6190,9 +6190,7 @@ def scatter(self, x, y, s=20, c='b', marker='o', cmap=None, norm=None, which the rows are RGB or RGBA, however. *marker*: - can be one of: - - %(MarkerTable)s + See `~matplotlib.markers` Any or all of *x*, *y*, *s*, and *c* may be masked arrays, in which case all masks will be combined and only unmasked points