Reputation: 445
import plotly.express as px
px.histogram(purchase_data,x='Log_Final Price',color='Sale')
Same Plot with Seaborn
sns.histplot(purchase_data,x='Log_Final Price',hue='Sale')
You can clearly see, for Sale='Yes' and Sale='Np', plotly is giving completely opposite plot.
Upvotes: 1
Views: 568
Reputation: 61154
The plotly histogram isn't incorrect, it's just stacked. And it will resemble your seaborn histogram more closely if you include:
fig.update_layout(barmode = 'overlay')
fig.update_traces(opacity=0.50)
import plotly.express as px
df = px.data.tips()
fig = px.histogram(df, x='total_bill', color = 'sex')
fig.update_layout(barmode = 'overlay')
fig.update_traces(opacity=0.50)
fig.show()
Upvotes: 3