Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita66501d

Browse files
authored
Merge pull request#18603 from evanberkowitz/bugfix-for-issue-18600
FIX: Accept MarkerStyle as input to errorbarcloses#18600 by using the MarkerStyle copy constructor
2 parentsae47ad2 +981aeb5 commita66501d

File tree

3 files changed

+23
-9
lines changed

3 files changed

+23
-9
lines changed

‎lib/matplotlib/lines.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,8 +1299,7 @@ def update_from(self, other):
12991299
self._solidjoinstyle=other._solidjoinstyle
13001300

13011301
self._linestyle=other._linestyle
1302-
self._marker=MarkerStyle(other._marker.get_marker(),
1303-
other._marker.get_fillstyle())
1302+
self._marker=MarkerStyle(marker=other._marker)
13041303
self._drawstyle=other._drawstyle
13051304

13061305
defset_dash_joinstyle(self,s):

‎lib/matplotlib/markers.py

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
r"""
22
Functions to handle markers; used by the marker functionality of
3-
`~matplotlib.axes.Axes.plot` and `~matplotlib.axes.Axes.scatter`.
3+
`~matplotlib.axes.Axes.plot`, `~matplotlib.axes.Axes.scatter`, and
4+
`~matplotlib.axes.Axes.errorbar`.
45
56
All possible markers are defined here:
67
@@ -216,9 +217,12 @@ def __init__(self, marker=None, fillstyle=None):
216217
"""
217218
Parameters
218219
----------
219-
marker : str or array-like or None, default: None
220-
*None* means no marker. For other possible marker values see the
221-
module docstring `matplotlib.markers`.
220+
marker : str, array-like, Path, MarkerStyle, or None, default: None
221+
- Another instance of *MarkerStyle* copies the details of that
222+
``marker``.
223+
- *None* means no marker.
224+
- For other possible marker values see the module docstring
225+
`matplotlib.markers`.
222226
223227
fillstyle : str, default: 'full'
224228
One of 'full', 'left', 'right', 'bottom', 'top', 'none'.
@@ -283,9 +287,12 @@ def set_marker(self, marker):
283287
284288
Parameters
285289
----------
286-
marker : str or array-like or None, default: None
287-
*None* means no marker. For other possible marker values see the
288-
module docstring `matplotlib.markers`.
290+
marker : str, array-like, Path, MarkerStyle, or None, default: None
291+
- Another instance of *MarkerStyle* copies the details of that
292+
``marker``.
293+
- *None* means no marker.
294+
- For other possible marker values see the module docstring
295+
`matplotlib.markers`.
289296
"""
290297
if (isinstance(marker,np.ndarray)andmarker.ndim==2and
291298
marker.shape[1]==2):

‎lib/matplotlib/tests/test_axes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,6 +1317,14 @@ def test_arc_ellipse():
13171317
ax.add_patch(e2)
13181318

13191319

1320+
deftest_marker_as_markerstyle():
1321+
fix,ax=plt.subplots()
1322+
m=mmarkers.MarkerStyle('o')
1323+
ax.plot([1,2,3], [3,2,1],marker=m)
1324+
ax.scatter([1,2,3], [4,3,2],marker=m)
1325+
ax.errorbar([1,2,3], [5,4,3],marker=m)
1326+
1327+
13201328
@image_comparison(['markevery'],remove_text=True)
13211329
deftest_markevery():
13221330
x=np.linspace(0,10,100)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp