Error bar issues...

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Error bar issues...

JimmiB
Hi all, I would like to add error bars to a plot.  They are being stubborn
and will not appear......

The example macro
     macro "Error Bars" {
        xValues = newArray(0.1, 0.25, 0.35, 0.5, 0.61,0.7,0.85,0.89,0.95);
        yValues = newArray(2,5.6,7.4,9,9.4,8.7,6.3,4.5,1);
        errorBars = newArray(0.8,0.6,0.5,0.4,0.3,0.5,0.6,0.7,0.8);
        Plot.create("Error Bars", "X", "Y", xValues, yValues);
        Plot.setLimits(0, 1, 0, 10);
        Plot.setLineWidth(2);
        Plot.add("error bars", errorBars);
        Plot.show();
    }
works like a charm.

Mine does not.

The relevant part of the macro is below.
The errorBars array is being populated and can be plotted as a line.
Just won't appear.........
Any suggestions?


nROIs=roiManager("count");
id=getImageID();
nslices=nSlices();
print("nROIs="+nROIs);
for(n=0; n<nROIs; n++){
selectImage(id);
//selectWindow("Event_"+slice+"");
roiManager("Select", n);
header=call("ij.plugin.frame.RoiManager.getName", n);
//print(slice-1);
//waitForUser;
x=newArray(nslices);
y=newArray(nslices);
*errorBars=newArray(nslices);*
for(s=1; s<nslices+1; s++){
x[s-1]=s;
setSlice(s);
getStatistics(area, mean,min,max,std); //need to add std to results
//print(mean);
setResult(header, s-1, mean);
setResult(header+"STD", s-1, std);
y[s-1]=mean;
*errorBars[s-1]=std;*
print(errorBars[s-1]);
updateResults();
 }

if(n==0){
Array.getStatistics(y, amin, amax, amean, astdDev);
Plot.create("event profile", "Slice", "Intensity(au)");
Plot.setLimits(0, nslices, amin, amax+5);
Plot.setLineWidth(2);
        Plot.setColor("green");
        Plot.add("line", x,y);
        *Plot.add("error bars", errorBars);*
        setJustification("left");
         Plot.addText(header, 0.9, 0.1);
 }

}





*Dr James Burchfield*
The Garvan Institute of Medical Research
384 Victoria Street
Darlinghurst, NSW, 2010
Australia

Email: [hidden email]
Phone:+61 2 92958229
Web: *www.garvan.org.au <http://www.garvan.org.au>*

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html