[Scilab-users] Changing polyline properties in param3d1

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

[Scilab-users] Changing polyline properties in param3d1

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

Maybe there is a simpler way to write it regarding that the number of
columns in X, Y and Z matrices (number of polylines) will be different
depending on data given in the program.

Regards,
Iza
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Rafael Guerra Rafael Guerra
Reply | Threaded
Open this post in threaded view
|

Re: Changing polyline properties in param3d1

Hello,

I do not know the answer.

On the other hand, as usually one wants to differentiate the different curves, could you predefine a number of curve properties (ps, th, fr, arrays below) and loop thru each curve?

N = size(X,2);
for i = 1:N
    param3d1(X(:,i),Y(:,i),Z(:,i));
    gce().polyline_style= ps(i);
    gce().thickness= th(i);
    gce().foreground= fr(i);
end

Regards,
Rafael
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Iza Iza
Reply | Threaded
Open this post in threaded view
|

Re: Changing polyline properties in param3d1

Thank you for your answer, but here all the polylines have the same
properties. The problem is when there is only one polyline because the
levels structure of figure properties are different then in the case of
multiple polylines.
But, as there is no other idea, I will stick with my "if" clause :-)

Iza




W dniu 18.07.2018 19:00, Rafael Guerra napisał(a):

> Hello,
>
> I do not know the answer.
>
> On the other hand, as usually one wants to differentiate the different
> curves, could you predefine a number of curve properties (ps, th, fr,
> arrays below) and loop thru each curve?
>
> N = size(X,2);
> for i = 1:N
>     param3d1(X(:,i),Y(:,i),Z(:,i));
>     gce().polyline_style= ps(i);
>     gce().thickness= th(i);
>     gce().foreground= fr(i);
> end
>
> Regards,
> Rafael
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Rafael Guerra Rafael Guerra
Reply | Threaded
Open this post in threaded view
|

Re: Changing polyline properties in param3d1

Then the following 'if' clause might be preferable, especially if you have many properties to change:

if size(X,2)==1 then
    X = [X X];
    Y = [Y Y];
    Z = [Z Z];
end
param3d1(X,Y,Z);
gce().children.polyline_style=4;
gce().children.thickness=2;
gce().children.foreground=32;
etc...

Regards,
Rafael

-----Original Message-----
From: users <[hidden email]> On Behalf Of Izabela Wójcik-Grzaba
Sent: Thursday, July 19, 2018 12:00 PM
To: Users mailing list for Scilab <[hidden email]>
Subject: Re: [Scilab-users] Changing polyline properties in param3d1

Thank you for your answer, but here all the polylines have the same properties. The problem is when there is only one polyline because the levels structure of figure properties are different then in the case of multiple polylines.
But, as there is no other idea, I will stick with my "if" clause :-)

Iza

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

Re: Changing polyline properties in param3d1

Thank you. It's quite a good idea. Shorter than mine, for sure.

Iza




W dniu 19.07.2018 12:49, Rafael Guerra napisał(a):

> Then the following 'if' clause might be preferable, especially if you
> have many properties to change:
>
> if size(X,2)==1 then
>     X = [X X];
>     Y = [Y Y];
>     Z = [Z Z];
> end
> param3d1(X,Y,Z);
> gce().children.polyline_style=4;
> gce().children.thickness=2;
> gce().children.foreground=32;
> etc...
>
> Regards,
> Rafael
>
> -----Original Message-----
> From: users <[hidden email]> On Behalf Of Izabela
> Wójcik-Grzaba
> Sent: Thursday, July 19, 2018 12:00 PM
> To: Users mailing list for Scilab <[hidden email]>
> Subject: Re: [Scilab-users] Changing polyline properties in param3d1
>
> Thank you for your answer, but here all the polylines have the same
> properties. The problem is when there is only one polyline because the
> levels structure of figure properties are different then in the case
> of multiple polylines.
> But, as there is no other idea, I will stick with my "if" clause :-)
>
> Iza
>
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: Changing polyline properties in param3d1

In reply to this post by Iza
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

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

Re: Changing polyline properties in param3d1

Le 19/07/2018 à 21:30, Samuel Gougeon a écrit :
.../...

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

reported here and fixed there.



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

Re: Changing polyline properties in param3d1

In reply to this post by Samuel GOUGEON
Le 19/07/2018 à 21:30, Samuel Gougeon a écrit :
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.

This bug about param3d1() unstable hierarchy is now reported there.


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

Re: Changing polyline properties in param3d1

I'm glad that my problem can help to improve Scilab and looking forward
to use the new version :-)

Iza




W dniu 19.07.2018 23:57, Samuel Gougeon napisał(a):

> Le 19/07/2018 à 21:30, Samuel Gougeon a écrit :
>
>> 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.
>
> This bug about param3d1() unstable hierarchy is now reported there
> [1].
>
>
>
> Links:
> ------
> [1] http://bugzilla.scilab.org/show_bug.cgi?id=15671
> _______________________________________________
> users mailing list
> [hidden email]
> http://lists.scilab.org/mailman/listinfo/users
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users