Skip to content

Switch AxisArtist to use standard tick directions. #19102

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

Closed
wants to merge 1 commit into from

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Dec 11, 2020

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
    test
    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
Copy link
Contributor

leejjoon commented Nov 16, 2022

  • 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.

image

@leejjoon
Copy link
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
Copy link
Contributor Author

anntzer commented Nov 16, 2022

@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.)

@leejjoon
Copy link
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?

@leejjoon
Copy link
Contributor

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

image
image

@anntzer
Copy link
Contributor Author

anntzer commented Nov 21, 2022

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

@anntzer
Copy link
Contributor Author

anntzer commented Jan 7, 2023

Superseded by #24553.

@anntzer anntzer closed this Jan 7, 2023
@anntzer anntzer deleted the aa-tickdir branch January 7, 2023 13:39
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.

2 participants