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

Commitc73d353

Browse files
committed
Cleanup code for format processing
1 parent2219872 commitc73d353

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

‎lib/matplotlib/axes/_base.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,6 @@ def __call__(self, ax, renderer):
117117
self._transform-ax.figure.transSubfigure)
118118

119119

120-
_FORMAT_UNSET='None'
121-
122-
123120
def_process_plot_format(fmt):
124121
"""
125122
Convert a MATLAB style color/line style format string to a (*linestyle*,
@@ -134,7 +131,7 @@ def _process_plot_format(fmt):
134131
135132
The format is absolute in the sense that if a linestyle or marker is not
136133
defined in *fmt*, there is no line or marker. This is expressed by
137-
returning_FORMAT_UNSET for the respective quantity.
134+
returning'none' for the respective quantity.
138135
139136
See Also
140137
--------
@@ -203,9 +200,9 @@ def _process_plot_format(fmt):
203200
iflinestyleisNoneandmarkerisNone:
204201
linestyle=mpl.rcParams['lines.linestyle']
205202
iflinestyleisNone:
206-
linestyle=_FORMAT_UNSET
203+
linestyle='none'
207204
ifmarkerisNone:
208-
marker=_FORMAT_UNSET
205+
marker='none'
209206

210207
returnlinestyle,marker,color
211208

@@ -471,13 +468,17 @@ def _plot_args(self, tup, kwargs, return_kwargs=False):
471468
# check for conflicts between fmt and kwargs
472469
if (fmt.lower()!='none'
473470
andprop_nameinkwargs
474-
andval!=_FORMAT_UNSET):
471+
andval!='none'):
475472
# Technically ``plot(x, y, 'o', ls='--')`` is a conflict
476473
# because 'o' implicitly unsets the linestyle
477-
# (linestyle=_FORMAT_UNSET).
474+
# (linestyle='none').
478475
# We'll gracefully not warn in this case because an
479476
# explicit set via kwargs can be seen as intention to
480477
# override an implicit unset.
478+
# Note: We don't val.lower() != 'none' because val is not
479+
# necessarily a string (can be a tuple for colors). This
480+
# is safe, because *val* comes from _process_plot_format()
481+
# which only returns lowercase 'none'.
481482
_api.warn_external(
482483
f"{prop_name} is redundantly defined by the "
483484
f"'{prop_name}' keyword argument and the fmt string "

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp