plotly / plotly.js

Open-source JavaScript charting library behind Plotly and Dash
https://plotly.com/javascript/
MIT License
16.77k stars 1.84k forks source link

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

Open kvanderwijst opened 3 years ago

kvanderwijst commented 3 years ago

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

DrJohnWagner commented 2 years ago

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

nnansters commented 1 year ago

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.

alexcjohnson commented 1 year ago

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.

nnansters commented 1 year ago

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

divyamadhav commented 1 year ago

I ran into the this problem even without setting title standoff

nicolocarissimi commented 1 year ago

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

d-s-t commented 1 year ago

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)"))

Viech commented 6 months ago

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.