import numpy as np
from matplotlib import pyplot

from sliceplots import plot_multicolored_line

x = np.linspace(0, 3 * np.pi, 500)
y = np.sin(x)
dydx = np.gradient(y) * 100  # first derivative

_, ax = pyplot.subplots()

plot_multicolored_line(ax=ax, x=x, y=y, other_y=dydx, label="dydx")

ax.set(ylabel="y", xlabel="x")