Skip to content

Commit 4c2af3d

Browse files
deep-jkljklymak
andauthored
Update docstrings according to jklymak
Apply suggestions from @jklymak code review Co-authored-by: Jody Klymak <[email protected]>
1 parent 6e02cb2 commit 4c2af3d

File tree

4 files changed

+20
-33
lines changed

4 files changed

+20
-33
lines changed

doc/users/next_whats_new/extending_MarkerStyle.rst

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
New customization of MarkerStyle
22
--------------------------------
33

4-
New MarkerStyle parameters allow control of join style and cap style.
5-
The appearance of individual markers can be further controlled by
6-
transform supplied during creation.
4+
New MarkerStyle parameters allow control of join style and cap style, and for
5+
the user to supply a transformation to be applied to the marker (e.g. a rotation).
76

87
.. plot::
98
:include-source: true

examples/lines_bars_and_markers/marker_reference.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -166,10 +166,8 @@ def split_list(a_list):
166166
# Advanced marker modifications with transform
167167
# ============================================
168168
#
169-
# All markers can be modified by a user transform in MarkerStyle constructor.
170-
# Supplied transform is combined with the default transforms needed for
171-
# selected marker shape (e.g. caret up, caret down). Following example shows
172-
# how user supplied rotation applies to several marker shapes.
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.
173171

174172
common_style = {k: v for k, v in filled_marker_style.items() if k != 'marker'}
175173
angles = [0, 10, 20, 30, 45, 60, 90]
@@ -204,9 +202,8 @@ def split_list(a_list):
204202
# Setting marker cap style and join style
205203
# =======================================
206204
#
207-
# All markers have predefined cap style and join style, but this can be
208-
# overriden during creation of MarkerStyle. Follwing example show how to
209-
# change the cap style and how different styles look.
205+
# Markers have default cap and join styles, but these can be
206+
# customized when creating a MarkerStyle.
210207

211208
from matplotlib.markers import JoinStyle, CapStyle
212209

@@ -240,8 +237,7 @@ def split_list(a_list):
240237
plt.show()
241238

242239
###############################################################################
243-
# Follwing example show how to change the join style and how different styles
244-
# looks like.
240+
# Modifying the join style:
245241

246242
fig, ax = plt.subplots()
247243
fig.suptitle('Marker JoinStyle', fontsize=14)

examples/lines_bars_and_markers/multivariate_marker_plot.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@
44
==============================================
55
66
This example shows how to use different properties of markers to plot
7-
multivariate datasets. Following example shows an illustrative case of
8-
plotting success of baseball throw as an smiley face with size mapped to
9-
the skill of thrower, rotation mapped to the take-off angle, and thrust
10-
to the color of the marker.
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.
1110
"""
1211

1312
import numpy as np

lib/matplotlib/markers.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,9 @@
8282
plt.plot([1, 2, 3], marker=11)
8383
plt.plot([1, 2, 3], marker=matplotlib.markers.CARETDOWNBASE)
8484
85-
Markers have some reasonable default settings for join and cap styles.
86-
However, those can be overriden when creating a new instance of MarkerStyle.
87-
Furthermore, the marker shape can be modified by supplying
88-
`~matplotlib.transforms.Transform` during creation.
89-
Some markers are created as internally rotated shapes (e.g. triangles).
90-
For such cases, both internal and user supplied transforms are combined.
91-
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.
9288
Examples showing the use of markers:
9389
9490
* :doc:`/gallery/lines_bars_and_markers/marker_reference`
@@ -253,16 +249,13 @@ def __init__(self, marker=_unset, fillstyle=None,
253249
One of 'full', 'left', 'right', 'bottom', 'top', 'none'.
254250
255251
transform : Affine2D, default: None
256-
User supplied transformation that will be combined with the
257-
native transformation of selected marker.
252+
Transform that will be combined with the native transform of the marker.
258253
259254
capstyle : CapStyle, default: None
260-
User supplied cap style that will override the default cap
261-
style of selected marker.
255+
Cap style that will override the default cap style of the marker.
262256
263257
joinstyle : JoinStyle, default: None
264-
User supplied join style that will override the default cap
265-
style of selected marker.
258+
Join style that will override the default join style of the marker.
266259
"""
267260
self._marker_function = None
268261
self._user_transform = transform
@@ -431,7 +424,7 @@ def get_user_transform(self):
431424

432425
def transformed(self, transform: Affine2D):
433426
"""
434-
Return new marker with combined transformation.
427+
Return a new version of this marker with the transform applied.
435428
436429
Parameters
437430
----------
@@ -447,15 +440,15 @@ def transformed(self, transform: Affine2D):
447440

448441
def rotated(self, deg=None, rad=None):
449442
"""
450-
Return new marker rotated by specified angle.
443+
Return a new version of this marker rotated by specified angle.
451444
452445
Parameters
453446
----------
454447
deg : float, default: None
455-
Use this parameter to specify rotation angle in degrees.
448+
Rotation angle in degrees.
456449
457450
rad : float, default: None
458-
Use this parameter to specify rotation angle in radians.
451+
Rotation angle in radians.
459452
460453
.. note:: You must specify exactly one of deg or rad.
461454
"""

0 commit comments

Comments
 (0)