Marker shape in plotly
I have been trying to change the marker shape in plotly scatter plot but I can't seem to find the correct options. The plotly document goes over the size and opacity, but not the marker shape. Here's my sample code-
import pandas as pd
import plotly.express as px
d = {'Date': ['01/01/1990','01/01/1990','01/01/1990','01/01/1990',
'01/01/2000','01/01/2000','01/01/2000','01/01/2000',
'01/01/2010','01/01/2010','01/01/2010','01/01/2010',
'01/01/2020','01/01/2020','01/01/2020','01/01/2020'
]}
df = pd.DataFrame(data=d)
df['Metric1']=[100, 110, 120, 130,
200, 210, 220, 230,
300, 310, 320, 330,
400, 410, 420, 430]
df['Marker']=[1,2,3,4,1,2,3,4,1,2,3,4,1,2,3,4]
df['Color']=['a', 'b', 'c', 'd',
'a', 'b', 'c', 'd',
'a', 'b', 'c', 'd',
'a', 'b', 'c', 'd']
fig = px.scatter(df, x='Date', y='Metric1', color = 'Color', hover_data = ["Color", "Marker"])
fig.show()
Is it possible to implement what I am trying to do with Plotly scatter plot?I tried the follow the discussion in this forum- https://community.plotly.com/t/getting-different-markers-shapes/9944 But I am having a difficult time relating it to my problem I am using Python 3.8 and Plotly 4.11.0
from Recent Questions - Stack Overflow https://ift.tt/36lwzl6
https://ift.tt/eA8V8J
Comments
Post a Comment