Greetings,
When using draw in conjunction with drawPlot the drawLine does not draw the
line; see code below. If you interact with the plot the plot is then drawn
correctly. Also, if you do not use the draw method the line is drawn
correctly, albeit, the need for the draw is due to the forth coming question.
Similar, but different, than my size/resize issue on MacOS, but this time on
Linux and with the plot contents not showing. What ever is being called when
one dynamically causes a redraw is doing the correct thing, but calling the
methods directly is not. Is there a way to programatically fake a dynamic
impetus to cause a redraw?
Question: is there an easy way to mark a location on an axis. I need to
identify special X values, independent of Y. There are methods for placing
things at relative or calibrated locations. How is one supposed to convert
between these? There are methods to go between pixel and calibrated
coordinates/sizes, but nothing directly between relative and calibrated.
Note: Plot::setSize sets the plot frame (where the graph is drawn, minus the
axis/boarders) size, and not the canvas (graph plus axis/boarders) size. The
documentation says it sets the canvas size. How is one supposed to set the
window and/or canvas size of a plot?
What would be nice is to have something similar to MATLAB/gnuplot('s) ability
to place (formated)strings on the axis.
Thanks,
Fred
import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.*;
import ij.plugin.frame.*;
public class TestDrawPlot implements PlugIn {
Plot plot = null;
public void run(String arg) {
plot = new Plot("title","X","Y");
double[] x = new double[]{1,2,3};
double[] y = new double[]{-1,-2,-3};
plot.addPoints(x,y,PlotWindow.X);
plot.setColor(Color.red);
plot.draw();
plot.drawLine(1.5,1,1.5,3);
PlotWindow pw = plot.show();
plot = new Plot("title2","X","Y");
x = new double[]{1,2,3,4};
y = new double[]{-1,-2,-3,-4};
plot.addPoints(x,y,PlotWindow.X);
plot.draw(); // Comment this line and then the red line is displayed.
plot.setColor(Color.red);
plot.drawLine(1.5,-1,1.5,-3);
pw.drawPlot(plot);
}
}
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html