A couple questions about the Plot classes

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

A couple questions about the Plot classes

CARL Philippe (LBP)
Dear all (probably Michael),
With the new updates of the ImageJ plot classes, it is now possible to add a legend using the Plot.setLegend("label1\tlabel2...", "options") method.
It is alternatively possible to define the data labels using the Plot.add(type, xValues, yValues, label) method.
But I didn't find a way (or maybe forgot it) to just draw a legend (defining additionally its options) once having defined the data labels through Plot.add(type, xValues, yValues, label) method besides having to redefine all the "label1\tlabel2..." (and in my application I would thus have 18 labels to be redefined) within the Plot.setLegend("label1\tlabel2...", "options") method.
Also is there a difference between the Plot.update() and Plot.show() methods?
At last, I empirically figured out that the Plot.setLimitsToFit() method need to follow either a Plot.update() or Plot.show() method which for me is kind of unlogical.
Thanks a lot in advance for your lightnings on these questions.
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

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: A couple questions about the Plot classes

Michael Schmid-3
Hi Philippe,

sorry, only a slow response; it takes time to accommodate to new
circumstances like distance teaching etc...

(1) You can enable a legend without specifying new labels. Macro call e.g.
   Plot.setLegend("", "top-left");
In Java you can also use null for the labels (it is described in the
javadoc)

(2) The update and updateImage methods (which are the same) need a plot
that has been shown.
show() is meant for creating a new plot and returns the PlotWindow (in
interactive mode). You can 'misuse' it for updating a plot.

(3) Many plot methods do not update the plot to avoid unnecessary
operations when you change several things together (or while creating a
plot). Imaging plotting a few curves with a few 100000 data points and
connecting lines each; this may take a while. In many cases the javadoc
specifies whether the plot gets updated or not.
The setLimitsToFit has a boolean argument where you can specify to
update or not to update. If it does not update with boolean
updateImg=true, it is a bug; then let me know, please.

Michael
___________________________________________________________________________________


On 13/03/2020 5:28 pm, CARL Philippe (LBP) wrote:

> Dear all (probably Michael),
> With the new updates of the ImageJ plot classes, it is now possible to add a legend using the Plot.setLegend("label1\tlabel2...", "options") method.
> It is alternatively possible to define the data labels using the Plot.add(type, xValues, yValues, label) method.
> But I didn't find a way (or maybe forgot it) to just draw a legend (defining additionally its options) once having defined the data labels through Plot.add(type, xValues, yValues, label) method besides having to redefine all the "label1\tlabel2..." (and in my application I would thus have 18 labels to be redefined) within the Plot.setLegend("label1\tlabel2...", "options") method.
> Also is there a difference between the Plot.update() and Plot.show() methods?
> At last, I empirically figured out that the Plot.setLimitsToFit() method need to follow either a Plot.update() or Plot.show() method which for me is kind of unlogical.
> Thanks a lot in advance for your lightnings on these questions.
> 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
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html
Reply | Threaded
Open this post in threaded view
|

Re: A couple questions about the Plot classes

CARL Philippe (LBP)
Hi Michael,
The region where I live is already out of of control since a couple days.
And thus having my daughters at home, I spend now most of my time on their homeworks.
Your answer solved (as always) my open questions.
In fact, I wasn't that far from the solution, since I tryed a:
           Plot.setLegend(null, "top-left");
in  macro but didn't think about the:
           Plot.setLegend("", "top-left");
I would just have a very silly question : what is the javadoc?
Have a nice day,
Philippe

----- Mail original -----
De: "Michael Schmid" <[hidden email]>
À: "imagej" <[hidden email]>
Envoyé: Mardi 17 Mars 2020 14:19:58
Objet: Re: A couple questions about the Plot classes

Hi Philippe,

sorry, only a slow response; it takes time to accommodate to new
circumstances like distance teaching etc...

(1) You can enable a legend without specifying new labels. Macro call e.g.
   Plot.setLegend("", "top-left");
In Java you can also use null for the labels (it is described in the
javadoc)

(2) The update and updateImage methods (which are the same) need a plot
that has been shown.
show() is meant for creating a new plot and returns the PlotWindow (in
interactive mode). You can 'misuse' it for updating a plot.

(3) Many plot methods do not update the plot to avoid unnecessary
operations when you change several things together (or while creating a
plot). Imaging plotting a few curves with a few 100000 data points and
connecting lines each; this may take a while. In many cases the javadoc
specifies whether the plot gets updated or not.
The setLimitsToFit has a boolean argument where you can specify to
update or not to update. If it does not update with boolean
updateImg=true, it is a bug; then let me know, please.

Michael
___________________________________________________________________________________


On 13/03/2020 5:28 pm, CARL Philippe (LBP) wrote:

> Dear all (probably Michael),
> With the new updates of the ImageJ plot classes, it is now possible to add a legend using the Plot.setLegend("label1\tlabel2...", "options") method.
> It is alternatively possible to define the data labels using the Plot.add(type, xValues, yValues, label) method.
> But I didn't find a way (or maybe forgot it) to just draw a legend (defining additionally its options) once having defined the data labels through Plot.add(type, xValues, yValues, label) method besides having to redefine all the "label1\tlabel2..." (and in my application I would thus have 18 labels to be redefined) within the Plot.setLegend("label1\tlabel2...", "options") method.
> Also is there a difference between the Plot.update() and Plot.show() methods?
> At last, I empirically figured out that the Plot.setLimitsToFit() method need to follow either a Plot.update() or Plot.show() method which for me is kind of unlogical.
> Thanks a lot in advance for your lightnings on these questions.
> 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
>
> --
> 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 | Threaded
Open this post in threaded view
|

Re: A couple questions about the Plot classes

Michael Schmid-3
Hi Philippe:

javadoc: I have referred to the comments in the source code; with a
standardized format [1] they are automatically converted into the API
documentation [2].
I must admit that I am quite lazy in this respect; the comments that I
usually create when contributing code are not a full API documentation
as proposed in [1].

Best,

Michael

[1]
https://www.oracle.com/technetwork/java/javase/documentation/index-137868.html
[2] https://imagej.nih.gov/ij/developer/api/index.html
______________________________________________________________________

On 18/03/2020 4:31 pm, CARL Philippe (LBP) wrote:

> Hi Michael,
> The region where I live is already out of of control since a couple days.
> And thus having my daughters at home, I spend now most of my time on their homeworks.
> Your answer solved (as always) my open questions.
> In fact, I wasn't that far from the solution, since I tryed a:
>             Plot.setLegend(null, "top-left");
> in  macro but didn't think about the:
>             Plot.setLegend("", "top-left");
> I would just have a very silly question : what is the javadoc?
> Have a nice day,
> Philippe

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