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

Support standard tickdir control (in/out/inout) in axisartist. by anntzer · Pull Request #30369 · matplotlib/matplotlib · GitHub

Repository navigation

Support standard tickdir control (in/out/inout) in axisartist. - #30369

Merged
QuLogic merged 1 commit into
matplotlib:mainfrom
anntzer:aiot
Mar 11, 2026
Merged

QuLogic merged 1 commit into
matplotlib:mainfrom
anntzer:aiot

Conversation

anntzer commented Jul 29, 2025

Copy link
Copy Markdown
Contributor

... and also respect rcParams, which makes axisartist ticks default to pointing outwards, similarly to standard ticks.

Rework the tick direction machinery to also support "inout" (similarly to standard ticks).

One may wonder whether external ticks should really be drawn in the local direction of the gridlines, though, or whether drawing them orthogonal to the axis spine would look better. This PR keeps the old behavior of set_ticks_out(True), but we could later add something like set_tick_direction("out_ortho") (name up to bikeshedding).

While at it, also deprecate the entirely unused
Ticks.locs_angles_labels and LabelBase.locs_angles_labels.

See the modified simple_axis_pad example:

and demo_curvelinear grid shows why "out_ortho" may actually be a better option:

PR summary

PR checklist

github-actions Bot added Documentation: examples files in galleries/examples Documentation: user guide files in galleries/users_explain or doc/users labels Jul 29, 2025
anntzer force-pushed the aiot branch 2 times, most recently from a80878e to 6831cb5 Compare July 29, 2025 23:16

anntzer commented Jul 30, 2025

Copy link
Copy Markdown
Contributor Author

Sure, done.

timhoffm left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Sorry, I'm a bit nit-picky today, but let's improve on code and docs, when we touch it anyway.

anntzer commented Jul 30, 2025

Copy link
Copy Markdown
Contributor Author

No worries, it's good to improve this...

Copy link
Copy Markdown
Member

Some refs still need fixing:

/home/circleci/project/doc/users/explain/toolkits/axisartist.rst:425: WARNING: py:obj reference target not found: Tick.set_tick_direction [ref.obj]3d.Axes3D.get_zinverted
/home/circleci/project/doc/users/explain/toolkits/axisartist.rst:426: WARNING: py:obj reference target not found: Tick.set_ticksize [ref.obj]
/home/circleci/project/doc/users/explain/toolkits/axisartist.rst:431: WARNING: py:obj reference target not found: TickLabels.set_rotation [ref.obj]
/home/circleci/project/doc/users/explain/toolkits/axisartist.rst:432: WARNING: py:obj reference target not found: TickLabels.set_ha [ref.obj]
/home/circleci/project/doc/users/explain/toolkits/axisartist.rst:432: WARNING: py:obj reference target not found: TickLabels.set_va [ref.obj]
/home/circleci/project/doc/users/explain/toolkits/axisartist.rst:437: WARNING: py:obj reference target not found: AxisLabel.set_rotation [ref.obj]
/home/circleci/project/doc/users/explain/toolkits/axisartist.rst:438: WARNING: py:obj reference target not found: AxisLabel.set_ha [ref.obj]
/home/circleci/project/doc/users/explain/toolkits/axisartist.rst:438: WARNING: py:obj reference target not found: AxisLabel.set_va [ref.obj]

anntzer commented Jul 31, 2025

Copy link
Copy Markdown
Contributor Author

Hopefully the missing references are fixed.

# Remove this line when this test image is regenerated.
plt.rcParams['text.kerning_factor'] = 6
plt.rcParams.update({
"text.kerning_factor": 6, "xtick.direction": "in", "ytick.direction": "in"})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Do you intend that all of these be removed in the text-overhaul branch, as text.kerning_factor will be?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I pushed a second commit (as usual, without the actual baseline image updates) where I take advantage of the upcoming text-overhaul branch to update the tests as well; now they are a mix of "in", "out", and "inout" (to test a bit everything). Note that there are also other axisartist tests where there is a high tolerance currently set due to partial updates to the axisartist code; likely those could also have their tolerance set to zero again as the baselines will likely need to be regen'd anyways (I didn't touch them, but I can do it if you prefer -- it's just a grep for tol in the test suite of axisartist).

Let me know if you want me to retarget this to text-overhaul.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I'd rather this get in through regular review, but maybe you can target the second commit to the text-overhaul branch? Not sure if that's too much work though.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

No problem at all, but the second commit only makes sense after the first (feature) goes in to main and main gets merged back into text-overview (so this PR is effectively blocking the final merge-back)? Unless we decide not to take advantage of the opportunity to update the baselines here to test the new functionality.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Well, we already have one approval and I don't think much has changed since then, so I'm sure we can merge this one right now. I can merge main into text-overhaul after that.

anntzer Mar 11, 2026 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

OK, so I dropped the testing commit from this PR; that commit exists now at anntzer@f1777c6 (aiot-tests branch). Right now that commit is atop the main branch (via this PR), I will rebase it atop text-overhaul once this PR is merged into main and main into text-overhaul, and open a PR for it.
(Note that the aiot-tests commit stills builds upon this PR because this one already alters the tests but in a way that fully maintains backcompatibility of baseline images so that tests locally pass; thus the aiot-tests commit also needs to undo these alterations.)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The test suite update is now at #31281.

... and also respect rcParams, which makes axisartist ticks default to
pointing outwards, similarly to standard ticks.

Rework the tick direction machinery to also support "inout" (similarly
to standard ticks).

One may wonder whether external ticks should really be drawn in the
local direction of the gridlines, though, or whether drawing them
orthogonal to the axis spine would look better.  This PR keeps the old
behavior of `set_ticks_out(True)`, but we could later add something like
``set_tick_direction("out_ortho")`` (name up to bikeshedding).

While at it, also deprecate the entirely unused
`Ticks.locs_angles_labels` and `LabelBase.locs_angles_labels`.
anntzer force-pushed the aiot branch 2 times, most recently from f1777c6 to 61b6cdc Compare March 11, 2026 09:06
QuLogic added this to the v3.11.0 milestone Mar 11, 2026
andreas16700 added a commit to andreas16700/matplotlib that referenced this pull request Mar 16, 2026
andreas16700 added a commit to andreas16700/matplotlib that referenced this pull request Mar 16, 2026
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

Labels

Documentation: examples files in galleries/examples Documentation: user guide files in galleries/users_explain or doc/users topic: mpl_toolkit

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL