changing bar color to black and white
4 views (last 30 days)
Show older comments
Hello every body
I want to change the color of a bar element to black and white, I don't know how to use the RGB codes of the colors.
bar(mydata, ' stacked ', 'color' , 'DimGray');
As I googled I find '65 65 65' for RGB code of 'dimGray' , and also I used
bar(mydata, ' stacked ', 'color' , [ 65 65 65 ]);
but it doesn't work out.
Could anyone help me in this issue?
Appreciate your kind help.
0 Comments
Accepted Answer
Robert U
on 29 Sep 2017
Hi Vahid_68,
the function bar does not support your command. Colors have to be given as normalized values in the range [0..1] and there is no property 'color'.
One way (even though you cannot distinguish matched segments) is to call the following commands:
x = rand(5);
bar(x,'stacked','FaceColor',[0.65 0.65 0.65])
That gives you a grey faced bar with 5 segments each.
Kind regards,
Robert
2 Comments
Walter Roberson
on 29 Sep 2017
bar(mydata, ' stacked ', 'color' , [ 65 65 65 ]);
should become
bar(mydata, ' stacked ', 'color' , [ 65 65 65 ]/255);
More Answers (0)
See Also
Categories
Find more on Data Distribution Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!