Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
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
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Deprecation of redundant `Tick` attributes | ||
`````````````````````````````````````````` | ||
The ``gridOn``, ``tick1On``, ``tick2On``, ``label1On``, and ``label2On`` | ||
`~.Tick` attributes have been deprecated. Directly get and set the visibility | ||
on the underlying artists, available as the ``gridline``, ``tick1line``, | ||
``tick2line``, ``label1``, and ``label2`` attributes. | ||
The ``label`` attribute, which was an alias for ``label1``, has been | ||
deprecated. | ||
Subclasses that relied on setting the above visibility attributes needs to be | ||
updated; see e.g. :file:`examples/api/skewt.py`. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -10,10 +10,12 @@ | ||
axes that are not orthogonal. This is handled by including a skew component to | ||
the basic Axes transforms. Additional complexity comes in handling the fact | ||
that the upper and lower X-axes have different data ranges, which necessitates | ||
a bunch of custom classes for ticks,spines, and axis to handle this. | ||
""" | ||
from contextlib import ExitStack | ||
from matplotlib.axes import Axes | ||
import matplotlib.transforms as transforms | ||
import matplotlib.axis as maxis | ||
@@ -24,66 +26,28 @@ | ||
# The sole purpose of this class is to look at the upper, lower, or total | ||
# interval as appropriate and see what parts of the tick to draw, if any. | ||
class SkewXTick(maxis.XTick): | ||
def draw(self, renderer): | ||
# When adding the callbacks with `stack.callback`, we fetch the current | ||
# visibility state of the artist with `get_visible`; the ExitStack will | ||
# restore these states (`set_visible`) at the end of the block (after | ||
# the draw). | ||
with ExitStack() as stack: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. added an explanation, I hope it helps | ||
for artist in [self.gridline, self.tick1line, self.tick2line, | ||
self.label1, self.label2]: | ||
stack.callback(artist.set_visible, artist.get_visible()) | ||
needs_lower = transforms.interval_contains( | ||
self.axes.lower_xlim, self.get_loc()) | ||
needs_upper = transforms.interval_contains( | ||
self.axes.upper_xlim, self.get_loc()) | ||
self.tick1line.set_visible( | ||
self.tick1line.get_visible() and needs_lower) | ||
self.label1.set_visible( | ||
self.label1.get_visible() and needs_lower) | ||
self.tick2line.set_visible( | ||
self.tick2line.get_visible() and needs_upper) | ||
self.label2.set_visible( | ||
self.label2.get_visible() and needs_upper) | ||
super(SkewXTick, self).draw(renderer) | ||
def get_view_interval(self): | ||
return self.axes.xaxis.get_view_interval() | ||
Uh oh!
There was an error while loading.Please reload this page.