Login  Register

Re: plot window bug

Posted by CARL Philippe (LBP) on Feb 14, 2020; 4:57pm
URL: http://imagej.273.s1.nabble.com/plot-window-bug-tp5022945p5022948.html

Dear Fred,
I tried to reproduce your bug without any success with the following small plugin which is working as expected:

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.plugin.frame.*;

public class My_Plot implements PlugIn {

        public void run(String arg) {
                Plot plot = new Plot("title","X","Y");
                plot.setSize(600, 300);
                PlotWindow plotwindow = plot.show();
                // The plot is not the write size or scale
/*
                plotwindow.setSize(600,300);
                Dimension pwDim = plotwindow.getSize();
                plotwindow.setLocation(20,20);
                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)
*/
        }
}

My best regards,
Philippe

Philippe CARL
Laboratoire de Bioimagerie et Pathologies
UMR 7021 CNRS - Université de Strasbourg
Faculté de Pharmacie
74 route du Rhin
67401 ILLKIRCH
Tel : +33(0)3 68 85 42 89

----- Le 14 Fév 20, à 6:23, Fred Damen [hidden email] a écrit :

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

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