Background of second axis plot

Hi everyone !

Just a little question, I try to change the background of a second axis plot, but idk how to do that. This is an example of the documentation, my goal is to change the background of the plot with the orange points.

Thank you !

Hi,

could you perhaps share the link to the documentation or the code how you crated this chart?

Yes sure ! Here Inset plots in Python/v3

Hi, could not figure out how to do what you would like to achieve. This is something you could do, but it’s not very good looking:

import plotly.graph_objs as go

trace1 = go.Scatter(
    x=[1, 2, 3],
    y=[4, 3, 2]
)
trace2 = go.Scatter(
    x=[20, 30, 40],
    y=[30, 40, 50],
    xaxis='x2',
    yaxis='y2',
)
trace3 = go.Scatter(
    x=[20, 40],
    y=[50, 50],
    xaxis='x2',
    yaxis='y2',
    fill='tozeroy',
    mode='text',
    showlegend=False
)
data = [trace1, trace2, trace3]
layout = go.Layout(
    xaxis2=dict(
        domain=[0.6, 0.95],
        anchor='y2'
    ),
    yaxis2=dict(
        domain=[0.6, 0.95],
        anchor='x2',
    )
)
fig = go.Figure(data=data, layout=layout)
fig.show()

Another option could be adding a shape at the corresponding position.