I want to design a graph like below, but, I don't know- how to add markers like the one shown in the graph. Can somebody help me with this?
For plotting a graph, I am using matplotlib package in python.

From matplotlib doc Annotations you can modify the example with the code
import numpy as np
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
t = np.arange(0.0, 5.0, 0.01)
s = np.cos(2*np.pi*t)
line, = ax.plot(t, s, lw=2)
ax.plot(2, 1, marker = "v", color='blue', fillstyle='none')
bbox_props = dict(boxstyle="square,pad=0.3", fc="white", ec="black", lw=1.2)
t = ax.annotate('local max\n x = 2, y = 1', xy=(2, 1), xytext=(3, 1.5),
arrowprops=dict(arrowstyle="-", facecolor='black'), bbox=bbox_props,
)
ax.set_ylim(-2, 2)
plt.show()

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