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 Tick.{gridOn,tick1On,label1On,...} in favor of set_visible.#10088

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

Merged
jklymak merged 2 commits intomatplotlib:masterfromanntzer:tick-visibility
Oct 4, 2018

Conversation

anntzer
Copy link
Contributor

@anntzeranntzer commentedDec 26, 2017
edited
Loading

Visibility attributes should just be set on the underlying artists
(tick.gridline.set_visible, etc.) rather than maintaining yet another
layer of control.


Note that this technically breaks code that overrode thegridOn etc. attributes using properties (such as the old implementation of skewed axes) but I can't think of a reasonable way to emit a warning for these...

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@anntzeranntzerforce-pushed thetick-visibility branch 3 times, most recently from46dfba6 tod13ade3CompareDecember 26, 2017 19:53
@efiring
Copy link
Member

I have mixed feelings about this, so far. The 'tick1On' etc. attributes are ugly but fairly deeply embedded. Is this the time to make such an invasive change? Or would it be just as well to defer it for a more thorough overhaul of the overly complex and sluggish Tick/Axis/Spine system? Maybe we will never get to that, though.

@anntzer
Copy link
ContributorAuthor

I don't think the system isthat deeply embedded (but it has been around for a while, for sure). The deprecation is basically just replacing the attributes by calls to set_visible throughout; the only complication is with code that proxies these attributes using properties (i.e., the skew axes example), but this kind of code is always going to interact in a tricky manner with deprecations (because we arguably can't cover all possible ways in which our attributes have been proxied...).

@tacaswell
Copy link
Member

I do not disagree it simplifies things, but I am not sure it is worth the disruption in this case.

attn@astrofrog Does this cause issues for WCSAxes?

@dopplershift
Copy link
Contributor

The changes forSkewT seem sensible to me. I hadn't seenExitStack before. Certainly I'm a bit 👍 on having one way to handle things (i.e.set_visible) across the library.

Would this work today if I stole thedraw() implementation?

@anntzer
Copy link
ContributorAuthor

anntzer commentedMar 28, 2018
edited
Loading

Should work, but haven't tried :)
ExitStack is not really necessary (if you want py2 e.g., although a backport is available too), you can do the same with explicitly storing the original visibility state and restoring it in a finally clause. But I like ExitStacks...

@astrofrog
Copy link
Contributor

I don't think this will cause issues for WCSAxes, though it will require some updates in APLpy (https://github.com/aplpy/aplpy/blob/eb09ec39506db2da91f92a383016d1328df731c3/aplpy/colorbar.py#L133) but I can live with that.

@anntzeranntzerforce-pushed thetick-visibility branch 2 times, most recently frome9d013d to20cb675CompareMay 3, 2018 21:16
@anntzer
Copy link
ContributorAuthor

Not going to insist on marking this as RC, but still bumping the suggestion up.

@tacaswell
Copy link
Member

I am ok with this in principle, needs a rebase and version updates.

@anntzer
Copy link
ContributorAuthor

done

@timhoffm
Copy link
Member

There are a number of cases (most notablyupdate_position() anddraw()) that were previously only executed conditionally on the visibility.

I agree that updating always is the more correct thing to do (otherwise the value is not correct when enabling visibility later on.). On the other hand, I'm a bit concerned of the performance impact. Have you evaluated this?

@anntzer
Copy link
ContributorAuthor

I haven't, but I also think that it is the correct thing to do. Obviously it would be possible to hide them back again under a check for get_visible() but the semantics would be so-slightly different (if someone was really relying on that) and I don't think it's a good feature to keep anyways...
Can probably do a proper benchmark at some point, if you feel it's necessary.

Copy link
Member

@jklymakjklymak left a comment

Choose a reason for hiding this comment

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

Seems fine, except for the ExitStack context stuff, which I don't follow, and hence is maybe a bit obtuse for a user example.

Does this have a slight behaviour change. Before if we set things while the label was not on it didn't have an affect. Now the label is not visible, but you do change the properties. So if the user turns the labels on again, they will get different results I think with this PR than before. OTOH I think the results they will get w/ this PR are more correct, so I'm OK w/ the change.

def label2On(self, value):
self._label2On = value
def draw(self, renderer):
with ExitStack() as stack:
Copy link
Member

Choose a reason for hiding this comment

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

This is kind of mysterious for an example w/o a comment why you need it.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

added an explanation, I hope it helps

@jklymak
Copy link
Member

CI failures unrelated...

@efiring, you expressed misgivings. Are you placated, or ?? If so, I'll merge...

@efiring
Copy link
Member

OK to merge once it passes the tests.

@jklymak
Copy link
Member

@anntzer after a rebase feel free to merge once it passes tests....

Visibility attributes should just be set on the underlying artists(`tick.gridline.set_visible`, etc.) rather than maintaining yet anotherlayer of control.
@anntzer
Copy link
ContributorAuthor

Done (modulo appveyor which is queued, but there's no reason for it to fail :p).

@ImportanceOfBeingErnest
Copy link
Member

Thelabel attribute, which was an alias forlabel1, has been deprecated.

This will hit every call toseaborn.heatmap, which is a pretty common function inside seaborn.

@jklymak
Copy link
Member

will it be a problem for seaborn to replace bylabel1?

@ImportanceOfBeingErnest
Copy link
Member

I mean it used to be a simple alias,self.label = self.label1. So that shouldn't be a problem. I just wanted to make sure we are aware of the implication that once 3.1 is released thousands of seaborn users will get some warning message.

@timhoffm
Copy link
Member

Good point. We shouldn't do that.

tacaswell reacted with thumbs up emoji

tacaswell added a commit to tacaswell/seaborn that referenced this pull requestMar 9, 2019
The Tick.label property will be deprecated and begin warning in afuture version of Matplotlib.  Explicitly using the correct propertywill avoid this.Seematplotlib/matplotlib#10088 andmatplotlib/matplotlib#13631
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dopplershiftdopplershiftdopplershift approved these changes

@jklymakjklymakjklymak approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.1.0
Development

Successfully merging this pull request may close these issues.

8 participants
@anntzer@efiring@tacaswell@dopplershift@astrofrog@timhoffm@jklymak@ImportanceOfBeingErnest

[8]ページ先頭

©2009-2025 Movatter.jp