Skip to content
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

Reposition tick labels #127

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

czlee
Copy link
Contributor

@czlee czlee commented Mar 23, 2020

This one's a little more involved and changes functionality a little, in a way that I should point out is arguably not backwards-compatible, if other users have been picky about their tick label positioning.

My idea here is to anchor (or align) the tick labels by the point that's "closest" to where the tick is, rather than the horizontal center and vertical baseline. This way, particularly with the parallel axis labels, if lengths of labels of different ticks are different (e.g. "0", "0.25", "0.5"), the length doesn't affect how far the label appears from the tick, and (sometimes) whether it "spills" onto the plot.

For example, on the left axis, when the ticks run horizontally, this PR makes them anchored right-middle, and when they run right-parallel, it makes them anchored right-bottom.

Because the anchors have moved to the nearest point, their offsets could be reduced a little.

There might be other considerations this risks breaking that I don't know about, so happy to discuss. I've just picked up on this package and am using it to plot probability simplex heatmaps, so thanks so much for making your project available!

To illustrate the effect:

Before
image

After
image

Before, clockwise
image

After, clockwise
image

@marcharper
Copy link
Owner

Hi, it looks pretty good on the notebook of examples. However on the example in colorbar_kwargs.py the lower labels intersect the lower axis labels so I think we'd need to adjust the offsets on those as well in line with what you've done here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants