82
82
plt.plot([1, 2, 3], marker=11)
83
83
plt.plot([1, 2, 3], marker=matplotlib.markers.CARETDOWNBASE)
84
84
85
- Markers join and cap styles can be customized by creating a new instance of MarkerStyle.
86
- A MarkerStyle can also have a custom
87
- `~matplotlib.transforms.Transform` allowing it to be arbitrarily rotated or offset.
85
+ Markers join and cap styles can be customized by creating a new instance of
86
+ MarkerStyle.
87
+ A MarkerStyle can also have a custom `~matplotlib.transforms.Transform`
88
+ allowing it to be arbitrarily rotated or offset.
89
+
88
90
Examples showing the use of markers:
89
91
90
92
* :doc:`/gallery/lines_bars_and_markers/marker_reference`
150
152
_empty_path = Path (np .empty ((0 , 2 )))
151
153
152
154
153
- def _fast_transform_combine (t1 , t2 ):
154
- """Combine two transformations where the second one can be None."""
155
- if t2 is None :
156
- return t1 .frozen ()
157
- else :
158
- return (t1 + t2 ).frozen ()
159
-
160
-
161
155
class MarkerStyle :
162
156
"""
163
157
A class representing marker types.
@@ -248,8 +242,9 @@ def __init__(self, marker=_unset, fillstyle=None,
248
242
fillstyle : str, default: :rc:`markers.fillstyle`
249
243
One of 'full', 'left', 'right', 'bottom', 'top', 'none'.
250
244
251
- transform : Affine2D, default: None
252
- Transform that will be combined with the native transform of the marker.
245
+ transform : transforms.Transform, default: None
246
+ Transform that will be combined with the native transform of the
247
+ marker.
253
248
254
249
capstyle : CapStyle, default: None
255
250
Cap style that will override the default cap style of the marker.
@@ -395,7 +390,10 @@ def get_transform(self):
395
390
Return the transform to be applied to the `.Path` from
396
391
`MarkerStyle.get_path()`.
397
392
"""
398
- return _fast_transform_combine (self ._transform , self ._user_transform )
393
+ if self ._user_transform is None :
394
+ return self ._transform .frozen ()
395
+ else :
396
+ return (self ._transform + self ._user_transform ).frozen ()
399
397
400
398
def get_alt_path (self ):
401
399
"""
@@ -411,8 +409,10 @@ def get_alt_transform(self):
411
409
Return the transform to be applied to the `.Path` from
412
410
`MarkerStyle.get_alt_path()`.
413
411
"""
414
- return _fast_transform_combine (self ._alt_transform ,
415
- self ._user_transform )
412
+ if self ._user_transform is None :
413
+ return self ._alt_transform .frozen ()
414
+ else :
415
+ return (self ._alt_transform + self ._user_transform ).frozen ()
416
416
417
417
def get_snap_threshold (self ):
418
418
return self ._snap_threshold
@@ -424,7 +424,7 @@ def get_user_transform(self):
424
424
425
425
def transformed (self , transform : Affine2D ):
426
426
"""
427
- Return a new version of this marker with the transform applied.
427
+ Return a new version of this marker with the transform applied.
428
428
429
429
Parameters
430
430
----------
0 commit comments