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

```
Le 03/06/2023 à 18:17, Heinz Nabielek a écrit :

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?

The same topic was dealt with on 202-03-20 @
https://www.mail-archive.com/users@lists.scilab.org/msg11103.html

Defining a general strategy of automatic assignment of curves style is not
necessarily trivial.
The current strategy is not the same for plot(): cycling over 7 colors ; and
for plot2d(): scanning the current colormap

Whatever the strategy that you design and then propose and use, it will always
have a limit.
You can't expect to have a always valid method.

The current plot() strategy could be improved for instance by cycling in a
nested way first over line styles,
starting with solid lines as now, and then over line colors.
This would increase the limit to 7x10=70 styles, instead of currently 7.

Please feel free to open a report about the topic if you deem it is worthwhile,
with a rationale. Any actual algorithmic proposal is also welcome.

There is no general solution, but there are easy ways to customize the curve
styles by hand, even at calling time, without post-processing.

x = 0:.05:1;
clf reset
plot(x, sin(x'*(1:10)), "color",[1:6 13 17 28 32])// "color" option
legend(msprintf("Curve #%d\n",(1:10)'), "in_lower_left");

[cid:part1.37Mim3rA.GDIR3PW8@free.fr]

With plot2d(), you get the same figure without the legend with:

x = 0:.05:1;
clf reset
plot2d(x, sin(x'*(1:10)), [1:6 13 17 28 32])

You may also customize the colormap before calling plot2d(), without the style
option.
The hsvcolormap is quite handy because it alternates colors:

x = 0:.05:1;
clf
gcf().color_map = hsvcolormap(11);
plot2d(x, sin(x'*(1:10)))
legend(msprintf("Curve #%d\n",(1:10)'), "in_lower_left");

[cid:part2.pmU8pSci.HfJ9HZA4@free.fr]

All these options are documented.

Regards
Samuel

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/

___
users mailing list - users@lists.scilab.org
https://lists.scilab.org/mailman/listinfo/users

```

### 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

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]

El software de antivirus Avast ha analizado este correo electrónico en busca de
virus.
www.avast.com

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/

```

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

```
Le 03/06/2023 à 18:17, Heinz Nabielek a écrit :

Colleagues:

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

x = 0:.05:1;
clf, plot(x, sin(x'*(1:10)))
legend(msprintf("Curve #%d\n",(1:10)'), "in_lower_left");

[cid:part1.eVriBsLU.bcQMxwT6@free.fr]

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