Open
Description
I want to make plots of grouped data, where each plot is plotted in a subplot:
I tried without any kwargs in plotting command, i tried with kwargs subplots=True
and with layout=(3,1)
but always only one plot which includes every group is plotted
My code:
import sys
import datetime
import matplotlib.pyplot as plt
import pandas as pd
import matplotlib.dates as mdates
import numpy as np
%matplotlib notebook
dates = pd.date_range('2013-07-14 11:00:00', '2013-07-16 11:00:00', freq = 's')
cats = np.random.choice(['m', 'f', 'c'], len(dates))
data =np.random.randn(len(dates),1)
df = pd.DataFrame(data, dates)
df.columns = ['data']
df['cats']= cats
plt.figure()
ax1 = df.groupby('cats')['data'].plot(subplots=True) #Figure1
plt.figure()
ax2 = df.groupby('cats')['data'].plot() #Figure2
plt.figure()
ax3 = df.groupby('cats')['data'].plot(layout=(3,1)) #Figure3
Im using
pd.__version__
'0.18.0rc1'