I have the results from two groupby operations, the first one, m_y_count
, in this multiindex format (first column years and second column months):
2007 12 39
2008 1 3
2 120
2009 6 1000
2010 1 86575
2 726212
3 2987954
4 3598215
6 160597
and the other one, y_count
, only has years:
2007 69
2008 3792
2009 5
2010 791
My question is: How do I plot them in the same figure, with different (log) y-axes, and m_y_count
with bars while y_count
with a line with marker?
My attempt:
ax = y_count.plot(kind="bar", color='blue', log = True)
ax2 = ax.twinx()
m_y_count.plot(kind="bar", color='red', alpha = 0.5, ax = ax2)
This produces the bars for both pandas Series, but when I try to change to kind="line"
in the first line, no line appears.
Any hint on how to proceed? Thanks!