Impossible to draw a direction of arrows in Matplotlib???

Hi,
I have encountered some problem while I was drawing a direction of
arrow. I have point (x,y) coordinates and angle of them. What I want to
do is that to draw arrow according to the given angle (just to show the
point direction as an arrow in each point coordinate). Here, we should
assume coordinates of ‘+x’, ‘+y’, '-x ', ‘-y’ are 90, 0, 270, 180
degrees, respectively.
I am a bit unfamiliar with Python drawing tools. I am still not sure to
draw directional point (arrow based on angle) whether I use pylab or
some other modules or… still not sure at all. I put the following codes
as a sample to give better description:

import numpy as np
import scipy as sp
import pylab as pl

def draw_line(x,y,angle):
# Inputs:
x = np.array([ 2, 4, 8, 10, 12, 14, 16])
y = np.array([ 5, 10, 15, 20, 25, 30, 35])
angles = np.array([45,275,190,100,280,18,45])

 # First, draw (x,y) coordinate
 ???
 # Second, according to the angle indicate the direction as
 an arrow
 ???

Thanks in advance for your friendly support,

I'm not sure that I understand exactly what you are trying to do, but you may want to look into Matplotlib annotation. Here's a really quick example:

import matplotlib.pyplot as plt
plt.annotate('', (1, 1), (0, 0),
         arrowprops=dict(facecolor='black'))
plt.axis([-1, 2, -1, 2])
plt.show()

There are many options to make very fancy arrows, and there are several places in the docs to read about this in more detail:
http://matplotlib.org/users/annotations_intro.html
http://matplotlib.org/users/annotations_guide.html

Hope that helps a little. Good luck.

Ryan

···

On 4/12/2013 5:55 AM, Bakhtiyor Zokhidov wrote:

Hi,
I have encountered some problem while I was drawing a direction of
arrow. I have point (x,y) coordinates and angle of them. What I want to
do is that to draw arrow according to the given angle (just to show the
point direction as an arrow in each point coordinate). Here, we should
assume coordinates of '+x', '+y', '-x ', '-y' are 90, 0, 270, 180
degrees, respectively.
I am a bit unfamiliar with Python drawing tools. I am still not sure to
draw directional point (arrow based on angle) whether I use pylab or
some other modules or.. still not sure at all. I put the following codes
as a sample to give better description:

import numpy as np
import scipy as sp
import pylab as pl

def draw_line(x,y,angle):
     # Inputs:
     x = np.array([ 2, 4, 8, 10, 12, 14, 16])
y = np.array([ 5, 10, 15, 20, 25, 30, 35])
angles = np.array([45,275,190,100,280,18,45])

# First, draw (x,y) coordinate
???
# Second, according to the angle indicate the direction as
an arrow
???

Thanks in advance for your friendly support,

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter

_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users