Re: [Scilab-users] jetcolormap in param3d1
Thank you Samuel for your idea of extending current colormap. As I understant there is no connection between the color and value of T for each polyline in your proposition. As I wrote in my second post I've managed to solve this problem. Maybe you could look at my second problem described there? Regards, Iza --- Izabela Wójcik-Grząba Zespół Konstrukcji Metalowych ZKBiM IIB WIL Politechnika Warszawska W dniu 16.11.2021 09:46, Samuel Gougeon napisał(a): Hello Izabela, The current colormap is always stored as a figure's property, as shown for instance in the examples at https://help.scilab.org/docs/6.1.1/en_US/colormap.html Here is a possible implementation (without the gsort stuff): X = [0.5 1.5 1.5 ; 1.5 2.5 1.5]; Y = [0.5 1 1 ; 1 0.5 2]; Z = [0 1 1 ; 1 2 3]; clf param3d1(X,Y,Z); h = gca().children(1).children; ccm = gcf().color_map; ncurv = size(X,2); ncol = size(ccm,1); // proposal : extending the current color map, instead of replacing it: gcf().color_map = [ccm ; jetcolormap(ncurv)]; h.thickness = 4; h.foreground = ncol+(1:ncurv); // "vectorized" assignment allowed. for loop not required Hope this helps. Samuel Le 15/11/2021 à 13:38, Izabela Wójcik-Grząba a écrit : Hello, I need some help with a param3d1 graph. Each polyline should have color from a colormap according to the value assigned in a T vector. Here is a simple example (not finished): X=[0.5 1.5 1.5 ; 1.5 2.5 1.5]; Y=[0.5 1 1 ; 1 0.5 2]; Z=[0 1 1 ; 1 2 3]; T=[2 1 3]; [sorted_T, index_sort_T]=gsort(T , 'g' , 'i'); colors=zeros(size(T , 'r'); colors(index_sort_T , :)=jetcolormap(size(T , 'r'); param3d1(X,Y,Z); h=gca().children(1); h.children.thickness=4; for i=size(T,'r') h.children(i).color=??? end Instead of question marks there should be a color index, but I don't know how to define it using jetcolormap. I would be grateful for your kind help, -- Izabela Wójcik-Grząba Zespół Konstrukcji Metalowych ZKBiM IIB WIL Politechnika Warszawska ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] jetcolormap in param3d1
Hello Izabela, > De : Izabela Wójcik-Grzaba > Envoyé : lundi 15 novembre 2021 18:12 > > An additional problem appeared with my figure f2. Here is my function: Could you please provide a minimal example with a call to this function? I tried to use the function on the figure provided by the first script (param3d()) but it tells me that f2.children(1).children(7) is not a valid index. Regards -- Christophe Dang Ngoc Chan Mechanical calculation engineer General This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden. ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users
Re: [Scilab-users] jetcolormap in param3d1
Hello Izabela, The current colormap is always stored as a figure's property, as shown for instance in the examples at https://help.scilab.org/docs/6.1.1/en_US/colormap.html Here is a possible implementation (without the gsort stuff): X = [0.5 1.5 1.5 ; 1.5 2.5 1.5]; Y = [0.5 1 1 ; 1 0.5 2]; Z = [0 1 1 ; 1 2 3]; clf param3d1(X,Y,Z); h = gca().children(1).children; ccm = gcf().color_map; ncurv = size(X,2); ncol = size(ccm,1); // proposal : extending the current color map, instead of replacing it: gcf().color_map = [ccm ; jetcolormap(ncurv)]; h.thickness = 4; h.foreground = ncol+(1:ncurv); // "vectorized"assignment allowed. for loop not required Hope this helps. Samuel Le 15/11/2021 à 13:38, Izabela Wójcik-Grząba a écrit : Hello, I need some help with a param3d1 graph. Each polyline should have color from a colormap according to the value assigned in a T vector. Here is a simple example (not finished): X=[0.5 1.5 1.5 ; 1.5 2.5 1.5]; Y=[0.5 1 1 ; 1 0.5 2]; Z=[0 1 1 ; 1 2 3]; T=[2 1 3]; [sorted_T, index_sort_T]=gsort(T , 'g' , 'i'); colors=zeros(size(T , 'r'); colors(index_sort_T , :)=jetcolormap(size(T , 'r'); param3d1(X,Y,Z); h=gca().children(1); h.children.thickness=4; for i=size(T,'r') h.children(i).color=??? end Instead of question marks there should be a color index, but I don't know how to define it using jetcolormap. I would be grateful for your kind help, -- Izabela Wójcik-Grząba Zespół Konstrukcji Metalowych ZKBiM IIB WIL Politechnika Warszawska ___ users mailing list users@lists.scilab.org http://lists.scilab.org/mailman/listinfo/users