I'm getting a Plotly issue.
I need my scatter graph's Y axis to always start at 0. The graph object is created and returned by an auxiliary function as follows:
[go.Scatter(x=time_index,
y=self.data,
name=self.data.name
)]
And then this function returns it and there is another function that actually generates the graph in a dash object, because it is a web application that I need this for.
The thing is that I need to know if there is some attribute inside the go.Scatter object that I can edit in order to always get the Y axis to start at 0.
As you can see in the image below, the Y axis starts at 10k rather than at 0.
Scatter plots use the same positional method of encoding each data point, but I have never heard anyone say that scatterplot axes should start at zero. In most cases, a zero-based axis makes sense, but it ultimately depends on the data and visualization used.
Data viz nerds agree bar charts must start at zero.The bars in a bar chart encode the data by their length, so if we truncate the length by starting the axis at something other than zero, we distort the visual in a bad way.
As far as I know it's not possible to set this property in the go.Scatter object directly, but there is a layout parameter called rangemode
wich you can set to 'tozero'
:
fig.update_yaxes(rangemode="tozero")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With