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

Deprecate non-string values as legend labels#16771

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed

Conversation

timhoffm
Copy link
Member

PR Summary

Closes#16567.

if not isinstance(label, str):
cbook.warn_deprecated(
"3.3",
message="Passing non-string objects as legend "
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Can you add a note suggesting that they probably wanted to pass in two lists?

Copy link
MemberAuthor

@timhoffmtimhoffmMar 15, 2020
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I'd rather not. This check is now implemented inLegend with signatureLegend(parent, handles, labels, ..). So the "two lists" does not apply anymore. Otherwise I'd have to make the check inmlegend._parse_legend_args(). But then the parameter inLegend is not checked explicitly - was not before, but I think it should anyway. Furthermore, you can passlabels positionally or by kwarg tolegend(); while the str-check would apply to both, the proposed addition would only make sense for the former.

On the other hand, IMHO it's clear enough to respond on a calllegend(lines) with the messagePassing non-string objects as legend labels is deprecated. It's rather obvious from this that we interpret the only parameter as labels.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I suspect that we are still going to get some confused users, but this is certainly clearer than it currently is!

@anntzer
Copy link
Contributor

There are a lot of places where we accept any object and cast them to strings (e.g. titles, xlabels, etc.) Do we want to move all of them to only accept strings for consistency (I would probably support that)? Alternatively, if we want to get rid of the (very real) confusion of users passing artists to legend(), do we just want to deprecate passing Artists to legend() (which is almost certainly a bug), rather than deprecate all non-strs?

@timhoffm
Copy link
MemberAuthor

timhoffm commentedMar 21, 2020
edited
Loading

Alternatively, if we want to get rid of the (very real) confusion of users passing artists to legend(), do we just want to deprecate passing Artists to legend() (which is almost certainly a bug), rather than deprecate all non-strs?

Gone with that solution (see#16864). We can defer the decision if we want to have a strict str-checking all over the library.

@timhoffm
Copy link
MemberAuthor

Closing in favor of#16864.

@timhoffmtimhoffm deleted the legend-labels-str branchApril 1, 2020 23:33
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@tacaswelltacaswelltacaswell approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
v3.3.0
Development

Successfully merging this pull request may close these issues.

Let legend get the handles from the provided objects if not specified explicitly.
3 participants
@timhoffm@anntzer@tacaswell

[8]ページ先頭

©2009-2025 Movatter.jp