[Scilab-users] Plotting a New Xpoly Directly Inside a Compound

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

[Scilab-users] Plotting a New Xpoly Directly Inside a Compound

Hi,

If one plots several curves into a 2D axes using plot2d(), the curves will
be resembled as polyline children within a compound, which is a child of the
according axes.
Adding further polylines one by one using xpoly() puts these polylines
outside the compound on the same level as the compound is located, as
children of the according axes.

Is there a simple way to have the polyline generated directly within the
existing compound?
I know that I can glue several polylines into a compound, but I would have
to unglue the compound first and then glue all polylines together back into
one compound.
Having many (!) curves makes this quite slow. Especially as glue() reverses
the order of the polylines, so I would have to do a second unglue();glue();
in order to preserve the order they had before ungluing (BTW, is this a bug
or is reversal of the order a desired feature?).

On the other hand, what kind of advantage does the compound have at all,
assuming I wouldn't need the possibility of making all of the curves in the
compound visible or invisible by just modifying the visibility of the
compound?
Ok, I can address all curves by axes.children.children(1:$) without having
to care about the legend, which would be together with the curves in
axes.children(1:$) if all the polylines were not in a compound.

But any additional advantage for using a compound?

Regards,
Roland




--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
der_Phil der_Phil
Reply | Threaded
Open this post in threaded view
|

Re: Plotting a New Xpoly Directly Inside a Compound

Hallo Robert,

 If you use xpoly() it means you know your data before you plot it?
--> I mean: you do not click in the figure to get the coordinates....
--> Why not plot all data at once?

E.g.: Can you not plot all polylines in one single plot2d command?

If you can't, you may try following approach:
Assumption: all data is of same length, e.g.: all lines are drawn by same number of points

1.) you may access the data that composes the plot by searching for:    *.children.data
   * =: I do not recall from memory how deep you have to search....
   e.g.:
   plot2d(); 
   a = gca();
   a.children.children.data....or .....a.children.children.children.data

2.: Save the *.children.data separately in a X-matrix and Y-matrix

3.: Add the data that you would plot with xpoly() to these matrices.

4.: xdel()

5.: replot everything with  plot2d(X-matrix, Y-matrix)

This should give you all lines at the same plot-hirachy.
I did not check, but I would guess that also the line order would not change.

It should be possible to create a function out of this and loop though it each time a xpoly() is added to the plot.


Again, it is not clear why you just do not fuse all data together into one matrix and use plot2d() to plot all data at once.


Best Regards,
Philipp







Am Sa., 13. Juni 2020 um 20:05 Uhr schrieb RolandB <[hidden email]>:
Hi,

If one plots several curves into a 2D axes using plot2d(), the curves will
be resembled as polyline children within a compound, which is a child of the
according axes.
Adding further polylines one by one using xpoly() puts these polylines
outside the compound on the same level as the compound is located, as
children of the according axes.

Is there a simple way to have the polyline generated directly within the
existing compound?
I know that I can glue several polylines into a compound, but I would have
to unglue the compound first and then glue all polylines together back into
one compound.
Having many (!) curves makes this quite slow. Especially as glue() reverses
the order of the polylines, so I would have to do a second unglue();glue();
in order to preserve the order they had before ungluing (BTW, is this a bug
or is reversal of the order a desired feature?).

On the other hand, what kind of advantage does the compound have at all,
assuming I wouldn't need the possibility of making all of the curves in the
compound visible or invisible by just modifying the visibility of the
compound?
Ok, I can address all curves by axes.children.children(1:$) without having
to care about the legend, which would be together with the curves in
axes.children(1:$) if all the polylines were not in a compound.

But any additional advantage for using a compound?

Regards,
Roland




--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Antoine Monmayrant-2 Antoine Monmayrant-2
Reply | Threaded
Open this post in threaded view
|

Re: ?==?utf-8?q? Plotting a New Xpoly Directly Inside a Compound

> Again, it is not clear why you just do not fuse all data together into one
> matrix and use plot2d() to plot all data at once.

From my own experience, this might be the case when you want to track the progression of a lengthy calculation: you periodically add the new data on top of the previous results. This is also the case when you work with experimental data that arrives slowly, by successive batches: you receiver a batch of let's say ~10 curves every couple of minutes for example.

Antoine

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users