2
2
This module contains functions to handle markers. Used by both the
3
3
marker functionality of `~matplotlib.axes.Axes.plot` and
4
4
`~matplotlib.axes.Axes.scatter`.
5
- """
6
-
7
- import textwrap
8
5
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:
16
7
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 = """
24
8
============================== ===============================================
25
9
marker description
26
10
============================== ===============================================
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
28
46
``'$...$'`` 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
32
50
============================== ===============================================
33
51
34
- The marker can also be a tuple (* numsides*, * style*, * angle* ), which
52
+ The marker can also be a tuple (` numsides`, ` style`, ` angle` ), which
35
53
will create a custom, regular symbol.
36
54
37
- * numsides* :
55
+ ` numsides` :
38
56
the number of sides
39
57
40
- * style* :
58
+ ` style` :
41
59
the style of the regular symbol:
42
60
43
61
===== =============================================
@@ -46,19 +64,41 @@ class MarkerStyle(object):
46
64
0 a regular polygon
47
65
1 a star-like symbol
48
66
2 an asterisk
49
- 3 a circle (* numsides* and * angle* is ignored)
67
+ 3 a circle (` numsides` and ` angle` is ignored)
50
68
===== =============================================
51
69
52
- * angle* :
70
+ ` angle` :
53
71
the angle of rotation of the symbol, in degrees
54
72
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
57
75
that define the shape.
58
76
"""
59
77
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
+
60
99
# TODO: Automatically generate this
61
- accepts = """ACCEPTS: [ %s | ``'$...$'`` | *tuple* | *Nx2 array* ]"""
100
+ # Get rid of this
101
+ accepts = """"""
62
102
63
103
markers = {
64
104
'.' : 'point' ,
@@ -110,6 +150,16 @@ class MarkerStyle(object):
110
150
_point_size_reduction = 0.5
111
151
112
152
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
+ """
113
163
self ._fillstyle = fillstyle
114
164
self .set_marker (marker )
115
165
self .set_fillstyle (fillstyle )
@@ -720,13 +770,5 @@ def _set_x(self):
720
770
721
771
_styles = [(repr (x ), y ) for x , y in MarkerStyle .markers .items ()]
722
772
_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
-
731
773
docstring .interpd .update (MarkerTable = MarkerStyle .style_table )
732
774
docstring .interpd .update (MarkerAccepts = MarkerStyle .accepts )
0 commit comments