143
143
_empty_path = Path (np .empty ((0 , 2 )))
144
144
145
145
146
+ normalization_options = ["none" , "classic" , "bbox" , "bbox-width" , "bbox-area" ,
147
+ "area" ]
148
+ centering_options = ["none" , "classic" , "bbox" , "mass" ]
149
+
150
+
146
151
class MarkerStyle :
147
152
148
153
markers = {
@@ -202,7 +207,7 @@ class MarkerStyle:
202
207
_point_size_reduction = 0.5
203
208
204
209
def __init__ (self , marker = None , fillstyle = None , * ,
205
- normalization = "classic" ):
210
+ normalization = "classic" , centering = "classic" ):
206
211
"""
207
212
Attributes
208
213
----------
@@ -221,16 +226,30 @@ def __init__(self, marker=None, fillstyle=None, *,
221
226
fillstyle : str, optional, default: 'full'
222
227
'full', 'left", 'right', 'bottom', 'top', 'none'
223
228
224
- normalization : str, {'classic', 'none'}, optional, default: "classic"
225
- The normalization of the marker size. Only applies to custom paths
226
- that are provided as array of vertices or `~.path.Path`.
227
- Can take two values:
228
- *'classic'*, being the default, makes sure the marker path is
229
- normalized to fit within a unit-square by affine scaling.
229
+ normalization : str, optional, default: "classic"
230
+ The normalization of the marker size. Can take several values:
231
+ *'classic'*, being the default, makes sure custom marker paths are
232
+ normalized to fit within a unit-square by affine scaling (but
233
+ leaves built-in markers as-is).
234
+ *'bbox-width'*, ensure marker path fits in the unit square.
235
+ *'area'*, rescale so the marker path has unit "signed_area".
236
+ *'bbox-area'*, rescale so that the marker path's bbox has unit
237
+ area.
230
238
*'none'*, in which case no scaling is performed on the marker path.
239
+
240
+ centering : str, optional, default: "classic"
241
+ The centering of the marker. Can take several values:
242
+ *'none'*, being the default, does not translate the marker path.
243
+ The origin in path coordinates is the marker center in this case.
244
+ *'bbox'*, translates the marker path so that its bbox's center is
245
+ at the origin.
246
+ *'center-of-mass'*, translates the marker path so that its center
247
+ of mass it as the origin. See Path.center_of_mass for details.
231
248
"""
232
249
cbook ._check_in_list (["classic" , "none" ], normalization = normalization )
250
+ cbook ._check_in_list (["centering" , "none" ], centering = centering )
233
251
self ._normalize = normalization
252
+ self ._center = centering
234
253
self ._marker_function = None
235
254
self .set_fillstyle (fillstyle )
236
255
self .set_marker (marker )
@@ -319,6 +338,13 @@ def set_transform(self, transform):
319
338
"""
320
339
Sets the transform of the marker. This is the transform by which the
321
340
marker path is transformed.
341
+
342
+ In order to change the marker relative to its current state, make sure
343
+ to compose with the current transform. Remember that the transform on
344
+ the left of the addition side is applied first. For example:
345
+
346
+ >>> spin = mpl.transforms.Affine2D().rotate_deg(90)
347
+ >>> marker.set_transform(marker.get_transform() + spin)
322
348
"""
323
349
self ._transform = transform
324
350
0 commit comments