[Scilab-users] Changing polyline properties in param3d1
Samuel Gougeon
sgougeon at free.fr
Thu Jul 19 21:30:22 CEST 2018
Le 18/07/2018 à 15:19, Izabela Wójcik-Grząba a écrit :
> Hello,
>
> I am looking for an elegant and simple way to manage with changing
> properties of polylines in a param3d1 plot. The problem is that
> sometimes (in case of specific data) there is only one polyline to
> draw but in most cases there are many polylines. By now I solved this
> problem by using "if" statement like below:
>
> param3d1(X,Y,Z);
>
> if size(X,'c')==1 then
> gce().polyline_style=4;
> gce().thickness=2;
> gce().foreground=32;
> else
> gce().children.polyline_style=4;
> gce().children.thickness=2;
> gce().children.foreground=32;
> end
You are right: it would be preferable to get always the same graphical
structure, whatever is the number of plotted curves, as it is the case
with plot2d():
--> plot2d(1:10)
--> gce()
ans =
Handle of type "Compound" with properties:
==========================================
parent: Axes
children: "Polyline"
visible = "on"
user_data = []
tag = ""
--> clf, plot2d([1:10 ; 1:10]')
--> gce()
ans =
Handle of type "Compound" with properties:
==========================================
parent: Axes
children: ["Polyline";"Polyline"]
visible = "on"
user_data = []
tag = ""
So, the same stable architecture shall be reached for param3d1().
Such a change won't be back-compatible, but searching for "param3d1" in
all existing programs and updating them will be easy.
This change can be proposed for Scilab 6.1.
For the time being, i am afraid that using an "if" as you do can't be
avoided, as in:
param3d1(X,Y,Z);
c = gce();
if size(X,"c")>1, c = c.children; end
c.polyline_style = 4;
c.thickness = 2;
c.foreground = 32;
The last 3 lines should be replaceable with simply
set(c, "polyline_style", 4, "thickness", 2, "foreground", 32);
but there is a bug => being fixed
Regards
Samuel
More information about the users
mailing list