# Re: [Scilab-users] how do I plot 9 curves with automatic colour sequencing?

```
Heinz:```
```
The solution by Samuel proves that Problem #1 isn't actually a problem, buy it
doesn't prevent Problem #2, i.e., cycling over and over again through the first
7 colors.

Unfortunately I couldn't find a direct way to do what you need, but it is still
possible with a little trick.

However, you need some theory.

Each figure has a default color map with 32 colors which you can get using

--> getcolor

which opens this chart: (may be the chart doesn't show in this mailing list,
but if you type the command you'll get it)

[cid:part1.93A21178.EEA5B56B@fceia.unr.edu.ar]

Clicking on a color you get the name and the index (the number between
parentheses following RGB)

(Be sure to close the chart after inspecting it or you won't be able to do
anything else)

Once a figure has been created you can see how the colors are obtained by

--> cmap = gcf().color_map

This yields a 32x3 matrix whose rows contain the RGB (red green blue)
composition of a color. You'll see that cmap(8) = [1 1 1]. This is white since
all three primary colors are at their highest values, i.e., 1.

The last thing to know is that you can set the color of the last polyline you
created by means of

gce().children.foreground = 4;

gce() stands for "get current entity". The current entity after creating a polyline,
i.e., a graph is a compound whose child is the graph you want to change the color of. In this
example you set the color to 4, i,e. "cyan", but you could also set it to any color above
8, instead of cycling the first 7 non-white colors.

So if you create

ind = [1:7 9:32]

you'll have 31 indexes to non-white colors available.

This code assigns different colors. The limit is 31 colors, and a problem is
that some colors are very similar--yet they are dfferent:

scf(1);
x = 0:0.01:1;
y = sin(x'*(1:10));
plot(x',y)
ind = [1:7 9:32];
gce().children.foreground = ind(1:10)';

Finally, you could define your custom color map by means of

gcf().color_map = C

where C is any nx3 matrix where each row contains 3 numbers between 0 and 1 and
n is the number of colors. If you prefer not to proceed by trial and error, you
can just take one of several options provided bya scilab, for instance

C = jetcolormap(10)

The available options can be seen by typing

help colormap

Regards,

Federico Miyara

On 03/06/2023 13:17, Heinz Nabielek wrote:

Colleagues:

[sorry, has been asked before but forgot]: how do I plot 9 curves with
automatic colour sequencing?

o       Problem #1: colour 8 is white and I cannot see my curve
o       Problem #2: colours >= 9 become rather non distinct

Is there an easy solution without complex SciLab acrobatics?
Heinz

Specifier       Color
#1      r       Red
#2      g       Green
#3      b       Blue
#4      c       Cyan
#5      m       Magenta
#6      y       Yellow
#7      k       Black
#8      w       White
_______________________________________________
users mailing list - users@lists.scilab.org<mailto:users@lists.scilab.org>
<mailto:users-unsubscr...@lists.scilab.org><mailto:users-unsubscr...@lists.scilab.org>
https://lists.scilab.org/mailman/listinfo/users
This email and any attachments are intended solely for the use of the
individual or entity to whom it is addressed and may be confidential and/or
privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

and all attachments,

(iii) Dassault Systèmes does not accept or assume any liability or
responsibility for any use of or reliance on this email.

Please be informed that your personal data are processed according to our data
privacy policy as described on our website. Should you have any questions
https://www.3ds.com/privacy-policy/contact/

________________________________
[Avast logo] <https://www.avast.com/antivirus>

El software de antivirus Avast ha analizado este correo electrónico en busca de
virus.
www.avast.com<https://www.avast.com/antivirus>

This email and any attachments are intended solely for the use of the
individual or entity to whom it is addressed and may be confidential and/or
privileged.

If you are not one of the named recipients or have received this email in error,

(i) you should not read, disclose, or copy it,

and all attachments,

(iii) Dassault Systèmes does not accept or assume any liability or
responsibility for any use of or reliance on this email.

Please be informed that your personal data are processed according to our data
privacy policy as described on our website. Should you have any questions
```_______________________________________________