I'd like to plot a graph and highlight its local maximum by drawing a dotted line back to x and y axis, and displaying the values of both.
For example some data:
import numpy as np
import matplotlib.pyplot as plt
from scipy.interpolate import make_interp_spline
x_ = np.array([1, 2.5, 2.7, 8, 3])
y_ = np.array([1, 2, 3, 4, 5, 6])
spline = make_interp_spline(x_, y_)
x = np.linspace(x_.min(), x_.max(), 500)
y = spline(x)
xmax = x[np.argmax(y)]
ymax = y.max()
plt.plot(x, y)
plt.plot(xmax,ymax,'o')
plt.show()
How do I do this?
Thanks in advance