1

In my code I am unable to combine my labels to both of my plots on the line and the bar graphs. Also, I do not know how to maintain a matplotlib style on my secondary y axis? As in, why is 'fivethirtyeight' applied only to the first axis but not the second? Because it is giving me the same colors already used on the bars in the first axis and putting them on the lines on the second plot.

fig = plt.figure()
ax = totals[['col1', 'col2','col3'].plot(kind='bar')
plt.xticks(rotation=0)
ax2 = ax.twinx()
ax2.plot(ax.get_xticks(), totals[['line1','line2']], labels=['line1','line2'],marker='o')
#ax2.legend(loc=0)
plt.style.use('fivethirtyeight')
plt.show()

Combine bar and line chart with pandas

Thanks for your help in advance!

J. Doe
  • 11
  • 1
  • 1
    For the style, see [this question](https://stackoverflow.com/questions/49955603/matplotlib-style-sheet-not-being-applied). I don't understand the first problem. Maybe you want to spend some more words than 0 on what the problem is you encounter and what hinders you in solving it. – ImportanceOfBeingErnest Apr 23 '18 at 00:58

0 Answers0