plotting arrow in python

Discussion in 'Python' started by rudra, Nov 21, 2009.

  1. rudra

    rudra Guest

    Dear friends,
    I am very new in python. Actually, I think I will not do much python
    then using it to plotting data. I have not done any "real" thing in
    python, so plz be easy. Now , the problem
    I have a data set:
    0.0 0.0 0.1
    0.0 0.1 0.1
    0.1 0.0 0.5

    like that! the first two column are coordinate and 3rd one is
    magnitude of moment (say: x y,m)!! so what i want to do is draw an
    arrow of magnitude(m) in the position (x,y).
    I know how python read array, and how to draw an array(via
    matplotlib)...but totally confused with this one.
    can you people plz help?
     
    rudra, Nov 21, 2009
    #1
    1. Advertising

  2. rudra

    Stef Mientki Guest

    rudra wrote:
    > Dear friends,
    > I am very new in python. Actually, I think I will not do much python
    > then using it to plotting data. I have not done any "real" thing in
    > python, so plz be easy. Now , the problem
    > I have a data set:
    > 0.0 0.0 0.1
    > 0.0 0.1 0.1
    > 0.1 0.0 0.5
    >
    > like that! the first two column are coordinate and 3rd one is
    > magnitude of moment (say: x y,m)!! so what i want to do is draw an
    > arrow of magnitude(m) in the position (x,y).
    > I know how python read array, and how to draw an array(via
    > matplotlib)...but totally confused with this one.
    > can you people plz help?
    >

    maybe take a look at VPython
    cheers,
    Stef
     
    Stef Mientki, Nov 21, 2009
    #2
    1. Advertising

  3. rudra

    Lie Ryan Guest

    rudra wrote:
    > Dear friends,
    > I am very new in python. Actually, I think I will not do much python
    > then using it to plotting data. I have not done any "real" thing in
    > python, so plz be easy. Now , the problem
    > I have a data set:
    > 0.0 0.0 0.1
    > 0.0 0.1 0.1
    > 0.1 0.0 0.5
    >
    > like that! the first two column are coordinate and 3rd one is
    > magnitude of moment (say: x y,m)!! so what i want to do is draw an
    > arrow of magnitude(m) in the position (x,y).
    > I know how python read array, and how to draw an array(via
    > matplotlib)...but totally confused with this one.
    > can you people plz help?


    If you want to stay with regular python distribution, take a look on
    pygame (http://www.pygame.org/ ).

    If you want to avoid 3rd party modules, take a look at turtle and
    Tkinter in the standard library.
     
    Lie Ryan, Nov 22, 2009
    #3
  4. rudra

    r Guest

    On Nov 21, 7:36 pm, Lie Ryan <> wrote:
    (..snip..)
    > If you want to avoid 3rd party modules, take a look at turtle and
    > Tkinter in the standard library.


    Just to add to Ryans words...
    If you want to avoid 3rd party modules, take a look at turtle and the
    Tkinter *Canvas* widget in the standard library. Here is an example.

    #-- start code --#
    try:
    import Tkinter as tk
    except ImportError:
    import tkinter as tk #python 3+

    app = tk.Tk()
    canvas = tk.Canvas(app)
    canvas.create_line(0,0, 50,50, arrow='last')
    canvas.pack()
    app.mainloop()
    #-- end code --#

    remove the try/except when you know which one to use. I just wanted to
    make sure it ran out-the-box for you, have fun!
     
    r, Nov 22, 2009
    #4
  5. > rudra wrote:
    >
    >> 0.0 0.0 0.1
    >> 0.0 0.1 0.1
    >> 0.1 0.0 0.5
    >>
    >> like that! the first two column are coordinate and 3rd one is
    >> magnitude of moment (say: x y,m)!! so what i want to do is draw an
    >> arrow of magnitude(m) in the position (x,y).


    There seems to be some information missing there.
    How do you know what direction to draw the arrow in?

    --
    Greg
     
    Gregory Ewing, Nov 22, 2009
    #5
  6. rudra

    rudra Guest

    On Nov 22, 6:58 am, Gregory Ewing <> wrote:
    > > rudra wrote:

    >
    > >> 0.0 0.0 0.1
    > >> 0.0 0.1 0.1
    > >> 0.1 0.0 0.5

    >
    > >> like that! the first two column are coordinate and 3rd one is
    > >> magnitude of moment (say: x y,m)!! so what i want to do is draw an
    > >> arrow of magnitude(m) in the position (x,y).

    >
    > There seems to be some information missing there.
    > How do you know what direction to draw the arrow in?
    >
    > --
    > Greg


    Greg,
    you are right direction is also needed. But as a beginner, I am trying
    to make it simple and all arrows are collinear along x axis!!
    then i have to try non collinear as well.
    thank you
     
    rudra, Nov 22, 2009
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gabriel Cooper
    Replies:
    1
    Views:
    1,028
    vincent wehren
    Apr 27, 2004
  2. Erik Johnson
    Replies:
    8
    Views:
    726
    Peter Otten
    Feb 3, 2005
  3. Vidar Gundersen
    Replies:
    1
    Views:
    799
  4. jitrowia
    Replies:
    2
    Views:
    389
    Dennis Lee Bieber
    Jan 26, 2008
  5. Rahul
    Replies:
    4
    Views:
    631
    Rahul
    Apr 30, 2008
Loading...

Share This Page