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' )
@@ -818,13 +823,92 @@ def _set_caretrightbase(self):
818
823
self ._path = self ._caret_path_base
819
824
self ._joinstyle = 'miter'
820
825
821
- _x_path = Path ([[- 1.0 , - 1.0 ], [1.0 , 1.0 ],
822
- [- 1.0 , 1.0 ], [1.0 , - 1.0 ]],
823
- [Path .MOVETO , Path .LINETO ,
824
- Path .MOVETO , Path .LINETO ])
825
-
826
826
def _set_x (self ):
827
827
self ._transform = Affine2D ().scale (0.5 )
828
828
self ._snap_threshold = 3.0
829
829
self ._filled = False
830
830
self ._path = self ._x_path
831
+
832
+ _plus_filled_path = Path ([(1 / 3 , 0 ), (2 / 3 , 0 ), (2 / 3 , 1 / 3 ),
833
+ (1 , 1 / 3 ), (1 , 2 / 3 ), (2 / 3 , 2 / 3 ),
834
+ (2 / 3 , 1 ), (1 / 3 , 1 ), (1 / 3 , 2 / 3 ),
835
+ (0 , 2 / 3 ), (0 , 1 / 3 ), (1 / 3 , 1 / 3 ),
836
+ (1 / 3 , 0 )],
837
+ [Path .MOVETO , Path .LINETO , Path .LINETO ,
838
+ Path .LINETO , Path .LINETO , Path .LINETO ,
839
+ Path .LINETO , Path .LINETO , Path .LINETO ,
840
+ Path .LINETO , Path .LINETO , Path .LINETO ,
841
+ Path .CLOSEPOLY ])
842
+
843
+ _plus_filled_path_t = Path ([(1 , 1 / 2 ), (1 , 2 / 3 ), (2 / 3 , 2 / 3 ),
844
+ (2 / 3 , 1 ), (1 / 3 , 1 ), (1 / 3 , 2 / 3 ),
845
+ (0 , 2 / 3 ), (0 , 1 / 2 ), (1 , 1 / 2 )],
846
+ [Path .MOVETO , Path .LINETO , Path .LINETO ,
847
+ Path .LINETO , Path .LINETO , Path .LINETO ,
848
+ Path .LINETO , Path .LINETO ,
849
+ Path .CLOSEPOLY ])
850
+
851
+ def _set_plus_filled (self ):
852
+ self ._transform = Affine2D ().translate (- 0.5 , - 0.5 )
853
+ self ._snap_threshold = 5.0
854
+ self ._joinstyle = 'miter'
855
+ fs = self .get_fillstyle ()
856
+ if not self ._half_fill ():
857
+ self ._path = self ._plus_filled_path
858
+ else :
859
+ # Rotate top half path to support all partitions
860
+ if fs == 'top' :
861
+ rotate , rotate_alt = 0 , 180
862
+ elif fs == 'bottom' :
863
+ rotate , rotate_alt = 180 , 0
864
+ elif fs == 'left' :
865
+ rotate , rotate_alt = 90 , 270
866
+ else :
867
+ rotate , rotate_alt = 270 , 90
868
+
869
+ self ._path = self ._plus_filled_path_t
870
+ self ._alt_path = self ._plus_filled_path_t
871
+ self ._alt_transform = Affine2D ().translate (- 0.5 , - 0.5 )
872
+ self ._transform .rotate_deg (rotate )
873
+ self ._alt_transform .rotate_deg (rotate_alt )
874
+
875
+ _x_filled_path = Path ([(0.25 , 0 ), (0.5 , 0.25 ), (0.75 , 0 ), (1 , 0.25 ),
876
+ (0.75 , 0.5 ), (1 , 0.75 ), (0.75 , 1 ), (0.5 , 0.75 ),
877
+ (0.25 , 1 ), (0 , 0.75 ), (0.25 , 0.5 ), (0 , 0.25 ),
878
+ (0.25 , 0 )],
879
+ [Path .MOVETO , Path .LINETO , Path .LINETO ,
880
+ Path .LINETO , Path .LINETO , Path .LINETO ,
881
+ Path .LINETO , Path .LINETO , Path .LINETO ,
882
+ Path .LINETO , Path .LINETO , Path .LINETO ,
883
+ Path .CLOSEPOLY ])
884
+
885
+ _x_filled_path_t = Path ([(0.75 , 0.5 ), (1 , 0.75 ), (0.75 , 1 ),
886
+ (0.5 , 0.75 ), (0.25 , 1 ), (0 , 0.75 ),
887
+ (0.25 , 0.5 ), (0.75 , 0.5 )],
888
+ [Path .MOVETO , Path .LINETO , Path .LINETO ,
889
+ Path .LINETO , Path .LINETO , Path .LINETO ,
890
+ Path .LINETO , Path .CLOSEPOLY ])
891
+
892
+ def _set_x_filled (self ):
893
+ self ._transform = Affine2D ().translate (- 0.5 , - 0.5 )
894
+ self ._snap_threshold = 5.0
895
+ self ._joinstyle = 'miter'
896
+ fs = self .get_fillstyle ()
897
+ if not self ._half_fill ():
898
+ self ._path = self ._x_filled_path
899
+ else :
900
+ # Rotate top half path to support all partitions
901
+ if fs == 'top' :
902
+ rotate , rotate_alt = 0 , 180
903
+ elif fs == 'bottom' :
904
+ rotate , rotate_alt = 180 , 0
905
+ elif fs == 'left' :
906
+ rotate , rotate_alt = 90 , 270
907
+ else :
908
+ rotate , rotate_alt = 270 , 90
909
+
910
+ self ._path = self ._x_filled_path_t
911
+ self ._alt_path = self ._x_filled_path_t
912
+ self ._alt_transform = Affine2D ().translate (- 0.5 , - 0.5 )
913
+ self ._transform .rotate_deg (rotate )
914
+ self ._alt_transform .rotate_deg (rotate_alt )
0 commit comments