[Scilab-users] jetcolormap in param3d1

Samuel Gougeon sgougeon at free.fr
Tue Nov 16 09:46:38 CET 2021


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
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20211116/852dff0f/attachment.htm>


More information about the users mailing list