How to plot graph?

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

    How to plot graph?

    hi all,

    i'm new to python and this is advanced for me. is there a way to plot data with python? i want to plot EyVt, EyHt on the Y-axis and Lane on the X-axis as attached or below.
    currently i'm using Python2.5 and Win XP. thanks a lot.
    Eg:
    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
    Attached Files
  • dwblas
    Recognized Expert Contributor
    • May 2008
    • 626

    #2
    The Python wiki is always a good place to start http://wiki.python.org/moin/NumericA...%7C%28graph%29.

    Comment

    • maximus tee
      New Member
      • Dec 2010
      • 30

      #3
      thanks. i installed matplotlib, numpy, scipy and when running this code there was error:
      Code:
      import numpy as np 
      from numpy import cos 
      from scipy import * 
      from pylab import plot, show, ylim, yticks 
      from matplotlib import * 
      from pprint import pprint 
       
      n1 = 1.0 
      n2 = 1.5 
       
      #alpha, beta, intensity 
      data = np.array([ 
          [10,    22,     4.3], 
          [20,    42,     4.2], 
          [30,    62,     3.6], 
          [40,    83,     1.3], 
          [45,    102,    2.8], 
          [50,    123,    3.0], 
          [60,    143,    3.2], 
          [70,    163,    3.8], 
          ]) 
       
      # Populate arrays 
      x = np.array([row[0] for row in data]) 
      y1 = np.array([row[1] for row in data]) 
      rhotang1 = n1*cos(data[:,0]) - n2*cos(data[:,1]) 
      rhotang2 = n1*cos(data[:,0]) + n2*cos(data[:,1]) 
      y3 = rhotang1 / rhotang2 
       
      plot(x, y1, 'r--', x, y3, 'g--') 
      show()
      Error:
      Traceback (most recent call last):
      File "C:\Python25\my script\plot\plo t1.py", line 3, in <module>
      from scipy import *
      File "C:\Python25\Li b\site-packages\scipy\ linalg\__init__ .py", line 31, in <module>
      from numpy.testing import NumpyTest
      ImportError: cannot import name NumpyTest

      Comment

      Working...