Matplotlib/Arrows - SciPy wiki dump (original) (raw)

Some example code for how to plot an arrow using the Arrow function.

1 from pylab import * 2 from numarray import * 3 4 x = arange(10) 5 y = x 6 7 # Plot junk and then a filled region 8 plot(x, y) 9 10 # Now lets make an arrow object 11 arr = Arrow(2, 2, 1, 1, edgecolor='white') 12 13 # Get the subplot that we are currently working on 14 ax = gca() 15 16 # Now add the arrow 17 ax.add_patch(arr) 18 19 # We should be able to make modifications to the arrow. 20 # Lets make it green. 21 arr.set_facecolor('g')

plot_arrow.png

SciPy: Cookbook/Matplotlib/Arrows (last edited 2015-10-24 17:48:26 by anonymous)