Arrows in plots

Dear Matplotlib-Users,

I would like to add arrows at the corners of the
blue line to illustrate the order of the
iterates. Is it possible to realize it with
matplotlib ?

Nils

image.png

Some time ago (before the arrow patch), I wrote a small function to do this. I hope that this is also useful for you.

ยทยทยท

---------------------------
def arrow(p1, p2, style=None, linewidth=1):
  import math
  import pylab as P
  linex = [p1[0], p2[0]]
  liney = [p1[1], p2[1]]
  theta0 = math.atan2(liney[1]-liney[0], linex[1]-linex[0])
  thetaa = math.pi/12
  theta1 = theta0 - thetaa
  theta2 = theta0 + thetaa
  L = 0.05
  xh = linex[1]
  yh = liney[1]
  xa1 = xh - L*math.cos(theta1)
  ya1 = yh - L*math.sin(theta1)
  xa2 = xh - L*math.cos(theta2)
  ya2 = yh - L*math.sin(theta2)
  P.plot(linex, liney, style, linewidth=linewidth)
  P.plot([xa1, xh, xa2], [ya1, yh, ya2], 'k-', linewidth=linewidth)
---------------------------
Nils Wagner wrote:

Dear Matplotlib-Users,

I would like to add arrows at the corners of the
blue line to illustrate the order of the
iterates. Is it possible to realize it with
matplotlib ?

Nils

------------------------------------------------------------------------