Hallo all, Ive got 10 strings of data that i plot into 1 big window, but somehow matplotlib gives me a very strange set-up. I am rather new to matplotlib and python so im kinda stuck now!
heres an image of what i get and part of my code:
[IMG]http://img208.imageshack.us/img208/8711/bildschirmphoto1wh9.th.png[/IMG]
or
http://img208.imageshack.us/img208/8711/bildschirmphoto1wh9.png

``````[code=python]
###############################################
from scipy import *
import pylab
from scipy.optimize import leastsq
import sys

#Functions

def residuals(p, y, x):
A,k,theta,C = p
err = y - (A*sin(k*x+theta)**2+C)
return err

def peval(x,p):
A,k,theta,C = p
return A*sin(k*x+theta)**2+C

for i in range(len(data)):
dat = data[i,:]
x=arange(1,17,1)
y_meas = dat[2:]
freq1=dat[0]
freq2=dat[1]

#Plotting

min=x.min()
max=x.max()
step=(max-min)/100.
xfine=arange(min,max,step)
subnr=250+i+1
pylab.subplot(subnr)
pylab.plot(xfine,peval(xfine,plsq[0]), 'r')
pylab.errorbar(x,y_meas,yerr=sqrt(y_meas),fmt='bo')
pylab.xlabel('Number [...]')
pylab.ylabel('Value [...]')
pylab.grid(True)

pylab.legend(('Fitting', 'Measured Data'),
pylab.title('Least square fit for Mira')
pylab.show()

##############################################``````

I just want the graph to be arranged properly into the window.
Later i need to add a main title, a title for each graph and return the values that the computer used to fit the graph (meaning A, k, theta and C)
Thanks a lot!
-Julia-

2
Contributors
2
Replies
3
Views
10 Years
Discussion Span
Last Post by nitriles