import plotly.graphobjs as go from plotly.subplots import makesubplots calculate the…
Jump to turn (7)
- 1import plotly.graphobjs as go from plotly.subplots import makesubplots calculate
- 2I want to perform corraltion analysis plot between three categorial features, an
- 3I would like to use matplotlib venn2 to plot intersections between 3 feautres in
- 4I would like to use matplotlib venn2 to plot intersections between 3 feautres in
- 5what are the labels
- 6ypu know, my three features takes modality values "Positive", "Negative" and "Ne
- 7I also want Intersections of Positive Modality, Intersections of Neutral based o
- User
import plotly.graph_objs as go from plotly.subplots import make_subplots
calculate the counts of the categorical variables
counts = df_english_copy.groupby([“status”, “Vader_Analysis”]).size().reset_index(name=“count”)
create a grouped horizontal bar chart using plotly
fig = make_subplots(rows=1, cols=1, specs=[[{“type”: “bar”}]]) statuses = [“post_published”, “post_refused_by_moderator”] colors = [“blue”, “green”, “orange”]
for i, s in enumerate(statuses): data = counts[counts[“status”] == s] fig.add_trace(go.Bar(x=data[“count”], y=data[“Vader_Analysis”], name=s, orientation=“h”, marker=dict(color=colors[i])), row=1, col=1)
customize the chart layout and axis labels
fig.update_layout(barmode=“stack”, xaxis_title=“Count”, yaxis_title=“Vader Analysis”, legend_title=“Status”, legend=dict(x=0.85, y=0.6)) fig.update_layout(height=500, width=700, title_text=“Counts of Vader Analysis by Status”)
show the plot
fig.show()
I appreciate this but I don’t wanna see superposition of bars in the plot
- Assistant