Hi All,
I noticed that if the axis tick values are whole numbers- such as 1.0, 2.0, 3.0 etc., then plotly shows them as integers - 1, 2, 3 etc.
Here is a basic code sample to explain this issue -
import plotly.graph_objects as go
def tick_text():
y = [1.0, 1.1, 1.23, 2.0, 2.1]
x = [1, 2, 3, 4]
fig = go.Figure(go.Scatter(x=x, y=y))
fig.show()
if __name__ == "__main__":
tick_text()
And here is the generate plot -
Is there a way to show the whole number y tick valus with 1 decimal place and other ticks with their default precision?
I am aware that I can use tickvals and ticktext like this -
fig.update_layout(
yaxis=dict(
tickmode='array',
tickvals=y,
ticktext=ticktext
)
)
But in this case, I have to provide my own Y axis values and I donβt want that. I want to be able to use scroll and zoom features of Y axis that comes by default when tickmode is set to βautoβ.
Is it possible to somehow stop this conversion of whole numbers to integers in Y axis ticks?
Any help would be highly appreciated.