Setting a Colormap To An Errorbar Plot
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hey guys, I was a just wondering if it's possible set a colormap like 'jet' to an errorbar plot. I found one place that already can do this with a for loop
c = jet(length(x)) ;
figure;
hold on
for k = 1:length(x)
e1 = errorbar(x(k),y(k),dy(k),'x');
set(e1,'Color',c(k,:))
set(e1,'MarkerEdgeColor',c(k,:))
end
but is there anyway to do this directly with linespecs like "MarkerFaceColor"? Thanks in advance!
1 comentario
Respuestas (1)
DGM
el 15 de Nov. de 2022
As far as I know, the answer is no. The documentation and error messaging supports this assertion. It should not be surprising, as tools like plot() don't support the behavior either.
Are there undocumented methods? Maybe. I can't seem to get anywhere with it though.
n = 20;
x = linspace(0,2*pi,n);
y = sin(x);
dy = 0.1*randn(1,n);
% map must be 4xN, uint8
rgbamap = im2uint8([jet(n) ones(n,1)]).';
% plot the thing
heb = errorbar(x,y,dy,'x');
% try to manipulate undocumented descendant objects
hmark = heb.MarkerHandle; % a marker object
hbar = heb.Bar; % a linestrip object
hmark.EdgeColorBinding = 'interpolated'; % this works
hmark.EdgeColorData = rgbamap;
%hbar.ColorBinding = 'interpolated'; % but this won't
%hbar.ColorData = rgbamap;
So I can colormap the X markers, but not the bars or the caps. I don't know if I'm specifying these properties wrong or if it's just a limitation. It's not like there's documentation for this. Make of it what you will.
0 comentarios
Ver también
Categorías
Más información sobre Errorbars en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!