¿como puedo asignar a la barra de color un tiempo y que esto se vea reflejado en los datos?

1 view (last 30 days)
Hola!!! Tengo la siguiente figura. Quiero que los puntos tomen color de acuerdo al tiempo en la barra de color. Cuando hago el plot sin considerar los contornos funciona perfecto, sin emabrgo cuando incluyo en el plot los contornos no funciona y obtengo lo que ven en la figura. Quizas alguien pueda ayudarme al respecto. Esto fue parte de los que hice para realizar la figura:
ti=datenum(2007,11,13,0,0,0); tf=datenum(2008,05,21,0,0,0);
ttt=(ti:hours(1):tf)'; ttt=datenum(ttt);
[ss tt]=meshgrid(34:0.05:36,11:0.05:21);%%% malla dependiendo de tus datos
dens= gsw_rho(ss,tt,0)-1000;%densidad sin efectos de presi?
figure
[c1,h] = contour(ss,tt,dens,':','Color',[.5 .5 .5]);
clabel(c1,h,'labelspacing',360,'fontsize',8,'color',[.5 .5 .5]);
hold on
scatter(sa_48_h_I,te_48_h_I,[],ttt(1:end-1),'.')
cmocean balance
h = colorbar;
s = datestr( linspace(733359,733549,10) , 'dd/mm/yyyy' );
set(h,'YtickLabel',s)

Answers (1)

Aman
Aman on 14 Mar 2023
Hi,
I understand that you have plot a scatter plot in which color of each point depends on some variable and it works fine when used alone but when the scatter plot is used on top of the contour line then all the points appear in the same color.
All the points appear in the same color as the range of the color variable of the contour plot and the scatter plot are different so during scaling the same color is picked up.
In order to solve this you can refer this link.
Hope it helps!

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!