help with Plot.addErrorBars

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

help with Plot.addErrorBars

Heerpa
Hi all,

 

I wouldlike to plot a fit in imageJ. Therefore I have one dataset of x and y
which should be connected with a line, and one which shouldn't - but should
have error bars. So I use the fit to be the dataset I give as an argument to
the constructor. And then later, I add the second set, and add the
corresponding error bars.

Unfortunately, I don't manage to get the error bars of the second dataset.

Here I show you a test snippet with two data sets, and both have error bars.
Only the first set of error bars is shown.

 

Do any of you know why?

 

Thanks

  Heinrich

-----

            int datalength = 10;

            double[] x1 = new double[datalength];

            double[] x2 = new double[datalength];

            double[] y1 = new double[datalength];

            double[] y1err = new double[datalength];

            double[] y2 = new double[datalength];

            double[] y2err = new double[datalength];

            for (int i = 0; i < datalength; i++) {

                x1[i] = i;

                x2[i] = i+0.5;

                y1[i] = i;

                y1err[i] = 1/(i+1);

               y2[i] = (i+0.5)*(i+0.5);

                y2err[i] = 1;

            }

            Plot TestPlot = new Plot("Its a test", "y", "x", x1, y1);

            TestPlot.setLimits(0,11,0,50);

            TestPlot.addErrorBars(y1err);

            TestPlot.addPoints(x2, y2, Plot.CIRCLE);

            TestPlot.addErrorBars(y2err);

           

            TestPlot.draw();

            TestPlot.show();

 

-----


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