Skip to content

Instantly share code, notes, and snippets.

@bamattis
Created July 16, 2022 03:39
Show Gist options
  • Save bamattis/7ff2faa50ff5d884edad37350e8667ce to your computer and use it in GitHub Desktop.
Save bamattis/7ff2faa50ff5d884edad37350e8667ce to your computer and use it in GitHub Desktop.
Pandas_second_axis
ax = df.plot(x='a', y='b', color='green', style='-o')
ax2 = df.plot(x='a', y='c', secondary_y=True,color='blue', style='-o', ax=ax)
ax.set_xlabel('X data')
ax.set_ylabel('Y1 data', color='green')
ax2.set_ylabel('Y2 data', color='blue')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment