# What kind of plot will be helpful for total count group data ( data grouped by month and year )?

I have a group data frame like this :

group_by_region_year_month=train_data.groupby(['Region Name (GO)','Year','Month'],as_index=False)

region_sum=group_by_region_year_month.agg({"AMV": "sum"})


Here , AMV is my target variable in regression ( this is count of total vehicles).

I have data for each day from 2000-3-17 to 2017-10-11.

I want to show the variation of the count for each year and each month for each Region.

How best can I plot it?

I tried using seaborn.FacetGrid in this way:

# g=sns.FacetGrid(row="Region Name (GO)", col="AMV", data=region_sum)

But it is taking too much time .

Is there any better alternative(s) ?

# Edit 1

I tried this :

sns.set(rc={'figure.figsize':(50,30)})

ax=sns.barplot(x='Region Name (GO)', y='AMV', hue='Year', data=train_data)
ax.set_xticklabels(ax.get_xticklabels(), rotation=90)


which gave me a very clumsy plot :

I did not use countplot as countplot would give me count of rows. But , I want sum of all values in a group.

Can I represent it in any better way ?

## 1 Answer

If you like using Seaborn to construct your plots, sns.countplot is probably the best for plotting data where you want to show the differences in value counts.

You can find the link to the documentation page here which might be helpful for you to construct it in the particular way you want.

As an example, here is a version of a "multiple" count plot like you suggest. (directly from the Seaborn Documentation page)

• hi @Ethan , thanks for your reply. Are you suggesting to use multiple countplot. But , I need to show both yearly and monthly data. Would that be possible ? – DukeLover Aug 18 '18 at 15:45
• Yes, there is a multiple count plot feature in seaborn. – Ethan Aug 18 '18 at 15:46
• hi @Ethan , I updated the question , can u plz check once ? – DukeLover Aug 18 '18 at 16:15
• What exactly are you trying to do? If you want to compare value counts for each year (with 17 of them) across each region (with 12 of them) your plot will likely look like the one you have above – Ethan Aug 21 '18 at 18:20
• Hi @Ethan , thanks for reply. I want to show as different line plots for various months for 17 regions. – DukeLover Aug 22 '18 at 6:08