@palben0 As long as you set margin_l=50, margin_r=50, there is no space to shift the ticklabels. I modified your code, changing margins, and setting autoshift=False, and anchor=βfreeβ (see below):
import plotly.graph_objects as go
# Figure
fig = go.Figure() # width=800, height=400
# Layout
fig.layout.update(showlegend=False, xaxis_title="X Title",
margin=dict(l=150, r=50, t=80, b=60))
overlaying = ["free", "y"]
side = ["left", "right"]
shift = [-50, 50]
#y axes
for i in range(2):
fig.layout[f'yaxis{i+1}'] = dict(
title=f"Y Axis Title {i+1}",
overlaying=overlaying[i],
side=side[i],
shift=shift[i],
autoshift=False,
anchor="free",
)
# Lines
y = [[1, 2, 3],
[3, 1, 1]]
for i in range(2):
fig.add_trace(go.Scatter(y=y[i],
name=f"line name {i+1}",
mode='lines',
yaxis=f"y{i+1}"))
# Title
fig.update_layout(title="Figure Title",
showlegend=False,)
# Show
fig.show()
Your code still doesnβt shift the axes in any direction, but as you have set the anchor to βfreeβ, the y2 axis is also at the y1 axis location. (which is even worse.)