Show legend and label axes in plotly 3D scatter plots

You're close! 3D axes are actually embedded in a Scene object. Here is a simple example:

import plotly.plotly as py
from plotly.graph_objs import *

trace1 = Scatter3d(
    x=[1, 2],
    y=[1, 2],
    z=[1, 2],
    name='Legendary'
)
data = Data([trace1])
layout = Layout(
    showlegend=True,
    scene=Scene(
        xaxis=XAxis(title='x axis title'),
        yaxis=YAxis(title='y axis title'),
        zaxis=ZAxis(title='z axis title')
    )
)

FigureWidget(data=data, layout=layout)

enter image description here1

Tags:

Python

Plotly