I would like to make a simple arrow and a two head arrow. I used the following to make a simple arrow, but I doubt this is the easiest method :
import matplotlib.pyplot as plt arr_width = .009 # I don't know what unit it is here. fig = plt.figure() ax1 = fig.add_subplot(111) ax1.plot(range(10)) ax1.arrow(1, 1, 0, .5, width = arr_width, head_width = 3 * arr_width, head_length = 9 * arr_width) plt.show()
I can't find how to make two head arrows with this method.
draw() . Using plt. show() in Matplotlib mode is not required.
The plt. axis() method allows you to set the x and y limits with a single call, by passing a list which specifies [xmin, xmax, ymin, ymax] : In [11]: plt.
You can create a double-headed arrow using the annotate
method with blank text annotation and setting the arrowprops
dict to include arrowstyle='<->'
as shown below:
import matplotlib.pyplot as plt plt.annotate(s='', xy=(1,1), xytext=(0,0), arrowprops=dict(arrowstyle='<->')) 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