plots 2 lines on secondary axis

PHOTO EMBED

Thu Oct 14 2021 08:22:03 GMT+0000 (Coordinated Universal Time)

Saved by @CaoimhedeFrein #python

fig, ax1 = plt.subplots( figsize= (20,8))

ax2 = ax1.twinx()
ax1.plot(df_cuba.wk_year, df_cuba.GP_per_sender, '-m')
ax2.plot(df_row.wk_year, df_row.GP_per_sender, '-k')


ax1.set_xlabel('X data')
ax1.set_ylabel('Y1 data', color='m')
ax2.set_ylabel('Y2 data', color='k')

plt.show()
content_copyCOPY