Login  Register

Re: horizontal error bars using Plot function

Posted by Rasband, Wayne (NIH/NIMH) [E] on Jul 09, 2014; 7:47pm
URL: http://imagej.273.s1.nabble.com/horizontal-error-bars-using-Plot-function-tp5008640p5008658.html

On Jul 8, 2014, at 9:40 PM, Neil Fazel wrote:

> Is there a way to get the Plot() function of the ImageJ macro language to draw horizontal error bars? I looked at macros/ExamplePlots.txt and it only draws vertical errors bars. It would be nice if there were a way to draw both.

Thanks to Philippe Carl, upgrade to ImageJ 1.49d and you will be able to add horizontal error bars to plots. Here is an example:

  requires("1.49d");
  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);
  yErrorBars  = newArray(0.8,0.6,0.5,0.4,0.3,0.5,0.6,0.7,0.8);
  xErrorBars  = newArray(0.05,0.05,0.04,0.03,0.06,0.06,0.03,0.06,0.05);
  Plot.create("Error Bars", "X", "Y", xValues, yValues);
  Plot.setLimits(0, 1, 0, 10);
  Plot.setLineWidth(2);
  Plot.add("yerrors", yErrorBars);
  Plot.add("xerrors", xErrorBars);
  Plot.show();

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