-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Deprecate MarkerStyle(None). #21074
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate MarkerStyle(None). #21074
Conversation
dc1e568
to
4df79be
Compare
lib/matplotlib/tests/test_axes.py
Outdated
for y, marker in enumerate([ | ||
"none", | ||
*sorted({*matplotlib.markers.MarkerStyle.markers} - {"none"}, | ||
key=lambda x: str(type(x))+str(x))]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried but struggled to work out what's going on here with the change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test simply draws all markers in a single figure, ordered by str(type(x))+str(x)
(not all x
have same type: markers can be str (most of them), but also int or, previously, None, hence the need to convert to str). A previous PR introduced MarkerStyle("none")
, i.e. "none" was added into the MarkerStyle.markers
dict; in order to not change the baseline image, I had to remove it from the list of entries. With this PR, I additionally removed None from the dict; again, in order to not change the baseline image, I had to put it back (using its synonym "none") into the list of entries (at the position where it was previously, i.e. in from of everything else).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would write this as
markers = sorted(matplotlib.markers.MarkerStyle.markers,
key=lambda x: str(type(x))+str(x))
# Since generation of the test image, None was removed but 'none' was
# added. By moving 'none' to the front (=former sorted place of None)
# we can avoid regenerating the test image. This can be removed if the
# test image has to be regenerated for other reasons.
markers.remove('none')
markers = ['none', *markers]
for y, marker in enumerate(markers):
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, done
See docstring change for the confusion that this resolves. We can normalize None inputs on the caller side (and note that directly constructing MarkerStyles is not something that most users need to do).
Deprecate MarkerStyle(None).
Fix two cases of the following deprecation: MatplotlibDeprecationWarning: MarkerStyle(None) is deprecated since 3.6; support will be removed two minor releases later. Use MarkerStyle('') to construct an empty MarkerStyle. See matplotlib/matplotlib#21074
Fix two cases of the following deprecation: MatplotlibDeprecationWarning: MarkerStyle(None) is deprecated since 3.6; support will be removed two minor releases later. Use MarkerStyle('') to construct an empty MarkerStyle. See matplotlib/matplotlib#21074
Fix two cases of the following deprecation: MatplotlibDeprecationWarning: MarkerStyle(None) is deprecated since 3.6; support will be removed two minor releases later. Use MarkerStyle('') to construct an empty MarkerStyle. See matplotlib/matplotlib#21074
Fix two cases of the following deprecation: MatplotlibDeprecationWarning: MarkerStyle(None) is deprecated since 3.6; support will be removed two minor releases later. Use MarkerStyle('') to construct an empty MarkerStyle. See matplotlib/matplotlib#21074
See docstring change for the confusion that this resolves.
We can normalize None inputs on the caller side (and note that directly
constructing MarkerStyles is not something that most users need to do).
PR Summary
PR Checklist
pytest
passes).flake8
on changed files to check).flake8-docstrings
and runflake8 --docstring-convention=all
).doc/users/next_whats_new/
(follow instructions in README.rst there).doc/api/next_api_changes/
(follow instructions in README.rst there).