Login  Register

Re: Update Plot window

Posted by Wayne Rasband on Aug 19, 2009; 2:19am
URL: http://imagej.273.s1.nabble.com/Update-Plot-window-tp3691438p3691441.html

On Aug 18, 2009, at 3:14 PM, David Webster wrote:

> Michael,
>
> I just tried the The Dynamic Profiler. Its works as described when  
> you move
> the profile. But, when I use Process/Smooth, Sharpen, or Find Edges,  
> the
> profile selection (I used a line) disappears and the profile plot  
> doesn't
> change.
>
> David Webster

There is an updated Dynamic Profiler at

    http://rsb.info.nih.gov/ij/plugins/dynamic-profiler.html

that fixes this bug.

-wayne


>
> On Tue, Aug 18, 2009 at 10:00 AM, Michael Schmid <[hidden email]
> >wrote:
>
>> Hi Michael,
>>
>> instead of
>>  plot.show()
>> you can use
>>  plot.getProcessor();
>> and then in the corresponding ImagePlus (which must exist already)  
>> update
>> the image:
>> plotImagePlus.setProcessor(null, ip);
>>
>> The Dynamic Profiler is an example for this:
>> http://rsbweb.nih.gov/ij/plugins/dynamic-profiler.html
>>
>> Michael
>> ________________________________________________________________
>>
>> On 18 Aug 2009, at 18:36, Michael Doube wrote:
>>
>> Hi all
>>>
>>> I have a plugin that iterates in a while loop until convergence  
>>> occurs and
>>> I'd like to monitor the values graphically.  I can draw a Plot of  
>>> the values
>>> once the while loop has finished, but if I try to redraw the plot  
>>> with
>>> multiple calls to my graphResults() method I get a rather large  
>>> number of
>>> Plot windows.
>>>
>>> How can I update a plot window with new data?  I'm collecting the  
>>> Y data
>>> in a Vector (because I can add values to it in the while loop).  
>>> My plotting
>>> method is as follows:
>>>
>>>
>>> private void graphResults(Vector<Double> anisotropyHistory){
>>>       double[] yVariables = new double[anisotropyHistory.size()];
>>>       double[] xVariables = new double[anisotropyHistory.size()];
>>>       Enumeration<Double> e = anisotropyHistory.elements();
>>>       int i = 0;
>>>       while (e.hasMoreElements()){
>>>           yVariables[i] = e.nextElement();
>>>           xVariables[i] = (double)i;
>>>           i++;
>>>       }
>>>       Plot plot = new Plot("Anisotropy", "Number of repeats",
>>> "Anisotropy",
>>>               xVariables, yVariables);
>>>       plot.addPoints(xVariables, yVariables, Plot.X);
>>>       plot.setLimits(0, anisotropyHistory.size(), 0, 1);
>>>       plot.show();
>>>   }
>>>
>>>
>>> Michael
>>>
>>