sub-plotting 10 into the window

Hey, 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:

http://www.nabble.com/file/p13290670/Bildschirmphoto1.png

···

###############################################
from scipy import *
import pylab
from scipy.optimize import leastsq
import sys

#Functions

def pload(filename):
  """function for loading special Mira data"""

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'),
                 'upper right', shadow=True)
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-
--
View this message in context: http://www.nabble.com/sub-plotting-10-into-the-window-tf4651852.html#a13290670
Sent from the matplotlib - users mailing list archive at Nabble.com.

Hey, 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:

http://www.nabble.com/file/p13290670/Bildschirmphoto1.png

###############################################
from scipy import *
import pylab
from scipy.optimize import leastsq
import sys

#Functions

def pload(filename):
        """function for loading special Mira data"""

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)

Try

  pylab.subplot(2,5,i+1)

Once you get past 9, you cannot use the subplot number w/o commas.
The format is

  subplot(numrows, numcols, plotnum)

so you can write

  subplot(211) or or subplot(2,1,1) which mean the same thing, bug
the version w/o commas only works if the plotnum<10

···

On 10/21/07, nitriles <jonnyt6@...287...> wrote:

    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'),
                 'upper right', shadow=True)
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-
--
View this message in context: http://www.nabble.com/sub-plotting-10-into-the-window-tf4651852.html#a13290670
Sent from the matplotlib - users mailing list archive at Nabble.com.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options