今天,我在用matlab画图的时候出现了这个问题
注意看legend表
居然出现了两个红色点
和我想要的不一样
我尝试了很多方法都还是两个红色
我把代码放在这里,如果有专家知道可以教我为什么会这样
titlename = ['relate_ error_ of psi_h = ',num2str(xiangduiwucha_h_mean*100),'%,relate_ error_ of psi_q = ',num2str(xiangduiwucha_q_mean*100),'%']
figure(1)
h1=scatter(time,hlb_obs_half(time),'k.');hold on;
h2=scatter(time ,hlb_bulk_psih(time),'r.');hold on;
h3=plot(time,hlb_bulk_psiq(time),'-','color',[0 0.4470 0.7410]);hold off
legend([h1,h2,h3],'Observation','Original Scheme','New Scheme ','location','northeast');
xlabel('Time(hr)','FontSize',15);
ylabel('Latent Heat Flux (W/m^2)','FontSize',15);
title(titlename)
grid off;
最后我灵机一现
为什么不用plot画散点呢?
看legend !一个黑色一个红色点,是我想要的。问题解决!
我发誓我以后不会再用scatter了!
h1=plot(time,hlb_obs_half(time),'k.');hold on;
h2=plot(time ,hlb_bulk_psih(time),'r.');hold on;
h3=plot(time,hlb_bulk_psiq(time),'-','color',[0 0.4470 0.7410]);hold off
legend([h1(1),h2(1),h3(1)],'Observation','Original Scheme','New Scheme ','location','northeast');
xlabel('Time(hr)','FontSize',15);
ylabel('Latent Heat Flux (W/m^2)','FontSize',15);
title(titlename)
grid off;
我又绕开了一个问题。希望这些问题以后不会再回头找我。><