[Tutor] matmolplot
saurabh agrawal
imsam100 at yahoo.co.in
Tue Jun 1 15:14:25 CEST 2010
Hi,
I am trying to make plot using following code:-----------#!/usr/bin/pythonimport numpy as npimport matplotlib.pyplot as pltimport stringfrom pylab import savefigfrom sys import argv
#input file as first argumentf1=argv[1]f = open(f1,'r')line=f.readlines()f.close()
f2 = f1.split(".")#f3 = f2[0].split("-")
l1=[];l2=[]for lines in line: lin=lines.split() l1.append(float(lin[0])) l2.append(float(lin[1])) #print max(l2) for i in range(len(l2)): plt.axvline(x=l1[i], ymin=0, ymax=l2[i], linewidth=2, color='r')
plt.axis([350, 650, 0.0, max(l2)])plt.grid(True)savefig(f2[0]+"-"+"uv.png",dpi=(600/8))plt.show()----------------
My problem is the output plot I am getting is not showing correct values in the plot as are in the input file (MS.txt - attached). It looks like it is scaled to lower value.
Please help.
Regards,
Saurabh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20100601/6fec552d/attachment.html>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: MS.txt
URL: <http://mail.python.org/pipermail/tutor/attachments/20100601/6fec552d/attachment.txt>
More information about the Tutor
mailing list