Greetings Michael,

So... Is there a way to get the plot.useTemplate to override the
plot.setLimitsToFit, e.g., place plot.useTemplate after
plot.setLimitsToFit in the code???

The reason I ask is that the actual plotting code is generic standalone
plugin and sometimes, as determined when viewing the plots, the user would
like to view the results of a different ROI in the same format... In the
case here, the only thing that changes is the y values. In the actual code
there are 6 y curves plotted, and thus the use of plot.setLimitsToFit. If
I were to implement this fancy limiting in my code using plot.setLimits
would plot.useTemplate still not dominate?


Thanks,

Fred

On Thu, January 25, 2024 4:06 am, Michael Schmid wrote:
> Hi Fred,
>
> your data contain the value x=0. Thus, plot.setLimitsToFit forces the
> plot to include the value x=0, which forces the x axis to be linear, not
> logarithmic.
> If you have only positive data, or if you don't call setLimitsToFit,
> useTemplate with Plot.COPY_AXIS_STYLE keeps the axis logarithmic.
>
> Michael
> ________________________________________________________________
> On 25.01.24 00:42, Fred Damen wrote:
>> Greeting,
>>
>> I am trying to maintain the logarithmic axis through successive plots,
>> see
>> below. To reproduce, you...
>>
>> Run the below plugin.
>> Click "Press me"
>> Choose More>> Set Range...
>> Set X From to 0.1
>> Set Log X Axis
>> Click OK
>> Click "Press me"
>> The X axis is no longer logarithmic.
>> Choosing More>> Set Range...
>> reveals that X From is now "0" again, albeit Log X Axis is still set...
>>
>> Q: Is just X_RANGE required for my requirement, or is COPY_AXIS_STYLE
>> also
>> required?
>>
>> Fred
>>
>>
>>
>> import ij.*;
>> import ij.process.*;
>> import ij.gui.*;
>> import java.awt.*;
>> import java.awt.event.*;
>> import ij.plugin.*;
>> import ij.plugin.frame.*;
>>
>> public class TestuseTemplate implements PlugIn {
>>
>>     PlotWindow pwin = null;
>>     Plot prevPlot = null;
>>     public void run(String arg) {
>>        GenericDialog gd = new NonBlockingGenericDialog("test
>> useTemplate");
>>        gd.addButton("Press me",new ActionListener() {
>>           public void actionPerformed(ActionEvent e) {
>>              Plot plot = new Plot("Title", "X", "Y");
>>              plot.addPoints(new float[]{0,10,100,1000},new
>> float[]{0,10,100,1000},Plot.LINE);
>>
>>              if (prevPlot != null)
>>                 plot.useTemplate(prevPlot,
>> Plot.COPY_SIZE+Plot.X_RANGE+Plot.COPY_AXIS_STYLE);
>>
>>              if (pwin==null)
>>                 pwin = plot.show();
>>              else
>>                 pwin.drawPlot(plot);
>>              plot.setLimitsToFit(true);
>>
>>              prevPlot = plot;
>>              }
>>           });
>>        gd.showDialog();
>>        }
>>
>> }
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

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

Reply via email to