Search code examples
matlabmatlab-figureerrorbar

Cant use colors other than the default ones when using shadedE​rrorBar in matlab


So I tried to use raacampbell/shadedE​rrorBar but couldn't use it in the way I wanted with nice colors. All I could do was just the ugly regular/default colors. it did let me use :

ss = shadedErrorBar(x,tav,errbar,'lineProps','r','transparent',true,'patchSaturation',0.08);

but not

ss = shadedErrorBar(x,tav,errbar,'lineProps','#A62EF4','transparent',true,'patchSaturation',0.08); 

hope someone can help, I like my graphs pretty :)


Solution

  • MATLAB colors are defined as triplet values for RGB and not in #A62EF4 So you need to convert hexadecimal A6, 2E and F4 into value from 0.0 ... 1.0. In decimal A6 = 166, 2E = 46, F4 = 244, so replace the 'r' (for red) by [166 46 244]/255