Login  Register

Re: Is it possible to add new data to a plot from a macro?

Posted by Michael Doube-4 on Feb 11, 2014; 3:46pm
URL: http://imagej.273.s1.nabble.com/Is-it-possible-to-add-new-data-to-a-plot-from-a-macro-tp5006482p5006487.html

Hi James,

> You have to use Plot.show() at the end, after adding all data with
> Plot.add().
> Once shown, the graph can't be updated.

But, the ImageProcessor which is displaying the plot can be updated with a new Plot's data.

It might not be so simple for you to implement but that is the approach we took in BoneJ's Anisotropy plugin, which shows a live updating line plot with error bars and auto-scaling x axis. See createGraph() and updateGraph() here:

https://github.com/mdoube/BoneJ/blob/master/src/org/doube/bonej/Anisotropy.java#L365
https://github.com/mdoube/BoneJ/blob/master/src/org/doube/bonej/Anisotropy.java#L634

Not sure how you would do this in the macro language, however.

Michael

> 2014-02-11 12:14 GMT+01:00 James Burchfield <[hidden email]>:
>
>> Dear all,
>> I am making certain measurements as i go through a macro and would like to
>> add these data to a single plot.
>> I am I correct in thinking that to create a plot and modify it all plot
>> commands must be in a single group?
>>
>> For example this works
>> Plot.create("event profile", "Slice", "Intensity");
>> Plot.setLimits(0, nslices, gmin, gmax);
>> Plot.add("line",x, y);
>> Plot.show();
>>
>> but if i then repopulate y
>>
>> Plot.add("line",x, y);
>> Plot.show();
>>
>> This will not work.
>>
>> Is there a simple work around?
>>
>> Thanks in advance,
>> James
>>
>>
>> *Dr James Burchfield*
>> The Garvan Institute of Medical Research
>> 384 Victoria Street
>> Darlinghurst, NSW, 2010
>> Australia
>>
>> Email: [hidden email]
>> Phone:+61 2 92958229
>> Web: *www.garvan.org.au <http://www.garvan.org.au>*
>>
>> --
>> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>>
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

<http://www.rvc.ac.uk>

This message, together with any attachments, is intended for the stated addressee(s) only and may contain privileged or confidential information. Any views or opinions presented are solely those of the author and do not necessarily represent those of the Royal Veterinary College.

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