Change bar plot colours in MATLAB 2014b
Mostrar comentarios más antiguos
In MATLAB 2014a and earlier, one could use "get" and "set" to control the colour of the individual bars of a bar plot using the code below.
x=0:10; y=rand(size(x));
figure(1)
b=bar(x,y);
b_child=get(b,'Children');
set(b_child,'CData',x)
%set(b_child,'CData',y)
However, this does not appear to work in MATLAB 2014b; "b.Children" is an empty GraphicsPlaceholder array. Is there a way? I realise that it would be possible to declare "hold on" and plot each bar individually, but I would rather avoid this.
Respuestas (1)
Joseph
el 20 de Feb. de 2015
Categorías
Más información sobre Bar Plots en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!