Splom or scatter_matrix: disabling ticks and labels

This question seems basic, but i canโ€™t find an answer. What is the correct way to disable labels and ticks on a go.Splom() or px.scatter_matrix()?

Thanks in advance!

Regards,

mcpcpc

Hi @mcpcpc and welcome to the Plotly community!

Have you tried using this?

fig.update_xaxes(showticklabels=False)
fig.update_yaxes(showticklabels=False)

@atharvakatre: Thanks for the quick response! Yes, i used this, but it appears to be applied to one subplot of the NxM grid.

here is a small validation sample:


import pandas as pd
import plotly.graph_objects as go
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/iris-data.csv')
fig = go.Figure()
fig.add_trace(
    go.Splom(
        dimensions=[
            dict(label='sepal length', values=df['sepal length']),
            dict(label='sepal width', values=df['sepal width']),
            dict(label='petal length', values=df['petal length']),
            dict(label='petal width', values=df['petal width'])],
        text=df['class']
    )
)
fig.update_xaxes(showticklabels=False)
fig.update_yaxes(showticklabels=False)

@mcpcpc, Yes you are right in the case of Splom or scatter_matrix we canโ€™t control the individual axes as they are implicitly created in the Javascript layer.

Using the example from above thread we can iterate and modify the showticklabels property for each subplot.

import pandas as pd
import plotly.graph_objects as go
df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/iris-data.csv')
fig = go.Figure()
fig.add_trace(
    go.Splom(
        dimensions=[
            dict(label='sepal length', values=df['sepal length']),
            dict(label='sepal width', values=df['sepal width']),
            dict(label='petal length', values=df['petal length']),
            dict(label='petal width', values=df['petal width'])],
        text=df['class']
    )
)
fig.update_layout({"xaxis"+str(i+1): dict(showticklabels = False) for i in range(4)})
fig.update_layout({"yaxis"+str(i+1): dict(showticklabels = False) for i in range(4)})
2 Likes

@atharvakatre: This is perfect. Thank you!

1 Like

Hello,

Thanks for answering questions in this thread! I am in a similar situation in the javascript version of plotly. I am creating a SPLOM, and I want the following styling for each subplot:

          xaxis: {
            linecolor: "black",
            linewidth: 2,
            ticks: "outside",
            mirror: true,
            showline: true,
            showgrid: false,
            ticklen: 0,
            showticklabels: false,
            zeroline: false,
          },
          yaxis: {
            linecolor: "black",
            linewidth: 2,
            ticks: "outside",
            mirror: true,
            showline: true,
            showgrid: false,
            ticklen: 0,
            showticklabels: false,
            zeroline: false,
          },

Adding this to the layout directly does (unsurprisingly) not work. Is there any solution for it?

Kind regards