[Tutor] matmolplot

Mark Lawrence breamoreboy at yahoo.co.uk
Tue Jun 1 17:45:54 CEST 2010

On 01/06/2010 14:14, saurabh agrawal wrote:
> 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
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor

If I've managed to reformat your code correctly, the problem is the call 
to plt.axis which sets xmin to 350, compare this to your data values 
where the lowest value of x is 233.27.

Note that there is also a matplotlib mailing list.


Mark Lawrence.

More information about the Tutor mailing list