I have been dealing with this for several days. I have a loop to get info by month. I try to put them in a just one plot (subplot 1 = month 1, subplot 2 = month 2, and so on), however I get the last month in every subplot. What am I missing?
My code is:
import warnings
import matplotlib.cbook
warnings.filterwarnings("ignore",category=matplotlib.cbook.mplDeprecation)
plt.figure(0)
for m in range(1,13):
for i in range(4):
for j in range(3):
ax = plt.subplot2grid((4,3), (i,j))
DF_sub = DF[DF['months'] == m]
out = pd.cut(DF_sub['trip'], bins=[0, 0.25, 0.5, 0.75, 1], include_lowest=True)
out_norm = out.value_counts(sort=False, normalize=True)
ax = out_norm.plot.bar(rot=0, color="b", figsize=(6,4))
plt.xticks([])
plt.title('Month-' + str(m))
plt.show()


