Hi Fred,
this is too many points at once, and the example is too complicated. It
would help to create minimal reproducible examples for the individual
issues or maybe two issues at a time.
https://en.wikipedia.org/wiki/Minimal_reproducible_example
If possible, a macro would be easier to reproduce than Java code. Most
java calls of the Plot class have a corresponding macro call.
I'll try to respond to a few points:
- Headings in the list and legend or data set names in "Add Fit"
inconsistent:
With "List" you get a ResultsTable.
Headings in a ResultsTable have several restrictions (ideally, there
should be no spaces in a single heading) and headings must be unique
(You can't have two columns with the same heading).
You can fit only y values, not the error bars.
----
> [Is there a proper was to get two different colors and labels for the
> addPoints with errorbars? I realize the setLegend has one too few labels,
> but it produces the desired legend.]
Sorry, data points and error bars always have the same color. If you
need different colors, as a workaround you could add simple dots with
the error bars in one color, then add filled symbols in another color;
this will cover the dots (Use setColor with two arguments for filled
symbols.) Preferably, this should be done with the first 'addPoints'. If
a data set has the same x&y values as the first one added, 'List' and
Data>>Save Data will show only the first one. More>>Contents style will
show both data sets.
----
> The auto_position(ed) legend seems to be poorly placed.
The algorithm is to cover as few non-blank pixels of plot contents
(ignoring the color of the grid) as possible. It does not care about the
surroundings of the legend box.
----
> Sometimes the Set Range X-min when set to much less than 1 and
> log is set, and 'Ok'ed, and reopended, will show as 0.0
> and log is set, albeit most of the time it shows correctly
> as 1.00E-n and log is set.
Sorry, I cannot reproduce this. Which are the limits set, and the
min/max data values where this can happen?
Michael
________________________________________________________________
On 27.09.24 02:59, Fred Damen wrote:
> Greetings,
>
> The below code produces the attached plot, and includes a List and
> Data/Add Fits...
>
> As there is a addPoints with error bars, and 4 additional addPoints: Each
> with their own setLabe(-1,); and a setLegend. I expected six 'Y' columns,
> with either the setLabels(-1,)(s) or the setLegend as titles. The first
> two columns seem to be the points(y) and errorbars(ye), albeit the titles
> are wrong (stddev from legend, and ERR0?). There seems to be a missing
> column as there are four more addPoints, and the titles are wrong
(Legend:
> mean mim[sp] max median OR Label: mean min max median; label max comes
> before min, yet the max column is less than the min column).
>
> [Is there a proper was to get two different colors and labels for the
> addPoints with errorbars? I realize the setLegend has one too few labels,
> but it produces the desired legend.]
>
> The auto_position(ed) legend seems to be poorly placed. It would seem the
> lower-left or upper-right would be more appropriate.
>
> Sometimes the Set Range X-min when set to much less than 1 and log is
set,
> and 'Ok'ed, and reopended, will show as 0.0 and log is set, albeit
most of
> the time it shows correctly as 1.00E-n and log is set.
>
> The Add Fit... seems to use the Legend names for the each addPoints,
> albeit are not synced with the columns in the List (Fit: stddev mean max
> min median: yet min actually comes before max in both Labels/legend and
> 'min' was misspelled as 'mim' in legend. And the values that are labeled
> as max are smaller than min. And the ERR0(stddev values) column is not
> accessible from Add Fit...
>
> Also the Add Fit... curve does not cover all the points.
>
> Thanks in advance,
>
> Fred
>
> {Full plugin available if desired, although here is the method that
> produces the plot.]
>
>
> private boolean updateProfile(Roi roi) {
> int nf = img.getNFrames();
> int cs = img.getZ();
> double[] yM = new double[x.length];
> double[] ym = new double[x.length];
> double[] ys = new double[x.length];
> ImageStack is = img.getStack();
> Calibration cal = img.getCalibration();
> for(int f=0,ff=0; f<nf; f++) {
> if (!useFrame[f]) continue;
> ImageProcessor ip =
is.getProcessor(img.getStackIndex(1,cs,f+1));
> ip.setRoi(roi);
> ImageStatistics stats = ImageStatistics.getStatistics(ip,
> MEAN+STD_DEV+MIN_MAX+MEDIAN, cal);
> y[ff] = stats.mean;
> ye[ff] = stats.stdDev;
> yM[ff] = stats.max;
> ym[ff] = stats.min;
> ys[ff] = stats.median;
> ff++;
> }
>
> Plot plot = new Plot("Frame Profile ("+img.getTitle()+")", xLabel,
> yLabel);
> plot.setFont(new Font("Comic Sans MS", Font.PLAIN, 20));
> plot.setXLabelFont(new Font("Comic Sans MS", Font.PLAIN, 24));
> plot.setYLabelFont(new Font("Comic Sans MS", Font.PLAIN, 24));
>
> plot.setColor(Color.blue);
> plot.setLineWidth(1);
> plot.addPoints(x,y,ye,Plot.X);
> plot.setLabel(-1,"mean/dev");
> plot.setColor(Color.red);
> plot.setLineWidth(4);
> plot.addPoints(x,y,Plot.X);
> plot.setLabel(-1,"mean");
>
> plot.setColor(Color.green);
> plot.setLineWidth(2);
> plot.addPoints(x,ym,Plot.BOX);
> plot.setLabel(-1,"min");
> plot.addPoints(x,yM,Plot.BOX);
> plot.setLabel(-1,"max");
> plot.setColor(Color.black);
> plot.addPoints(x,ys,Plot.CIRCLE);
> plot.setLabel(-1,"median");
>
plot.setLegend("stddev\nmean\nmim\nmax\nmedian",Plot.AUTO_POSITION);
>
> plot.setLimitsToFit(true);
> if (prevPlot != null) plot.useTemplate(prevPlot,
> Plot.COPY_SIZE+Plot.X_RANGE+Plot.COPY_AXIS_STYLE);
>
> if (pwin==null) {
> pwin = plot.show();
> pwin.addWindowListener(this);
> }
> else pwin.drawPlot(plot);
>
> prevPlot = plot;
>
> return true;
> }
--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html