How to display the borders and grid lines of each subplot in a matrix scatter plot

Hey @leavor,

I found a way to display the gridlines, the borders however are similar to this topic.

import pandas as pd
import numpy as np
import plotly.graph_objects as go


data = {
    '收入': np.random.randint(30000, 90000, 50),
    '教育程度': np.random.randint(12, 21, 50),
    '年龄': np.random.randint(20, 45, 50),
    '住址': np.random.randint(1, 15, 50),
    '服务处所': np.random.randint(1, 15, 50)
}
df = pd.DataFrame(data)
fig = go.Figure(
    data=go.Splom(
        dimensions=[
            dict(label="收入", values=df["收入"]),
            dict(label="教育程度", values=df["教育程度"]),
            dict(label="年龄", values=df["年龄"]),
            dict(label="住址", values=df["住址"]),
            dict(label="服务处所", values=df["服务处所"])
        ],
        diagonal=dict(visible=False)
    )
)

your_values = dict(
    showline=True,
    linewidth=1,
    linecolor='black',
    mirror=True,
    gridcolor='#e5e5e5',
    ticks='outside',
)


fig.update_layout(
    width=800,
    height=600,
    plot_bgcolor='white',
    paper_bgcolor='white',
    template={"layout":{"xaxis":your_values, "yaxis": your_values}}
)

fig.show()
1 Like