-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Reinstate & deprecate ContourSet.antialiased #26399
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
Conversation
cb30499
to
0ec8821
Compare
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.
Not sure about the typing question. @ksunden ?
Array is good, we have the normalization in there to ensure that the private variable is always an array (provided it goes through the setter) The general principle is to be forgiving on inputs and specific on outputs, where possible (subclassing relationships can put some generalization pressure on outputs, in some cases, but usually not too much) |
def antialiased(self): | ||
return all(self.get_antialiased()) | ||
|
||
@antialiased.setter |
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.
deprecation needs to be added to the getter and setter individually (otherwise users who use only the setter will not be warned)
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.
This works for both - I've updated the test to show that. I also tried adding the deprecation to both but with different warning messages: this gave me both messages whether I was setting or getting.
In [3]: cs.antialiased = False
<ipython-input-3-e2ba4606272c>:1: MatplotlibDeprecationWarning: The antialiased attribute was deprecated in Matplotlib 3.8 and will be removed two minor releases later. Use set_antialiased instead.
cs.antialiased = False
<ipython-input-3-e2ba4606272c>:1: MatplotlibDeprecationWarning: The antialiased attribute was deprecated in Matplotlib 3.8 and will be removed two minor releases later. Use get_antialiased instead. Note that get_antialiased returns an array.
cs.antialiased = False
@@ -113,6 +112,8 @@ class ContourSet(ContourLabeler, Collection): | |||
@property | |||
def alpha(self) -> float | None: ... | |||
@property | |||
def antialiased(self) -> bool: ... |
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.
setter should be added to the pyi as well
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.
Done
0ec8821
to
035d3e3
Compare
PR summary
Closes #26343
As agreed on last week's call, reinstate
antialiased
as a deprecated property. Useall
to get from the_antialiseds
array to single bool on the way out.There did not seem to be an existing
get_
method so I added one. I've currently typed its output asNDArray
, as that is what it will be due to the way theset_
method works. Would it better to type it asSequence
, consistent with otherCollections.get_...
methods?PR checklist