Bar plot: plot a certain range

Hey!

I have a set of data that I wanna plot as a bar plot. But the interesting points are only between a certain range, which I actually wanna plot. If I manipulate the data by subtracting a certain value, I can plot the right range, but the labels on the y-axis are wrong. I couldn’t find a solution to my problem. Either changing the y-labeling to a custom one or plotting the certain range in the first place. The two pictures show my problem


Hi @Ti_wood,

Welcome to the community! :slightly_smiling_face:

If you want to simply restrict the range of your plot to a pre-defined one, you can use fig.update_yaxes(range=[ymin, ymax]), where ymin and ymax are values you can select. Bar charts will by default start at zero as it is a good practice, but in your specific case this is not needed.

Hope this helps!

Thanks for your reply!
Yeah, I have tried that, but the output is kinda weird as you can see in the picture.

That’s odd… Could you share the code you are using to generate this chart (you can use some fake numbers)?

I found the error:

jpg was set svg before, After changing it to jpg it works just fine. Thanks again for your help.

import plotly.io as pio
pio.renderers.default = "jpg"

1 Like