plot.barh() group by

#plot data
fig, ax = plt.subplots(figsize=(15,7))
data.groupby(['date','type']).count()['amount'].plot(ax=ax)

5
1
Helithumper 160 points

                                    df.groupby('year').case_status.value_counts().unstack(0).plot.barh()

5 (1 Votes)
0
5
2

                                    import matplotlib
import matplotlib.pyplot as plt
import numpy as np


labels = ['G1', 'G2', 'G3', 'G4', 'G5']
men_means = [20, 34, 30, 35, 27]
women_means = [25, 32, 34, 20, 25]

x = np.arange(len(labels))  # the label locations
width = 0.35  # the width of the bars

fig, ax = plt.subplots()
rects1 = ax.bar(x - width/2, men_means, width, label='Men')
rects2 = ax.bar(x + width/2, women_means, width, label='Women')

# Add some text for labels, title and custom x-axis tick labels, etc.
ax.set_ylabel('Scores')
ax.set_title('Scores by group and gender')
ax.set_xticks(x)
ax.set_xticklabels(labels)
ax.legend()


def autolabel(rects):
    """Attach a text label above each bar in *rects*, displaying its height."""
    for rect in rects:
        height = rect.get_height()
        ax.annotate('{}'.format(height),
                    xy=(rect.get_x() + rect.get_width() / 2, height),
                    xytext=(0, 3),  # 3 points vertical offset
                    textcoords="offset points",
                    ha='center', va='bottom')


autolabel(rects1)
autolabel(rects2)

fig.tight_layout()

plt.show()

5 (2 Votes)
0
Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
how to plot graph in python with groupby plot bar and group by pandas group by and plot bar data with pandas pandas: groupby plot bar ploting graphs groupby in python bar chart in matplotlib by groupby plt plot in python groupby plt.plot(group plot groupby barplot plot groupby pandas bar chart group by pandas plot using groupby and plot use graph with groupby in python create a graph with groupby plot by group how to plot group by elements how to plot group by items in pandas python plot with group by plot by group python matplotlib.pyplot grouped bar chart group plot grouped bar charts matplotlib matplotlib plot pandas bar groupby matplotlib plot pandas groupby matplotlib group Stacked bar chart group by ploting group bar plot matplotlib plot pandas by group matplotlib barchart using groupby how to plot groupby pandas pandas group bar plot plot grouped bar chart python pd plot groupby pandas plot groupby graph bar using matplotlib plot bar graph in matplotlib using groupby plot graph in matplotlib using groupby how to make a plot on groupby group by in graphene python plot graph with groupby group by plot pandas how to take a plot of group by pandas matplotlib bar chart with groups pandas groupby plot bar chart python plot bar graph groups group bar chart in python python plot bar chart by group pandas bar graph groupby grouped bar plots plt plot group bar plot python plot pandas group by matplotlib plot groupby matplotlib grouped bar Plot.groupY how to add group labels for barplot in matplotlib? grouped bar graph matplotlib can i plot a groupby in pandas plot groupby pandas plot a groupby group by bar plot pandas group by bar plot in python group by bar plot plotting a barplot for groupby data in python python grouped bar plot groupby bar plot pandas how to plot a group by plot in pandas plots groupby matplotlib groupby pandas bar plot barplot group by in seaborn dataframe bar plot groupby how to use groupby in pandas to plot python barplot by group how to group by bar plots in python how to group by bar plots how to group by bar plotrs' plot.barh() group by pandas bar plot groupby matplotlib grouped bar chart example plot groupby pandas bar plot plot groupby pandas bar plt plot groupby grouped bar plot python bar plot group by pandas plot with group by how to plot graph using groupby() create a bar plot for a group by pandas matplotlib grouped bar plot plot how to plot bar graph by group by how to do bar plot for a groupby barplot group by matplotlib matplotlib bar plot in groups matplotlib barplot in groups matplotlib bar plot groupby group by your dataframe to plot python pandas groupby plot bar plot grouped bar chart matplotlib plot values by groupby python plot group by python group.plot groupby plot grouped bar graph in matplotlib groupedbar graph in matplotlib plot group by and valueconts group by and plot plotting groupby on bar chart plotting groupbys on bar chart group by plot matplotlib group by plot how to add group axis in matplotlib bar graph pandas how to group by and plot in python group plot matplotlib pandas group by graph matplot plot python by group using group by for plot python groupby stacked bar plot group bar chart python matplotlin plot group by how to plot groupby in python group by pandas plot bar bar plot groupby matplotlib group bar plot bar plot groupby pandas grouped bar plot matplotlib group barplot python grouped bar plot python matplotlib group bar plot python how to do a groupby plot in python matplotlib grouped bar graph 3 grouped bars matplotlib matplotlib groupby bar plot how plot graph by using group by function in python xticks on both grouped bars matplotlib python grouped bar chart grouped bar chart matplotlib matplotlib single grouped bar chart python pands groupby plotting grouped bar charts plot python matplotlib gruoped bar matplotlib python bar chart grouped grouped bar chart matplotlib figure plot matplotlib grouped barchart with error bar matplotlib make barchart with 2 different groups and std python plot groupby matplotlib grouped bar chart python plot bar side by side plot group by pandas grouped bar matplotlib python clustered bar chart plot one variable grouped by another variable in python
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source