piermorel/gramm

How to set color for different categories?

Opened this issue · 0 comments

Thanks for the great project.

The builtin colors are amazing. However, I'd like to specify the color for different categories using the builtin color options. For example, in fig. 1, I need to compare category a vs. b. In fig. 2, I need to compare category b vs. 3. Therefore, I want category b has the same color in different figures.

load fisheriris.mat
x=randn(1200,1)-1;
cat=repmat([1 1 1 2],300,1);
x(cat==2)=x(cat==2)+2;

clear g5
g5=gramm('x',x,'color',cat);

g5.stat_bin('geom','overlaid_bar'); %Overlaid bar automatically changes bar coloring to transparent
g5.set_title('''overlaid_bar''');
figure('Position',[100 100 500 600]);
g5.draw();

Is there a way to specify the color? Thanks.