0

I have been trying to make a scatterplot matrix using plotly go function splom with moderate success (can't show the actual plot, sorry), but I would like to modify 2 things:

-Axis are automatically and independently scaled to the values of each marker, while I need them to have the same scale in both axis.

-I would like to add a diagonal line to each plot.

Each plot compares the Outgroup f3 statistics of the same population at different points in time in relationship with other populations, so the whole point of the plot is to see if there is any deviation of the diagonal.

My code right now looks like this:

fig = go.Figure(data=go.Splom(
                dimensions=[dict(label='Period1',
                                 values=p1['est'].astype("float"),
                                 axis=dict(matches=True,type="linear"),
                                 ),
                            dict(label='Period2',
                                 values=p2['est'].astype("float"),
                                 axis=dict(matches=True,type="linear")),
                            dict(label='Period3',
                                 values=p3['est'].astype("float"),
                                 axis=dict(matches=True,type="linear")),
                            dict(label='Period4',
                                 values=p4['est'].astype("float"),
                                 axis=dict(matches=True,type="linear")),
                            dict(label='Period5',
                                 values=p5['est'].astype("float"),
                                 axis=dict(matches=True,type="linear"))],
                diagonal_visible=False, # remove plots on diagonal
                showupperhalf=False,
                text=p1['pop2'],
                marker=dict(color=list(pop_col),
                            showscale=False, # colors encode categorical variables
                            line_color='white', line_width=0.5)
                ))


fig.update_layout(
    title='Outgroup f3 statistics per period',
    width=1600,
    height=1600,
)

fig.show()

Any idea of how to do this?

Thanks.

  • 1
    The following code can be used to set the range of each axis, `fig.update_layout(xaxis=dict(range=[0.0,8.0]), xaxis2=dict(range=[0.0,8.0]), xaxis3=dict(range=[0.0,8.0]), xaxis4=dict(range=[0.0,8.0]));fig.update_layout(yaxis=dict(range=[0.0,8.0]), yaxis2=dict(range=[0.0,8.0]), yaxis3=dict(range=[0.0,8.0]), yaxis4=dict(range=[0.0,8.0])) `but there is no facility to easily add lines to each graph, so the graph structure must be analyzed using the functionality provided for development. `full_fig = fig.full_figure_for_development() ;print(full_fig)` – r-beginners Aug 28 '23 at 03:16

0 Answers0