Skip to content

Update Axis Title Text Fields in 3D plots to match current 2D plot schema standards #7425

Open
@AdityaSavara

Description

@AdityaSavara

In plotly, the 3D graphs axis title fields are not matching the current (normal) standard for title fields.

In plotly, for regular 2D graphs, the current format is that xaxis and yaxis have a subfield called title which is itself a dictionary/json object, and not a string. The title field used to be a string, but now it's a dictionary, like below, which is a better structure for allowing the formatting of the title to be changed.

The 3D plot structures are like what is shown even further below.

{
    "data": [
        {
            "type": "scatter",
            "x": [1, 2, 3, 4],
            "y": [10, 20, 30, 40],
            "mode": "lines+markers"
        }
    ],
    "layout": {
        "title": "Example 2D Plot",
        "xaxis": {
            "title": {
                "text": "X Axis Label"
            }
        },
        "yaxis": {
            "title": {
                "text": "Y Axis Label"
            }
        }
    }
}

The 3D plot structures are like what is shown below.

{
    "data": [
        {
            "type": "surface",
            "z": [
                [10, 20, 30, 40],
                [20, 30, 40, 50],
                [30, 40, 50, 60],
                [40, 50, 60, 70]
            ],
            "colorscale": "Viridis"
        }
    ],
    "layout": {
        "title": "Example 3D Surface Plot",
        "scene": {
            "xaxis": {"title": "X Axis Label"},
            "yaxis": {"title": "Y Axis Label"},
            "zaxis": {"title": "Z Axis Label"}
        }
    }
}

While the "scene" part is different, the issue of this post is that the xaxis, yaxis, and zaxis title subfields are all strings. They don't have a "text" subfield within them. There are already ways to change the formatting attributes of 3D plot axis titles. However, plotly should change to (or at least support) having a text subfield so that when we are making software we can have automation that doesn't need to do things different for an "xaxis" object of a 2D plot compared to an "xaxis" object of a 3D plot.

There are some axis / title related issues, so it might be a good idea to include this enhancement in the javascript, schema, python, and other versions of plotly at the same time as one of those enhancements.

#7413

#2746

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3backlogfeaturesomething new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions