MCPcopy Create free account
hub / github.com/AstroImageJ/astroimagej / addToPlot

Method addToPlot

ij/src/main/java/ij/macro/Functions.java:2803–2838  ·  view source on GitHub ↗
(Plot currentPlot)

Source from the content-addressed store, hash-verified

2801 }
2802
2803 double addToPlot(Plot currentPlot) {
2804 String shape = getFirstString();
2805 int what = Plot.toShape(shape);
2806 double[] x = getNextArray();
2807 double[] y;
2808 double[] errorBars = null;
2809 String label = null;
2810 if (interp.nextToken()==')') {
2811 y = x;
2812 x = new double[y.length];
2813 for (int i=0; i<y.length; i++)
2814 x[i] = i;
2815 } else {
2816 interp.getComma();
2817 y = getNumericArray();
2818 if (interp.nextToken()!=')') {
2819 interp.getComma();
2820 if (isArrayArg()) //can error bars (array) or label
2821 errorBars = getNumericArray();
2822 else
2823 label = getString();
2824 }
2825 }
2826 interp.getRightParen();
2827 if (what==-1)
2828 currentPlot.addErrorBars(y);
2829 else if (what==-2)
2830 currentPlot.addHorizontalErrorBars(y);
2831 else if (errorBars != null)
2832 currentPlot.addPoints(x, y, errorBars, what);
2833 else
2834 currentPlot.add(shape, x, y);
2835 if (label != null)
2836 currentPlot.setLabel(-1, label);
2837 return Double.NaN;
2838 }
2839
2840 double replacePlot(Plot plot) {
2841 int index = (int)getFirstArg();

Callers 1

doPlotMethod · 0.95

Calls 14

getFirstStringMethod · 0.95
toShapeMethod · 0.95
getNextArrayMethod · 0.95
getNumericArrayMethod · 0.95
isArrayArgMethod · 0.95
getStringMethod · 0.95
getCommaMethod · 0.80
getRightParenMethod · 0.80
addMethod · 0.65
setLabelMethod · 0.65
nextTokenMethod · 0.45

Tested by

no test coverage detected