FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Switch AxisArtist to use standard tick directions. by anntzer · Pull Request #19102 · matplotlib/matplotlib · GitHub

Repository navigation

Switch AxisArtist to use standard tick directions. - #19102

Closed
anntzer wants to merge 1 commit into
matplotlib:mainfrom
anntzer:aa-tickdir
Closed

anntzer wants to merge 1 commit into
matplotlib:mainfrom
anntzer:aa-tickdir

Conversation

anntzer commented Dec 11, 2020

Copy link
Copy Markdown
Contributor

i.e. defaulting to "out". Also support "inout".


I had this patch lying around, and am only posting it because of #19101 (which this implements). Although tests pass, there are a few remaining points:

  • The default change (to "out"), as well as the new feature, have to be documented.

  • There is one point in the old implementation which I do not understand:

        if self._ticklabel_add_angle != self._axislabel_add_angle:
            if ((self.major_ticks.get_visible()  # ???
                 and not self.major_ticks.get_tick_out())
                or (self.minor_ticks.get_visible()
                    and not self.major_ticks.get_tick_out())):
                axislabel_pad = self.major_ticks._ticksize
            else:
                axislabel_pad = 0

I don't understand the conditions in which the pad are zero or nonzero, and don't know either whether the second branch of the or should actually use minor_ticks twice instead of minor_ticks and then major_ticks. Thus I don't know either how the check should be adapted for the "inout" case.

  • I feel like "out" ticks actually look quite ugly when they are kept tangential to the gridline, as can be seen e.g. with demo_curvelinear_grid, which now gives

    I feel like it would actually look much nicer to have ticks perpendicular to the spines?

attn @jasondet I guess, feel free to pick up the patch.

PR Summary

PR Checklist

  • Has pytest style unit tests (and pytest passes).
  • Is Flake 8 compliant (run flake8 on changed files to check).
  • New features are documented, with examples if plot related.
  • Documentation is sphinx and numpydoc compliant (the docs should build without error).
  • Conforms to Matplotlib style conventions (install flake8-docstrings and run flake8 --docstring-convention=all).
  • New features have an entry in doc/users/next_whats_new/ (follow instructions in README.rst there).
  • API changes documented in doc/api/next_api_changes/ (follow instructions in README.rst there).

i.e. defaulting to "out".  Also support "inout".

Would perpendicular work better for "out"?  see e.g.
demo_curvelinear_grid.

leejjoon commented Nov 16, 2022 •
edited
Loading

Copy link
Copy Markdown
Contributor
  • There is one point in the old implementation which I do not understand:
        if self._ticklabel_add_angle != self._axislabel_add_angle:
            if ((self.major_ticks.get_visible()  # ???
                 and not self.major_ticks.get_tick_out())
                or (self.minor_ticks.get_visible()
                    and not self.major_ticks.get_tick_out())):
                axislabel_pad = self.major_ticks._ticksize
            else:
                axislabel_pad = 0

My recollection is that this is to test if the axislabel and the ticklabels are on the same side. If self._ticklabel_add_angle != self._axislabel_add_angle is True, it means that they on different side. In this case, we only need to check if the ticks are on the same side as the axislabel. Also, the second branch of the or should use minor_ticks twice.

Copy link
Copy Markdown
Contributor

I just realized that this is a two-year old PR. It would be still good if this can be merged after some more fix. I can work on it if that is desired.

anntzer commented Nov 16, 2022

Copy link
Copy Markdown
Contributor Author

@leejjoon Feel free to pick it up; it was essentially a proof of concept in reply to #19101.
One thing I would suggest to change, though, is the orientation of ticks with the "out" direction: as noted above, I think it would look nicer if they were actually perpendicular to the box, rather than tangential with the gridline. (Inwards ticks can stay tangential.)

Copy link
Copy Markdown
Contributor

One thing I would suggest to change, though, is the orientation of ticks with the "out" direction: as noted above, I think it would look nicer if they were actually perpendicular to the box, rather than tangential with the gridline. (Inwards ticks can stay tangential.)

For this, I'd like to introduce tickangle_mode. For now, it's argument could be 'auto' (or None), 'normal', and 'parallel'. 'normal' is for perpendicular to the box, 'parallel' is for parallel to gridlines, and 'auto' is 'normal' only if tickdir is 'out'.

However, I don't think these are good choice of option names. Any recommendation?

Copy link
Copy Markdown
Contributor

Here are some exanples. For the floating_axis, I enforced "parallel" mode.


anntzer commented Nov 21, 2022

Copy link
Copy Markdown
Contributor Author

I would perhaps call this tick_orientation={"parallel", "normal", "auto"}. Perhaps @timhoffm can chime in?

anntzer commented Jan 7, 2023

Copy link
Copy Markdown
Contributor Author

Superseded by #24553.

anntzer closed this Jan 7, 2023
anntzer deleted the aa-tickdir branch January 7, 2023 13:39

QuLogic commented Mar 11, 2026

Copy link
Copy Markdown
Member

Actually superseded by #30369 in the end.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL