plotly.js icon indicating copy to clipboard operation
plotly.js copied to clipboard

Showticklabels=false and title_standoff not None moves xaxis-title to top

Open kvanderwijst opened this issue 5 years ago • 8 comments

Very strange indeed.

fig = go.Figure()
fig.add_scatter(x=[1,2,3],y=[5,6,7])
fig.update_xaxes(title='Test', title_standoff=0, showticklabels=False)

produces: image

kvanderwijst avatar Dec 14 '20 11:12 kvanderwijst

I ran into the same problem. But it only occurs for the x axis. Not the y axis.

DrJohnWagner avatar Jan 22 '22 05:01 DrJohnWagner

Running into this as well. I don't think the title_standoff is required to replicate this however, just the showticklabels=False already does the trick here.

nnansters avatar Apr 03 '23 14:04 nnansters

Moved to the plotly.js repo, which is where the fix will need to be. My guess is the fact that it now reproduces without explicit standoff is due to https://github.com/plotly/plotly.js/pull/6428 but its origin is clearly much before that.

alexcjohnson avatar Apr 05 '23 20:04 alexcjohnson

Thanks for checking in on this @alexcjohnson. Let me know if you need any more information to reproduce.

nnansters avatar Apr 05 '23 20:04 nnansters

I ran into the this problem even without setting title standoff

divyamadhav avatar Jun 01 '23 17:06 divyamadhav

Is there any way to prevent this (e.g. with an older plotly version)?

nicolocarissimi avatar Jun 05 '23 10:06 nicolocarissimi

W/A that work for me was to set the color of the ticktext to transparent. fig.update_xaxes(tickfont=dict(color="rgba(0,0,0,0)"))

d-s-t avatar Jul 28 '23 15:07 d-s-t

W/A that work for me was to set the color of the ticktext to transparent. fig.update_xaxes(tickfont=dict(color="rgba(0,0,0,0)"))

One can additionally set a size to shrink the invisible ticks: tickfont=dict(color="rgba(0,0,0,0)", size=1). This still moves the title down a bit compared to before, which can possibly be counteracted with standoff if that's not already set to zero.

mjstahlberg avatar Jan 14 '24 09:01 mjstahlberg