You have two options. You could use thelegendgrouptitle
and set an empty string to the name
or set the name
and don’t use the legendgrouptitle
In either solution you have to set the showlegend=False
initially and change that in one of the traces to showlegend=True
afterwards.
import plotly.graph_objects as go
import numpy as np
cols = 3
rows = 9
# create data
a = np.repeat(np.arange(1, rows+1), cols, axis=-1)
a = a.reshape((rows, cols))
# create figure
fig = go.Figure()
for idx in range(rows):
fig.add_trace(
go.Scatter3d(
x=[a[idx, 0]],
y=[a[idx, 1]],
z=[a[idx, 2]],
name='',
mode='markers',
marker_color='red',
showlegend=False,
legendgroup='Arc_x1',
legendgrouptitle={'text':'Arc_x1'}
),
)
#
fig.update_traces({'showlegend':True}, selector=0)
fig.show()
import plotly.graph_objects as go
import numpy as np
cols = 3
rows = 9
# create data
a = np.repeat(np.arange(1, rows+1), cols, axis=-1)
a = a.reshape((rows, cols))
# create figure
fig = go.Figure()
for idx in range(rows):
fig.add_trace(
go.Scatter3d(
x=[a[idx, 0]],
y=[a[idx, 1]],
z=[a[idx, 2]],
name='Arc_x1',
mode='markers',
marker_color='red',
showlegend=False,
legendgroup='Arc_x1',
#legendgrouptitle={'text':'Arc_x1'}
),
)
#
fig.update_traces({'showlegend':True}, selector=0)
fig.show()