Hi all,
I’m trying to do scatterplot with marker of different sizes. I want the legend marker to scale with the marker size, but the scaling stops as the size reaches a certain threshold.
See this example (code below) you see that even though I tried to increase the spacing between legend items and increased the fontsize the orange marker remains small:
Is it possible to have the size of the marker in the legend match the size of the marker, removing the max allowed size?
PS: I come up with this problem while trying to make a legend for a bubble chart where I want to show in the legend the meaning of different sizes (regardless of color). From my understanding, the only solution is adding dummy traces with [None] as x and y in order to setup the legend items. But unfortunately I am not able to show sizes above a certain threshold as shown in the example.
Code example:
import plotly.graph_objects as go
fig = go.Figure()
fig.add_trace(go.Scatter(
x=[1, 2, 3, 4, 5],
y=[1, 2, 3, 4, 5],
mode='markers',
marker={'size':10},
legendgroup='one',
))
fig.add_trace(go.Scatter(
x=[1, 2, 3, 4, 5],
y=[5, 4, 3, 2, 1],
mode='markers',
marker={'size':100},
legendgroup='two',
))
fig.update_layout(legend= {'itemsizing': 'trace', 'tracegroupgap': 100, 'font_size': 40 })
fig.show()