Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Scilab create stacked bar charts with different color

314 views
Skip to first unread message

Tohasi

unread,
Apr 21, 2006, 6:09:14 AM4/21/06
to
Hello everyone,

I want to create bar charts with "bar". There are 16 different data
rows in my input matrix.

The automatic color distribution obviosly create only 7 different
colors from data entry 1 to 7. Then it begins with the same colors
again from 8 to 14 and so on til 16.

My new Idea:

I created 16 "bar" commands in a loop. In every loop the bar gets a
different color. At the end "barhomogenize('stacked',1);" sum these
seperat bars up to the suggested result.
Fine for me BUT:

The color option for bar only accept a color string like "red" or
"green". These basic colors are not enough to create 16 or more color
divided bar parts. Colors like "scilab green1" or something like it are
not accepted.

My question: Is there any way to solve this problem?

I would like the have at least 50 different colors

my code:

n = 16;

cmap=jetcolormap(n); // sets the colormap jet

cmap=get(gcf(),"color_map"); // to get the actual color map

for i = 1:n;

names=rgb2name(cmap(i,:)*255); // gets the color name out of the r
g b

// also you can get the i'sted color from the colormap
(jetcolormap(n); )

names(1,1) // result is a matrix, because color can have more than
one name in scilab

bar(mat(:,i+1),names(1,1)); // creates a bar chart from matrix mat
from row 2 - 17 (n = 16)

end

barhomogenize('stacked',1); // sums up the created bars

Thanks for all answers

Tohasi

gobin

unread,
Apr 21, 2006, 7:31:20 AM4/21/06
to
Hello there,

Does someone know of a good book or tutorial for an introduction to
"Scilab and finite elements" ?

Thanks in advance,
jF

Francois Vogel

unread,
Apr 21, 2006, 7:38:51 AM4/21/06
to
There are a number of contributions (toolboxes) available, but no book
AFAIK:

http://www.scilab.org/contrib/index_contrib.php?page=download.php&category=FINITE%20ELEMENTS%20TOOLS

Francois


"gobin" <gobin...@gobinjf.be> a écrit dans le message de news:
1145619080....@chouchou.gobinjf.be...

Francois Vogel

unread,
Apr 21, 2006, 10:09:52 AM4/21/06
to
You should file a bug report.

Problem is in function getLineSpec (SCI/macros/xdess/getLineSpec.sci).
This function only knows about the following colors:
ColorVal = ['red' 'green' 'blue' 'cyan' 'magenta' 'yellow' 'black'
'black' 'white']

This should be expanded to be aware of all the colors listed in help
color_list. This improvement is however not completely trivial.

Good luck,
Francois


Tohasi a écrit :

bruno

unread,
Apr 21, 2006, 12:00:05 PM4/21/06
to

Hi,

To help Thomas, I have made a small hack such that any color from
the color_list help page should work. Also you could put colors in the
form "[r,g,b]" that is a vector of r,g,b inside a string with r,g and
b
integers in [0,255].

If you are interested you can download it at :

http://www.iecn.u-nancy.fr/~pincon/

hth
Bruno

Tohasi

unread,
Apr 25, 2006, 8:03:55 AM4/25/06
to
Hi Francois and Bruno,

thanks again for your help

It work fine. So nice to have this internet. Communication is
everything.

Thomas

0 new messages