I am trying to plot in a pdf file a time series and a histogram for each of the variables in my data frame. Each action works separately, but when subploting both of them in the same page, the histogram is not showing. Any idea what I am doing wrong? Here's my code:
with PdfPages('test.pdf') as pdf:
for i in range(df.shape[1]):
fig = plt.figure()
#time series
plt.subplot(2, 1, 1)
ax1 = df.iloc[:,i].plot(color='blue', grid=True, label='lab')
plt.title(df.columns.values[i])
#histograms
plt.subplot(2, 1, 2)
hist=df.hist(df.columns.values[i])
plt.plot()
pdf.savefig(fig)
plt.close()