Hi all,
I’m trying to produce a simple line plot with an x-axis rangeslider element with a legend outside the right side of the plot. This is the plot area without a legend:
However, when I go to add a legend the whole plot seems to shrink for no discernible reason, and the x anchor positioning does not have any effect (y anchor positioning works). For example, with the following layout:
fig = go.Figure(data=areas)
fig.update_xaxes(rangeslider_visible=True)
fig.update_layout(
template='simple_white',
width=700,
xaxis = dict(
type='date',
range=[lower_date, upper_date]),
yaxis=dict(
type='linear',
ticksuffix=''),
legend=dict(
yanchor="top",
y=1,
xanchor="left",
x=1.5),
showlegend = True,
margin=dict(pad=5, b=0))
I get the following:
When i try to place the legend to the left of the plot with the following:
legend=dict(
yanchor="top",
y=1,
xanchor="right",
x=-0.1)
I get:
I’ve tried different variations of anchors and legend position, however, none are producing a single column, scrollable legend that I expect to see.
Am I fundamentally misunderstanding how the legend anchors are defined?
Thanks!