I want to plot bar and line together in one chart. When I plot bars, it displays correctly(g1 and g10 are displayed completed):
However, if I add a line to the plot:
Try switching the order of plotting:
ax = m1_t['bad_rate'].plot(secondary_y=True) m1_t[['abnormal','fix','normal']].plot(kind='bar', ax=ax)
or preserve the original barchart xlim:
xlim
ax = m1_t[['abnormal','fix','normal']].plot(kind='bar') m1_t['bad_rate'].plot(secondary_y=True, xlim=ax.get_xlim())