How to draw an arrow

Hi folks,
I've to draw an arrow.
I used Arrow() function:

pa.Arrow(0, 0, x, y, width=1.0)

where I imported

matplotlib.patches as pa

Now, how to use plot() function di display the figure?

Tanks in advance,
K.

···

--
View this message in context: http://old.nabble.com/How-to-draw-an-arrow-tp33500720p33500720.html
Sent from the matplotlib - users mailing list archive at Nabble.com.

Hi,

You need to add the patch to the current axes. For example,

···

On Wed, Mar 14, 2012 at 6:02 AM, kususe <kususe@…848…> wrote:

Hi folks,

I’ve to draw an arrow.

I used Arrow() function:

pa.Arrow(0, 0, x, y, width=1.0)

where I imported

matplotlib.patches as pa

Now, how to use plot() function di display the figure?

Tanks in advance,

K.

View this message in context: http://old.nabble.com/How-to-draw-an-arrow-tp33500720p33500720.html

Sent from the matplotlib - users mailing list archive at Nabble.com.

#~~~

import matplotlib.pyplot as plt

from matplotlib import patches

arr = patches.Arrow(0,0,1,1)

ax = plt.gca()

ax.add_patch(arr)

plt.show()

#~~~

When you create a Matplotlib artist (here a Patch artist) with pyplot (e.g. plt.plot creates a Line2D instance), pyplot takes care of matching artist with axes. Artists themselves don’t know anything about where you’re plotting, so you have to tell it where to go.

-Tony