import numpy as np import matplotlib.pyplot as plt x = np.linspace(0, np.pi*4, 100) y1 = np.cos(x) + np.sin(x) y2 = np.cos(-x) + np.sin(x*2) fig, ax1 = plt.subplots() ax2 = ax1.twinx() ax1.plot(x, y1, color='orangered') ax2.plot(x, y2, color='dodgerblue') ax1.tick_params(axis='y', colors='orangered') ax2.tick_params(axis='y', colors='dodgerblue')