Px.scatter with markers at different angles


I would like to create a px.scatter() figure with multiple ‘line-ns’ markers at different orientation angles.
Is it possible to pass an array to the “update_traces” marker dict?

fig.update_traces(marker=dict(angle="can I put an array here?))

Another way would be to add multiple traces to fig, a trace for every marker.

Thanks a lot for your help!


I tried :wink:

The angle argument accepts one number between -180 and 180 only. I think the behavior of the marker styling is not consistent, the symbol argument accepts a list as does the color argument.

import plotly.express as px

fig=px.scatter(x=[1,2,3], y=[1,2,3])
fig.update_traces(marker={'symbol':['square', 'circle', 'diamond'],'color': ['red', 'pink', 'gold'], 'angle':0})

So you would have to try option2.

Hm, I also noticed that for example for “color” you can pass a list of strings.
For the angular values, I also got the following message when trying to pass a list:

Invalid value of type ‘builtins.list’ received for the ‘angle’ property of scatter.marker
Received value: [{10, 100, 45}]

The 'angle' property is a angle (in degrees) that may be
specified as a number between -180 and 180. Numeric values outside this
range are converted to the equivalent value
(e.g. 270 is converted to -90).

Thanks for your help in any case and toodle-pip