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, Neil -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear Neil,
I had actually implemented the last updates on the Plot/PlotWindow classes in order to share with the community developments I required previously for a given plugin. And horizontal error bars are up to now indeed not implemented within the last ImageJ plot code. Thus if everybody agrees (I guess it is mostly up to Wayne to take the decision), I can make the needed development for these classes as well as the macro implementation and then submit the changes in order to be updated in the native ImageJ code. My best regards, Philippe Philippe CARL Laboratoire de Biophotonique et Pharmacologie UMR 7213 CNRS - Université de Strasbourg Faculté de Pharmacie 74 route du Rhin 67401 ILLKIRCH Tel : +33(0)3 68 85 41 84 -----Message d'origine----- De : ImageJ Interest Group [mailto:[hidden email]] De la part de Neil Fazel Envoyé : mercredi 9 juillet 2014 03:41 À : [hidden email] Objet : horizontal error bars using Plot function 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, Neil -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Dear all / Neil / Wayne,
Please find under the following links the updates of the Plot, PlotWindow and Functions .java files taking into account the request of Neil: http://punias.free.fr/Plot/Plot.java http://punias.free.fr/Plot/PlotWindow.java http://punias.free.fr/Plot/Functions.java and the IJ.jar file implementing this new additions can be found under the following link: http://punias.free.fr/Plot/ij-1.49c.jar Finally the following macro demonstrates how to use this new implementation: 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); xerrorBars = newArray(2.1, 3.25, 0.35, 0.5, 0.61,0.7,0.85,0.89,0.95); Plot.create("Error Bars", "X", "Y", xValues, yValues); Plot.setLimits(0, 1, 0, 10); Plot.setLineWidth(2); Plot.add("error" , errorBars); Plot.add("horizon", xerrorBars); Plot.show(); } I'm open for critics, especially for the keyword "horizon" in order to define the addition of X error bars in macros. My best regards, Philippe Philippe CARL Laboratoire de Biophotonique et Pharmacologie UMR 7213 CNRS - Université de Strasbourg Faculté de Pharmacie 74 route du Rhin 67401 ILLKIRCH Tel : +33(0)3 68 85 41 84 -----Message d'origine----- De : ImageJ Interest Group [mailto:[hidden email]] De la part de Philippe CARL Envoyé : mercredi 9 juillet 2014 10:09 À : [hidden email] Objet : Re: horizontal error bars using Plot function Dear Neil, I had actually implemented the last updates on the Plot/PlotWindow classes in order to share with the community developments I required previously for a given plugin. And horizontal error bars are up to now indeed not implemented within the last ImageJ plot code. Thus if everybody agrees (I guess it is mostly up to Wayne to take the decision), I can make the needed development for these classes as well as the macro implementation and then submit the changes in order to be updated in the native ImageJ code. My best regards, Philippe Philippe CARL Laboratoire de Biophotonique et Pharmacologie UMR 7213 CNRS - Université de Strasbourg Faculté de Pharmacie 74 route du Rhin 67401 ILLKIRCH Tel : +33(0)3 68 85 41 84 -----Message d'origine----- De : ImageJ Interest Group [mailto:[hidden email]] De la part de Neil Fazel Envoyé : mercredi 9 juillet 2014 03:41 À : [hidden email] Objet : horizontal error bars using Plot function 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, Neil -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Neil Fazel
Hi Philippe,
Thank you for sharing your improvement to the Plot function; I look forward to it becoming available as it would remove the need to switch back and forth between ImageJ and a plotting application (as I often do) merely because of a lack of horizontal error bars. One suggestion: something like "xerror" or "horizontalerror" might be more intuitive: Plot.add("xerror", xerrorBars); Plot.add("horizontalerror", xerrorBars); Best regards, Neil -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Neil Fazel
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 |
In reply to this post by Neil Fazel
Thanks very much for making this available. I tried it and it works.
A comment: I noticed that in order to get the error bars displayed, I needed to pass the X and Y arrays when calling Plot.create(). Something like the following, which adds data points via calls to Plot.add(), does create plot points (in red), connected by lines (in light gray), but error bars do not appear: Plot.create("Spectrum"," E[keV]", "#photons / keV / sr"); Plot.setLimits(0, 75, 0, max*1.3); Plot.setLineWidth(2); Plot.setColor("lightGray"); Plot.add("line", energies, spectrumPoints); Plot.setColor("red"); Plot.add("circles", energies, spectrumPoints); Plot.setColor("black"); Plot.add("yerrors", verticalErrors); Plot.add("xerrors", energyErrors); Plot.show(); Best regards, Neil -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Jul 9, 2014, at 5:50 PM, Neil Fazel wrote:
> Thanks very much for making this available. I tried it and it works. > > A comment: I noticed that in order to get the error bars displayed, I needed to pass the X and Y arrays when calling Plot.create(). Something like the following, which adds data points via calls to Plot.add(), does create plot points (in red), connected by lines (in light gray), but error bars do not appear: This bug is fixed in the latest daily build (1.49e1). The following updated example macro draws the curve in light gray, labels each point with a red circle and draws black error bars that are thinner than the curve. -wayne requires("1.49e"); 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.04,0.05); Plot.create("Error Bars", "X", "Y"); Plot.setLimits(0, 1, 0, 10); Plot.setLineWidth(2); Plot.setColor("lightGray"); Plot.add("line", xValues, yValues); Plot.setColor("red"); Plot.add("circles", xValues, yValues); Plot.setColor("black"); Plot.setLineWidth(1); Plot.add("yerrors", yErrorBars); Plot.add("xerrors", xErrorBars); Plot.show(); > Plot.create("Spectrum"," E[keV]", "#photons / keV / sr"); > Plot.setLimits(0, 75, 0, max*1.3); > Plot.setLineWidth(2); > Plot.setColor("lightGray"); > Plot.add("line", energies, spectrumPoints); > Plot.setColor("red"); > Plot.add("circles", energies, spectrumPoints); > Plot.setColor("black"); > Plot.add("yerrors", verticalErrors); > Plot.add("xerrors", energyErrors); > Plot.show(); > > Best regards, > Neil > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Neil Fazel
Hi Wayne,
Thanks for the fix. It's work beautifully. Best regards, Neil -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |