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