Plotly.js: axis automargin moves axis label outside of individual tick labels, not the longest tick label

Created on 20 Apr 2018  路  7Comments  路  Source: plotly/plotly.js

see #2243

Using automargin: true moves axis label outside of tick labels, but only to the tick labels near the axis label, not below the longest tick label.

e.g.,

image

feature

All 7 comments

Thanks @yniknafs - can you work this plot into a codepen/jsfiddle so we can debug?

Made a codepen showing the behavior.

image

Honestly, I think this behavior could work if it wasn't so close to the tick labels. A short term fix may be to just add a bigger buffer? the way it is now, the label can sort of get lose in the tick labels. A few extra pixels could go a long way.

Thanks @yniknafs for the codepen 馃帀

@nicolaskruchten I thought in my fiddling yesterday it looked like in cases like this we were pushing the x title down below all the tick labels... but here we are automatically adjusting the margins but the title just avoids the nearby labels... even if I shorten the really long labels.

So let me toss this back to you, is this a bug or is this how the feature was intended to work so this is a feature request?

@yniknafs totally agreed that the title/label padding would be nice as an adjustable parameter.

Let me dig into this today, this behaviour does seem at odds with the intended behaviour.

So the current behaviour surprised me, but is actually not a bug: the automargin feature correctly pushes the margins so as to leaves enough room below the tick labels for the axis title's font height, but the axis title doesn't always position itself below the tallest tick label: it positions itself below the tallest tick label above itself which my tests hadn't shown, hence my initial surprise.

So this is not a bug but a reasonable feature request: to be able to control the positioning of the axis title with respect to the labels above it :)

@nicolaskruchten Thanks for the response. I agree - the auto margin is technically doing what it should do. In practice, I think the current functionality could result in a plots that don't look quite right. See image below. I'm kind of stuck between a rock and a hard place with this. Not sure what I can do to make it look right. May have to add my own custom annotation, which isn't pleasant for a dynamic plot that can have different labels / different numbers of bars, etc.

image

Was this page helpful?
0 / 5 - 0 ratings

Related issues

n-riesco picture n-riesco  路  3Comments

tim-sauchuk picture tim-sauchuk  路  3Comments

danielsamuels picture danielsamuels  路  3Comments

emanuelsetitinger picture emanuelsetitinger  路  3Comments

boleslawmaliszewski picture boleslawmaliszewski  路  3Comments