Zero line location

Hi there,

I need to change the location of yaxis. Normally it starts at x=0 but for some reasons I need it starts at x=2. Guide me what should I do? (I hope there be an option instead of draw line using shapes)

Thanks in advance.

Hi @Bijan,

what exactly are you referring to? Maybe taking this as reference:

import plotly.express as px 
fig = px.scatter(y=[1, 2, 3, -3])
fig.update_yaxes(showline=True, linewidth=2, linecolor='black')

creates:
newplot (1)

1 Like

Hi dear @AIMPED

This is exactly what I needed. But I got a little bit confused. I will ask my doubts and misunderstanding in next comment.

Fast help and fast understanding the issue and fast solve. Really thanks :+1: :muscle: :mechanical_arm:

Glad I could be of help!

I must confess that Iā€™m surprised to have answered your question just by creating an example as base for further discussions :rofl: :hugs:

Yeah :smile: :smile: :smile: :see_no_evil:

The reason of my doubt and misunderstanding was it. By your example that solved :smile:. I all posts I saw that everyone suggested to draw a line if you want to show axis in another point except zero. I think they said it for case that user wants to draw the axis line in the middle of the plot not in the side. Anyway that was helpful for me and will be complete if there be a way to put an arrow along the axis at its end!

Again thanks dear @AIMPED

Hi @Bijan, I think there is no built in way to put an arrow of the end of the axes.

1 Like