Hello everyone!
i have this simple code
from plotly.graph_objs import *
km=[i for i in range(10)]
m=[0.622*i for i in km]
#KM->[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
#MILES->[0.0, 0.622, 1.244, 1.866, 2.488, 3.11, 3.732, 4.354, 4.976, 5.598]
trace1 = Scatter(
y=m,
x=[i for i in range(10)],
mode='lines',
xaxis='x1',
name="M"
)
trace2 = Scatter(
y=km,
x=[i for i in range(10)],
mode='lines',
xaxis='x2',
name="kM"
)
layout = Layout(
yaxis=layout.YAxis(
title = "y1"
),
xaxis=layout.XAxis(
title= 'Miles'
),
xaxis2=layout.XAxis(
title= 'Kilometers',
side = 'top',
overlaying='x1',domain=[0,0.1]
),
)
data = [trace1, trace2]
fig = Figure(data=data, layout=layout)
fig
Which outputs the folllowing
What i’d want to have is the same thing but with the overlapped axis having a smaller domain, like this:
But specifying domain=[0,0.1] doesn’t seem to work nor have any effect…
Should i specify the domain using the overlaying kw? layout.xaxis | Python | Plotly
If so i’d like to have some help on the syntax, i don’t know how can i specify the domain
thanks everyone for helping