This code (matplotlib.pyplot) gives me the plot in the link below:
plt.subplot(2, 1, 1)
plt.plot(px,py)
plt.subplot(2, 1, 2)
plt.plot(curve)
2 plots example --> I want to add a horizontal line in the second sub-plot at 100.000. How can I do that? The colors of both plots shall stay the same/synchronized.
You can use matplotlib.axes.Axes.axhline of matplotlib which adds a horizontal line across the axis. If you need to set any further parameters, refer to the official documentation
import matplotlib.pyplot as plt
plt.axhline(100000, color="gray")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With