I am trying to plot the distribution of the classes.
import plotly.graph_objects as go
df = pd.read_csv('https://gist.githubusercontent.com/netj/8836201/raw/6f9306ad21398ea43cba4f7d537619d0e07d5ae3/iris.csv')
fig = go.Figure()
fig.add_trace(go.Histogram(histfunc="count", x=df['variety'], showlegend=True))
fig
This gives me:
I want the legend to be Setosa, Versicolor, Virginica
and each bar with different colour.
Using pandas I can do (Although There is problem with legend there):
ax = df['variety'].value_counts().plot(kind="bar")
ax.legend(df.variety.unique())
I want this to be integrated with plotly dash so I am using plotly go. If someone can help me with this issue. It would be a great help to me as I am newbie in plotly.


