✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Log plot in plotly.py issues


Having some issues with log plots in py. First issue is when I define log axes ticks the y-axis label flies off to the side - I raised this on git here - https://github.com/plotly/plotly.py/issues/2359

And today I have tried to get my Y-axis to start at 0.

I start with this plot:

Which doesn’t start at 0 on the Y. So I first tried to set


In the update_layout method but this didn’t appear to do anything.
So I set the axes manually using


as the max point is ~150. This results in a weird compressed plot:

Which even when I zoom in on doesn’t actually seem to have started at 0?:

Any ideas? I need to start the Y-axis at 0. I’m not even too bothered about having the max set to 200 - it’s fine as it was in the original plot.


Hi @gt91 welcome to the forum! The values you pass in yaxis_range need to be the log10 of the bounds, for example if your max data point is 200, you will pas np.log10(200)=2.3. As for 0, log of 0 is not defined but maybe you meant 0=np.log10(1). In this case, you should pass (0, 2.3).

Hi @Emmanuelle, thanks - I was being a bit dense there. That all makes sense. Any idea about the y-axis label flying off to the side?

I answered directly in the issue - seems to be an automargin problem.