22This module contains functions to handle markers. Used by both the
33marker functionality of `~matplotlib.axes.Axes.plot` and
44`~matplotlib.axes.Axes.scatter`.
5- """
6-
7- import textwrap
85
9- import numpy as np
10-
11- from cbook import is_math_text , is_string_like , is_numlike , iterable
12- import docstring
13- from matplotlib import rcParams
14- from path import Path
15- from transforms import IdentityTransform , Affine2D
6+ All possible markers are defined here:
167
17- # special-purpose marker identifiers:
18- (TICKLEFT , TICKRIGHT , TICKUP , TICKDOWN ,
19- CARETLEFT , CARETRIGHT , CARETUP , CARETDOWN ) = range (8 )
20-
21-
22- class MarkerStyle (object ):
23- style_table = """
248============================== ===============================================
259marker description
2610============================== ===============================================
27- %s
11+ "." point
12+ "," pixel
13+ "o" circle
14+ "v" triangle_down
15+ "^" triangle_up
16+ "<" triangle_left
17+ ">" triangle_right
18+ "1" tri_down
19+ "2" tri_up
20+ "3" tri_left
21+ "4" tri_right
22+ "8" octagon
23+ "s" square
24+ "p" pentagon
25+ "*" star
26+ "h" hexagon1
27+ "H" hexagon2
28+ "+" plus
29+ "x" x
30+ "D" diamond
31+ "d" thin_diamond
32+ "|" vline
33+ "_" hline
34+ TICKLEFT tickleft
35+ TICKRIGHT tickright
36+ TICKUP tickup
37+ TICKDOWN tickdown
38+ CARETLEFT caretleft
39+ CARETRIGHT caretright
40+ CARETUP caretup
41+ CARETDOWN caretdown
42+ "None" nothing
43+ None nothing
44+ " " nothing
45+ "" nothing
2846``'$...$'`` render the string using mathtext.
29- * verts* a list of (x, y) pairs used for Path vertices.
30- path a :class: `~matplotlib.path.Path` instance.
31- (* numsides*, * style*, * angle* ) see below
47+ ` verts` a list of (x, y) pairs used for Path vertices.
48+ path a `~matplotlib.path.Path` instance.
49+ (` numsides`, ` style`, ` angle` ) see below
3250============================== ===============================================
3351
34- The marker can also be a tuple (* numsides*, * style*, * angle* ), which
52+ The marker can also be a tuple (` numsides`, ` style`, ` angle` ), which
3553will create a custom, regular symbol.
3654
37- * numsides* :
55+ ` numsides` :
3856 the number of sides
3957
40- * style* :
58+ ` style` :
4159 the style of the regular symbol:
4260
4361 ===== =============================================
@@ -46,19 +64,41 @@ class MarkerStyle(object):
4664 0 a regular polygon
4765 1 a star-like symbol
4866 2 an asterisk
49- 3 a circle (* numsides* and * angle* is ignored)
67+ 3 a circle (` numsides` and ` angle` is ignored)
5068 ===== =============================================
5169
52- * angle* :
70+ ` angle` :
5371 the angle of rotation of the symbol, in degrees
5472
55- For backward compatibility, the form (* verts* , 0) is also accepted,
56- but it is equivalent to just * verts* for giving a raw set of vertices
73+ For backward compatibility, the form (` verts` , 0) is also accepted,
74+ but it is equivalent to just ` verts` for giving a raw set of vertices
5775that define the shape.
5876"""
5977
78+ import numpy as np
79+
80+ from cbook import is_math_text , is_string_like , is_numlike , iterable
81+ import docstring
82+ from matplotlib import rcParams
83+ from path import Path
84+ from transforms import IdentityTransform , Affine2D
85+
86+ # special-purpose marker identifiers:
87+ (TICKLEFT , TICKRIGHT , TICKUP , TICKDOWN ,
88+ CARETLEFT , CARETRIGHT , CARETUP , CARETDOWN ) = range (8 )
89+
90+
91+ class MarkerStyle (object ):
92+ """
93+ Markers object
94+
95+ """
96+ # FIXME: get rid of this
97+ style_table = """"""
98+
6099 # TODO: Automatically generate this
61- accepts = """ACCEPTS: [ %s | ``'$...$'`` | *tuple* | *Nx2 array* ]"""
100+ # Get rid of this
101+ accepts = """"""
62102
63103 markers = {
64104 '.' : 'point' ,
@@ -110,6 +150,16 @@ class MarkerStyle(object):
110150 _point_size_reduction = 0.5
111151
112152 def __init__ (self , marker = None , fillstyle = 'full' ):
153+ """
154+
155+ Parameters
156+ ----------
157+ marker : string or array_like, optional, default: None
158+ See the descriptions of possible markers in the module docstring.
159+
160+ fillstyle : string, optional, default: 'full'
161+ 'full', 'left", 'right', 'bottom', 'top', 'none'
162+ """
113163 self ._fillstyle = fillstyle
114164 self .set_marker (marker )
115165 self .set_fillstyle (fillstyle )
@@ -720,13 +770,5 @@ def _set_x(self):
720770
721771_styles = [(repr (x ), y ) for x , y in MarkerStyle .markers .items ()]
722772_styles .sort (key = lambda x : x [1 ])
723- MarkerStyle .style_table = (
724- MarkerStyle .style_table %
725- '\n ' .join (['%-30s %-33s' % ('``%s``' % x , y ) for (x , y ) in _styles ]))
726-
727- MarkerStyle .accepts = textwrap .fill (
728- MarkerStyle .accepts %
729- ' | ' .join (['``%s``' % x for (x , y ) in _styles ]))
730-
731773docstring .interpd .update (MarkerTable = MarkerStyle .style_table )
732774docstring .interpd .update (MarkerAccepts = MarkerStyle .accepts )
0 commit comments