Inline iter_ticks into _update_ticks, and use that in mplot3d.#13363
Inline iter_ticks into _update_ticks, and use that in mplot3d.#13363timhoffm merged 2 commits intomatplotlib:masterfrom
Conversation
|
Just a little bit of a heads-up. We should probably do a sanity check on the image tests, as I think many of them automatically remove tick labels. |
|
@WeatherGod At least ticks and tick labels on empty 2D and 3D axes look fine. |
| a.set_figure(self.figure) | ||
|
|
||
| @cbook.deprecated("3.1") | ||
| def iter_ticks(self): |
There was a problem hiding this comment.
This looks great, but I wonder if you want a private _locate_ticks and then call it here, and in the _update_ticks. That way the (deprecated) public function doesn't drift from the private implimentation?
There was a problem hiding this comment.
But then (hypothetical, but that's what this discussion is about) changes in _locate_ticks would be reflected in iter_ticks, and you'd need to add additional changelog entries for changes in the behavior of the deprecated method, which seems a bit silly.
|
rebased on top of #13314. |
iter_ticks is only called in one place and the iterator is immediately converted into a list, so we may as well inline it and create the list immediately. Also, we can immediately assign the tick locations and labels, instead of having to carry around the ticks, the locations and the labels as a tuple. Reuse that implementation in axis3d (... which also gains support for minor ticks for free).
|
Updated another test that suffered from the same issue as #13314 (comment) (minor tick overstrike changes). |
| ``Axis.iter_ticks`` (which only served as a helper to the private | ||
| ``Axis._update_ticks``) is deprecated. | ||
|
|
||
| The signature of the (private) ``Axis._update_ticks`` has been changed to not |
There was a problem hiding this comment.
axis_artist.AxisArtist._update_ticks() also takes a renderer argument; and it uses it. Not quite clear if we want to keep the APIs similar in both worlds.
There was a problem hiding this comment.
They don't even return the same kind of things (one returns a list of ticks, the other returns a bounding box) so I wouldn't worry about that.
| ``Axis.iter_ticks`` (which only served as a helper to the private | ||
| ``Axis._update_ticks``) is deprecated. | ||
|
|
||
| The signature of the (private) ``Axis._update_ticks`` has been changed to not |
…nd use that in mplot3d.
…363-on-v3.1.x Backport PR #13363 on branch v3.1.x (Inline iter_ticks into _update_ticks, and use that in mplot3d.)
In matplotlib#13363 when `iter_ticks` was deprecated the in-lined logic did not account for the updates from matplotlib#13314.
In matplotlib#13363 when `iter_ticks` was deprecated the in-lined logic did not account for the updates from matplotlib#13314.
In matplotlib#13363 when `iter_ticks` was deprecated the in-lined logic did not account for the updates from matplotlib#13314.
iter_ticks is only called in one place and the iterator is immediately
converted into a list, so we may as well inline it and create the list
immediately. Also, we can immediately assign the tick locations and
labels, instead of having to carry around the ticks, the locations and
the labels as a tuple.
Reuse that implementation in axis3d (... which also gains support for
minor ticks for free).
xref #13314 (comment).
PR Summary
PR Checklist