How to plot simple graph?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maximus tee
    New Member
    • Dec 2010
    • 30

    #1

    How to plot simple graph?

    hi,

    i'm new to python. i want to read from a text file and i want to plot a scatterplot. i want to plot lane as X-axis, EyVt and EyHt as Y-axis. i'm using Python 2.5 and Win XP.
    i have a sample code but i need help on how to get python start reading column Lane, EyVt and EyHt. Pls help. tq

    eg of text file content:
    Platform: PC
    Tempt : 25
    TAP0 :0
    TAP1 :1

    +++++++++++++++ +++++++++++++++ +++++++++++++++
    Port Chnl Lane EyVt EyHt
    +++++++++++++++ +++++++++++++++ +++++++++++++++
    0 1 1 75 55
    0 1 2 10 35
    0 1 3 25 35
    0 1 4 35 25
    0 1 5 10 20
    +++++++++++++++ +++++++++++++++ +++++++++++++++
    Time: 20s


    Code:
    import numpy as np
    import pylab as pl
    
    data=np.loadtxt('sampledata.txt')
    
    pl.plot(data[:,0],data[:,1],'ro')
    pl.xlabel('x')
    pl.ylabel('y')
    pl.xlim(0.0,10.)
    
    pl.show()
Working...