From: the cyclist on 4 Mar 2010 14:44 "us " <us(a)neurol.unizh.ch> wrote in message <hk7hv2$q0f$1(a)fred.mathworks.com>... > "Keith Peskosky" <centersnare30(a)yahoo.com> wrote in message <hk7b0r$99a$1(a)fred.mathworks.com>... > > Hi, > > > > I have been trying to figure this out for a few days and I figured its time to get some direct help. I have tried some examples i found online but they are not working as expected they just give me random colors. > > > > i'm loading nine numbers from a file into Matlab when i use this it gives me the nine individual bars I expect. The problem is I would like to make the colors of the bars > > > > "blue green red brown black black orange orange yellow" respectively > > > > this what i have so far > > > > figure > > bar(Skinestreflect) > > set(gca,'XTickLabel',{'Blue', 'Green', 'Red', 'Melanin', '1060 No filter','1060Filter','1570 No Filter', '1570Filter', 'LWP1500FILTER'}) > > > > I have tried several different ways to do this and nothing is giving me good results. > > > > Any help would be great > > one of the solutions > > % the data > v=ceil(5*rand(1,10)); > bh=bar(v); > % - change the bars' colors > ch=get(bh,'children'); > cd=repmat(1:numel(v),5,1); > cd=[cd(:);nan]; > set(ch,'facevertexcdata',cd); > % - play with colormaps > colormap(jet); > disp('press a key to show a user defined colormap'); > pause; > colormap([[1,0,0];[0,1,0]]); > > us This is a very handy solution, and it helped me better understand how to manipulate the colors in a bar chart. I would like to mention a minor point for those who want to implement this solution, which is that "cd" is a poor choice for a variable name, because it conflicts with a command keyword. the cyclist
From: us on 4 Mar 2010 14:49 "the cyclist" > This is a very handy solution, and it helped me better understand how to manipulate the colors in a bar chart. I would like to mention a minor point for those who want to implement this solution, which is that "cd" is a poor choice for a variable name, because it conflicts with a command keyword. > > the cyclist very true - and - i'm sorry(!)... us
From: Oleg Komarov on 4 Mar 2010 15:10 "us " <us(a)neurol.unizh.ch> wrote in message <hmp2s4$hri$1(a)fred.mathworks.com>... > "the cyclist" > > This is a very handy solution, and it helped me better understand how to manipulate the colors in a bar chart. I would like to mention a minor point for those who want to implement this solution, which is that "cd" is a poor choice for a variable name, because it conflicts with a command keyword. > > > > the cyclist > > very true - and - i'm sorry(!)... > > us @us I wonder why you always enclose between brackets the exclamation point (?!). I somehow 'perceive' in a different way the written sentence...Just thoughts anyway. i'm sorry! i'm sorry(!) Oleg
|
Pages: 1 Prev: How can I do a polynomial fitting in the image. Next: Structure name manipulation |