color changing in one errorbar plot

1 visualización (últimos 30 días)
itamar luzon
itamar luzon el 16 de En. de 2017
Editada: Walter Roberson el 16 de En. de 2017
Hi, when I plot a errorbar/bar, (matlab 2016a) the color is changing on the same plot. someone know how to fix it? buy the way it's didn't happen in matlab 2014 thanks :
x=-100:2:100;
y=sinc(x*pi/100);
dy=y/10;
figure;
errorbar(x,y,dy);
xlim([-100 100]);
ylim([-0.25 1.1]);
figure;
bar(x,y);
xlim([-100 100]);
ylim([-0.25 1.1]);

Respuestas (1)

KSSV
KSSV el 16 de En. de 2017
clc; clear all ;
x=-100:2:100;
y=sinc(x*pi/100);
dy=y/10;
% figure;
% errorbar(x,y,dy);
% xlim([-100 100]);
% ylim([-0.25 1.1]);
% figure;
% bar(x,y) ;
% xlim([-100 100]);
% ylim([-0.25 1.1]);
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
plot(x,y)
xlim([-100 100]);
ylim([-0.25 1.1]);
figure
for i = 1:length(x)
bar(x(i),y(i),1.5,'Facecolor',c(i,:)) ;
hold on
end
xlim([-100 100]);
ylim([-0.25 1.1]);
  2 comentarios
itamar luzon
itamar luzon el 16 de En. de 2017
thanks, but I tryed and I get a nice rainbow
KSSV
KSSV el 16 de En. de 2017
c = jet(length(x)) ;
You can use your required colormap.

Iniciar sesión para comentar.

Categorías

Más información sobre Errorbars en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by