[Scilab-users] plot(x) - define color

Samuel Gougeon sgougeon at free.fr
Fri Feb 19 16:50:31 CET 2021


Le 19/02/2021 à 09:25, anna28 a écrit :
> Hi all,
>
> I would need a help to improve my plot.
> I must graph the trend of 20 variables with the function plot(x); I would
> like to assign a different color/mark to each variable in order to make
> graph understanding immedaite.
>
> At the moment, I do like that and it works:
>
> colour=['.r-','.g-','.k-','.b-','.m-','.r:','.g:','.k:','.b:','.m:','.r--','.g--','.k--','.b--','.m--','.r-.','.g-.','.k-.','.b-.','.m-.'];
> for j=1:20
>      plot(TestPH(j,:),colour(j));
> end
>
> but the plot is not very clear. I would like to add different color and to
> reduce line styles, that are difficult to recognize in the plot.
>
> Is there any way to add colors in the "coulour" array? (I cannot use white,
> yellow and cyan because difficult to see with white background).
>
> thanks!
> Anna
>
Example of plot() post-processing "vectorized" over curves:

x  =  linspace(0,10,100);
phases  =  0:0.15:1.5;
[X,P]  =  ndgrid(x,  phases);
h  =  plot(x,  sin(X+P));

// No explicit loop over curves is required:
h.foreground  =  10:2:30;   // indexed colors
// check for some curves
h(1).foreground
h(10).foreground

// Until color() is vectorized, we could also use named colors as in
colors  =  ["blue"  "scilabcyan4"  "pink"  "orange"  "red"  "green"  "magenta"  "gray50"  "slateblue"  "peru"  "sienna"];  // named colors =>help color_list
h.foreground  =  addcolor(name2rgb(colors)/255); Actually using named colors in linespec 
out of the 8 special ones could be useful, since Scilab's set of named 
colored is quite rich. Samuel

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


More information about the users mailing list