I have 3 different chart types on 1 chart using plotly express. I have bar chart, scatter-plot and horizontal line graph. Is it possible to automatically adjust the bar chart with to the size of scatter plot marker size?
I looked around in the API reference and found that you can specify the width
property of the bar plot using an array
bar = go.Bar(y=[1,2,3], x=[2, 4, 6], width=[1, 0.5, 1.5])
But for the scatter plot, it is not that straightforward. You also have the size
property for the marker, just like the bar plot, but it doesnβt translate directly to the size of the marker. You also have the sizemode
property which can be either diameter
or area
and the sizeref
property, which I donβt really understand.
Example for scatter plot:
scatter = go.Scatter(
y=[1, 2, 3],
x=[2, 4, 6],
mode="markers",
marker=dict(
size=[10, 50, 60],
sizemode="area",
sizeref=0.15,
),
)
So to answer your question, you possibly could do it using the properties that Iβve pointed out, just I donβt know if the complexity is worth it