31
31
"d" thin_diamond
32
32
"|" vline
33
33
"_" hline
34
+ "P" plus (filled)
35
+ "X" x (filled)
34
36
TICKLEFT tickleft
35
37
TICKRIGHT tickright
36
38
TICKUP tickup
@@ -124,6 +126,8 @@ class MarkerStyle(object):
124
126
'd' : 'thin_diamond' ,
125
127
'|' : 'vline' ,
126
128
'_' : 'hline' ,
129
+ 'P' : 'plus_filled' ,
130
+ 'X' : 'x_filled' ,
127
131
TICKLEFT : 'tickleft' ,
128
132
TICKRIGHT : 'tickright' ,
129
133
TICKUP : 'tickup' ,
@@ -145,7 +149,8 @@ class MarkerStyle(object):
145
149
# Just used for informational purposes. is_filled()
146
150
# is calculated in the _set_* functions.
147
151
filled_markers = (
148
- 'o' , 'v' , '^' , '<' , '>' , '8' , 's' , 'p' , '*' , 'h' , 'H' , 'D' , 'd' )
152
+ 'o' , 'v' , '^' , '<' , '>' , '8' , 's' , 'p' , '*' , 'h' , 'H' , 'D' , 'd' ,
153
+ 'P' , 'X' )
149
154
150
155
fillstyles = ('full' , 'left' , 'right' , 'bottom' , 'top' , 'none' )
151
156
_half_fillstyles = ('left' , 'right' , 'bottom' , 'top' )
@@ -827,3 +832,87 @@ def _set_x(self):
827
832
self ._snap_threshold = 3.0
828
833
self ._filled = False
829
834
self ._path = self ._x_path
835
+
836
+ _plus_filled_path = Path ([(1 / 3 , 0 ), (2 / 3 , 0 ), (2 / 3 , 1 / 3 ),
837
+ (1 , 1 / 3 ), (1 , 2 / 3 ), (2 / 3 , 2 / 3 ),
838
+ (2 / 3 , 1 ), (1 / 3 , 1 ), (1 / 3 , 2 / 3 ),
839
+ (0 , 2 / 3 ), (0 , 1 / 3 ), (1 / 3 , 1 / 3 ),
840
+ (1 / 3 , 0 )],
841
+ [Path .MOVETO , Path .LINETO , Path .LINETO ,
842
+ Path .LINETO , Path .LINETO , Path .LINETO ,
843
+ Path .LINETO , Path .LINETO , Path .LINETO ,
844
+ Path .LINETO , Path .LINETO , Path .LINETO ,
845
+ Path .CLOSEPOLY ])
846
+
847
+ _plus_filled_path_t = Path ([(1 , 1 / 2 ), (1 , 2 / 3 ), (2 / 3 , 2 / 3 ),
848
+ (2 / 3 , 1 ), (1 / 3 , 1 ), (1 / 3 , 2 / 3 ),
849
+ (0 , 2 / 3 ), (0 , 1 / 2 ), (1 , 1 / 2 )],
850
+ [Path .MOVETO , Path .LINETO , Path .LINETO ,
851
+ Path .LINETO , Path .LINETO , Path .LINETO ,
852
+ Path .LINETO , Path .LINETO ,
853
+ Path .CLOSEPOLY ])
854
+
855
+ def _set_plus_filled (self ):
856
+ self ._transform = Affine2D ().translate (- 0.5 , - 0.5 )
857
+ self ._snap_threshold = 5.0
858
+ self ._joinstyle = 'miter'
859
+ fs = self .get_fillstyle ()
860
+ if not self ._half_fill ():
861
+ self ._path = self ._plus_filled_path
862
+ else :
863
+ # Rotate top half path to support all partitions
864
+ if fs == 'top' :
865
+ rotate , rotate_alt = 0 , 180
866
+ elif fs == 'bottom' :
867
+ rotate , rotate_alt = 180 , 0
868
+ elif fs == 'left' :
869
+ rotate , rotate_alt = 90 , 270
870
+ else :
871
+ rotate , rotate_alt = 270 , 90
872
+
873
+ self ._path = self ._plus_filled_path_t
874
+ self ._alt_path = self ._plus_filled_path_t
875
+ self ._alt_transform = Affine2D ().translate (- 0.5 , - 0.5 )
876
+ self ._transform .rotate_deg (rotate )
877
+ self ._alt_transform .rotate_deg (rotate_alt )
878
+
879
+ _x_filled_path = Path ([(0.25 , 0 ), (0.5 , 0.25 ), (0.75 , 0 ), (1 , 0.25 ),
880
+ (0.75 , 0.5 ), (1 , 0.75 ), (0.75 , 1 ), (0.5 , 0.75 ),
881
+ (0.25 , 1 ), (0 , 0.75 ), (0.25 , 0.5 ), (0 , 0.25 ),
882
+ (0.25 , 0 )],
883
+ [Path .MOVETO , Path .LINETO , Path .LINETO ,
884
+ Path .LINETO , Path .LINETO , Path .LINETO ,
885
+ Path .LINETO , Path .LINETO , Path .LINETO ,
886
+ Path .LINETO , Path .LINETO , Path .LINETO ,
887
+ Path .CLOSEPOLY ])
888
+
889
+ _x_filled_path_t = Path ([(0.75 , 0.5 ), (1 , 0.75 ), (0.75 , 1 ),
890
+ (0.5 , 0.75 ), (0.25 , 1 ), (0 , 0.75 ),
891
+ (0.25 , 0.5 ), (0.75 , 0.5 )],
892
+ [Path .MOVETO , Path .LINETO , Path .LINETO ,
893
+ Path .LINETO , Path .LINETO , Path .LINETO ,
894
+ Path .LINETO , Path .CLOSEPOLY ])
895
+
896
+ def _set_x_filled (self ):
897
+ self ._transform = Affine2D ().translate (- 0.5 , - 0.5 )
898
+ self ._snap_threshold = 5.0
899
+ self ._joinstyle = 'miter'
900
+ fs = self .get_fillstyle ()
901
+ if not self ._half_fill ():
902
+ self ._path = self ._x_filled_path
903
+ else :
904
+ # Rotate top half path to support all partitions
905
+ if fs == 'top' :
906
+ rotate , rotate_alt = 0 , 180
907
+ elif fs == 'bottom' :
908
+ rotate , rotate_alt = 180 , 0
909
+ elif fs == 'left' :
910
+ rotate , rotate_alt = 90 , 270
911
+ else :
912
+ rotate , rotate_alt = 270 , 90
913
+
914
+ self ._path = self ._x_filled_path_t
915
+ self ._alt_path = self ._x_filled_path_t
916
+ self ._alt_transform = Affine2D ().translate (- 0.5 , - 0.5 )
917
+ self ._transform .rotate_deg (rotate )
918
+ self ._alt_transform .rotate_deg (rotate_alt )
0 commit comments