setColor_barByGroup
SETCOLOR_BARBYGROUP change the color of a bar to same groups have the
same color.
SETCOLOR_BARBYGROUP(COLOR) change the color of a bar with N groups
where the i-th group has the COLOR(i, :) color.
COLOR is a N-by-3 matrix color in RGB.
COLOR can be a N-by-1 cell with string matlab colors: 'r','b','g',c', etc.
In this case function rgb.m is needed:
http://www.mathworks.com/matlabcentral/fileexchange/1805-rgb-m
P = SETCOLOR_BARBYGROUP(...) return in the N-by-1 vector P the new patches
associated to each group.
SETCOLOR_BARBYGROUP(AX, ...) AX is the axes to apply the color change.
EXAMPLE: Change the current bar to red [1 0 0], blue [0 0 1] and green [0 1 0]
bar(rand(3,5));
color = [1 0 0; 0 0 1; 0 1 0];
setColor_barByGroup(color);
EXAMPLE: Change the subplot bar to the color {'r', 'b', 'g'} (needed
funciton: rgb.m)
data = rand(3,5);
subplot(1,2,1);
bar(data);
subplot(1,2,2);
bar(data);
p = setColor_barByGroup({'r', 'b', 'g'});
Cite As
Mar Callau-Zori (2024). setColor_barByGroup (https://www.mathworks.com/matlabcentral/fileexchange/34328-setcolor_barbygroup), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxTags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
Version | Published | Release Notes | |
---|---|---|---|
1.0.0.0 |