Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2k
Fix for #7416: Hidden ticklabels with ticklabelposition "inside" take up plot space#7417
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Hidden ticklabels don't take up space anymore.
…ke up space.Also use floating point comparison in "Test axes minor ticks"
alexcjohnson commentedMay 9, 2025
Nice find and diagnosis@my-tien! I wonder though if there's a better way to do this - specifically, adding this whole extra loop at the end, in addition to being unnecessary vs. just doing the desired thing from the start, I worry it will cause those labels to be missing later like if you drag the axis around, either during or after the drag. Instead, I wonder if we can avoid this extra step by instead of plotly.js/src/plots/cartesian/axes.js Line 3654 in8e2a5d7
and here: plotly.js/src/plots/cartesian/axes.js Lines 3712 to 3714 in8e2a5d7
Because unlike |
my-tien commentedMay 9, 2025
Hey Alex, thanks a lot for taking the time! 👍 |
… mode to none.This is actually what we want: the label should not be visible and not take up space.
my-tien commentedMay 13, 2025
@alexcjohnson Pushed new implementation with |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
alexcjohnson commentedMay 15, 2025
@my-tien this looks great. There are some more test failures in |
my-tien commentedMay 15, 2025
The failing tests were exactly those I adjusted so that they passed on my machine. I reverted the changes. |
alexcjohnson commentedMay 16, 2025
Excellent, looks great! This time the image tests actually ran, and for some reason |
- in calculatelabelLevelBbox bbox measurement for hidden labels was broken, because of display none- display 'none' led to repeated calls of adjustTicklabelOverflow that set display to null, then to none, then to null...
my-tien commentedMay 20, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
So the issue is related to automargin logic: A bbox was calculated from the Comments on my attempted fix welcomed as I'm not yet very clear about the required rendering and re-rendering steps. |
my-tien commentedMay 21, 2025
Okay, I think I understand a little bit more what's going on. Next commit incoming soon... But this change will probably change a number of baseline images because hidden tick labels affected a couple of them. |
emilykl commentedMay 21, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
…n labelsThis is a second attempt after846c0ab in which I tried to restore the previous behavior of calcLabelLevelBbox.I now think the hidden label should not contribute to the resulting bbox at all, because it's hidden.This will break baseline tests but should be the correct behavior.
emilykl commentedMay 22, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@alexcjohnson@my-tien One interesting case from the image diffs -- I don't think the rightward image iswrong, since it was kind of just a fortunate edge case that the gridlines were aligned before, but for a user who finds themself in this situation, is there an easy way in the figure definition to force the gridlines to be aligned?
|
emilykl commentedMay 22, 2025
@my-tien The Otherwise this is looking good to me. |
my-tien commentedMay 23, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hi Emily,
I'm not 100% sure what legend you mean, do you mean the yellow box around the colorbar? The colorbar container and the x-axis ticks are now cut-off because the hidden -0.5 label on the y-axis doesn't take up space anymore and therefore doesn't push down the margins, i.e. same behavior as when Compare to the current behavior when automargin is completely turned off, the colorbar container is also cut-off. So if this is a bug, I think it happens somewhere else: |
alexcjohnson commentedMay 23, 2025
The main situation you'd want these aligned is when they're either literally the same x axis or the two x axes are matched. Hopefully that's handled correctly already? Absent that I'd say the behavior here is correct.
Hmph there are a bunch of issues here I'm not sure we ever really considered re: automargin, and I think@my-tien is right that this is not a problem with this PR but with colorbars. This colorbar has default position ( There are also the tick marks, which are apparently not hidden on the x axis but don't trigger automargin even though arguably they should. That's another issue independent of this PR, though I'd call that relatively low-priority: how often do real plots have tick marks with no labels at all? |
my-tien commentedJul 1, 2025
Just to make sure: from my side no additional changes are required since the existing problems weren't caused by this PR, right? |
emilykl commentedJul 3, 2025
@my-tien I believe that's correct, I don't think the Jasmine test failures are related. Could you download the changed baseline images from the "Artifacts" tab of the |
emilykl commentedJul 3, 2025
Could you also merge |
my-tien commentedJul 7, 2025
Merged and updated baseline images |
my-tien commentedJul 16, 2025
Hi@emilykl, is there any chance for this PR to make it into the next release? |
emilykl commentedJul 17, 2025
@my-tien Yes I hope we can get this into the next release. I need to figure out why the test pipelines are failing which I hope to do today (no action required on your part). Thank you for your patience. |
archmoj commentedJul 21, 2025
@my-tien Could you please merge master into this branch? |
emilykl commentedJul 24, 2025
archmoj left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
💃
7d40224 intoplotly:masterUh oh!
There was an error while loading.Please reload this page.
my-tien commentedJul 28, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Thanks@emilykl and@archmoj and@alexcjohnson! <3 |





Uh oh!
There was an error while loading.Please reload this page.
In this PR the text of hidden ticklabels is removed so that they don't take up space anymore.
Before the fix (in upper subplot an invisible label "100" takes up space):
After the fix (the vertical grid lines in the subplots are aligned with each other as expected):
Fixes issue:#7416
Disclaimer
I am required to add that…the software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. in no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.