Login  Register

plot window bug

Posted by Fred Damen on Feb 14, 2020; 5:23am
URL: http://imagej.273.s1.nabble.com/plot-window-bug-tp5022945.html

Greetings,

One of the plugins that I am developing, that plots several plots of
requested size and location, all of a sudden decided to start ignoring the
requested plot size plot.setSize(xl,yl); and decided to scale the plot
inappropriately. To my knowledge I did not change anything with the
plotting, or, X windows / Gnome (Fedora 31) or up/down grade ImageJ
(currently 1.52r).  The symptoms seem to be the same as I mentioned about
ages ago on MacOS. The PlotWindow will seem to size itself correctly, on
the next plotwindow.drawPlot(plot) after resizeing the window using the
mouse; frustrating to say the least.

A partial work around is to set the size of the plotwindow instead and
call plotwindow.windowactivated.  Then the second time you do the
plotwindow.drawplot(plot) the plotwindows will be the requested size and a
scale of 1.  Although the plotwindow.getSize() and the actual size of the
gnome adorned window are not the same; whereas the
imp.getWindow().getSize() is the size of the gnome adorned window. (Useful
if you want to layout the windows on the screen in a matrix type fashion)

not the exact code, but is easy to understand then my prose ...

Plot plot = new Plot("title","X","Y");
plot.setSize(600, 300);
PlotWindow plotwindow = plot.show();
// The plot is not the write size or scale
plot.window.setSize(600,300);
Dimension pwDim = plotwindow.getSize();
plotwindow.setLocation(sx,sy);
plotwindow.windowActivated(null);
plotwindow.drawPlot(plot);
// window size seems to be the smallest allowed, albeit the scale seem to
be 1
plotwindow.drawPlot(plot);
// windowsize is as requested, although...
// plotwindow2.setLocation(sx+pwDim.width,sy); // overlaps, is short in x
by 10 pixels
// plotwindow2.setLocation(sx,sy+pwDim.height); // overlays, is short in y
by 100 pixels
// works for ImageWindow(s)

Fred

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