Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 214ea3f

Browse files
committed
Refactor code, linting.
1 parent 5aa5bbd commit 214ea3f

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

examples/lines_bars_and_markers/marker_reference.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,9 @@ def split_list(a_list):
166166
# Advanced marker modifications with transform
167167
# ============================================
168168
#
169-
# Markers can be modified by passing a transform to the MarkerStyle constructor.
170-
# Following example shows how a supplied rotation is applied to several marker shapes.
169+
# Markers can be modified by passing a transform to the MarkerStyle
170+
# constructor. Following example shows how a supplied rotation is applied to
171+
# several marker shapes.
171172

172173
common_style = {k: v for k, v in filled_marker_style.items() if k != 'marker'}
173174
angles = [0, 10, 20, 30, 45, 60, 90]

examples/lines_bars_and_markers/multivariate_marker_plot.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
==============================================
55
66
This example shows how to use different properties of markers to plot
7-
multivariate datasets. Here we represent a successful baseball throw as a smiley
8-
face with marker size mapped to the skill of thrower, marker rotation to the take-off angle,
9-
and thrust to the marker color.
7+
multivariate datasets. Here we represent a successful baseball throw as a
8+
smiley face with marker size mapped to the skill of thrower, marker rotation to
9+
the take-off angle, and thrust to the marker color.
1010
"""
1111

1212
import numpy as np

lib/matplotlib/markers.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,11 @@
8282
plt.plot([1, 2, 3], marker=11)
8383
plt.plot([1, 2, 3], marker=matplotlib.markers.CARETDOWNBASE)
8484
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+
8890
Examples showing the use of markers:
8991
9092
* :doc:`/gallery/lines_bars_and_markers/marker_reference`
@@ -150,14 +152,6 @@
150152
_empty_path = Path(np.empty((0, 2)))
151153

152154

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-
161155
class MarkerStyle:
162156
"""
163157
A class representing marker types.
@@ -248,8 +242,9 @@ def __init__(self, marker=_unset, fillstyle=None,
248242
fillstyle : str, default: :rc:`markers.fillstyle`
249243
One of 'full', 'left', 'right', 'bottom', 'top', 'none'.
250244
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.
253248
254249
capstyle : CapStyle, default: None
255250
Cap style that will override the default cap style of the marker.
@@ -395,7 +390,10 @@ def get_transform(self):
395390
Return the transform to be applied to the `.Path` from
396391
`MarkerStyle.get_path()`.
397392
"""
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()
399397

400398
def get_alt_path(self):
401399
"""
@@ -411,8 +409,10 @@ def get_alt_transform(self):
411409
Return the transform to be applied to the `.Path` from
412410
`MarkerStyle.get_alt_path()`.
413411
"""
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()
416416

417417
def get_snap_threshold(self):
418418
return self._snap_threshold
@@ -424,7 +424,7 @@ def get_user_transform(self):
424424

425425
def transformed(self, transform: Affine2D):
426426
"""
427-
Return a new version of this marker with the transform applied.
427+
Return a new version of this marker with the transform applied.
428428
429429
Parameters
430430
----------

0 commit comments

Comments
 (0)