By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,813 Members | 1,121 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,813 IT Pros & Developers. It's quick & easy.

How to plot graph?

P: 30
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
File Type: txt sampledata.txt (304 Bytes, 336 views)
Jan 18 '11 #1

✓ answered by dwblas

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

Share this Question
Share on Google+
2 Replies


Expert 100+
P: 624
The Python wiki is always a good place to start http://wiki.python.org/moin/NumericA...%7C%28graph%29.
Jan 18 '11 #2

P: 30
thanks. i installed matplotlib, numpy, scipy and when running this code there was error:
Expand|Select|Wrap|Line Numbers
  1. import numpy as np 
  2. from numpy import cos 
  3. from scipy import * 
  4. from pylab import plot, show, ylim, yticks 
  5. from matplotlib import * 
  6. from pprint import pprint 
  7.  
  8. n1 = 1.0 
  9. n2 = 1.5 
  10.  
  11. #alpha, beta, intensity 
  12. data = np.array([ 
  13.     [10,    22,     4.3], 
  14.     [20,    42,     4.2], 
  15.     [30,    62,     3.6], 
  16.     [40,    83,     1.3], 
  17.     [45,    102,    2.8], 
  18.     [50,    123,    3.0], 
  19.     [60,    143,    3.2], 
  20.     [70,    163,    3.8], 
  21.     ]) 
  22.  
  23. # Populate arrays 
  24. x = np.array([row[0] for row in data]) 
  25. y1 = np.array([row[1] for row in data]) 
  26. rhotang1 = n1*cos(data[:,0]) - n2*cos(data[:,1]) 
  27. rhotang2 = n1*cos(data[:,0]) + n2*cos(data[:,1]) 
  28. y3 = rhotang1 / rhotang2 
  29.  
  30. plot(x, y1, 'r--', x, y3, 'g--') 
  31. show() 
  32.  
Error:
Traceback (most recent call last):
File "C:\Python25\myscript\plot\plot1.py", line 3, in <module>
from scipy import *
File "C:\Python25\Lib\site-packages\scipy\linalg\__init__.py", line 31, in <module>
from numpy.testing import NumpyTest
ImportError: cannot import name NumpyTest
Jan 19 '11 #3

Post your reply

Sign in to post your reply or Sign up for a free account.