How do I get the legend to ignore certain entries when plotting using the shadedErrorBar function?
4 次查看(过去 30 天)
显示 更早的评论
I am plotting using shadedErrorBar function and I'd like to have the legend completely ignore the first three entries which represent the shaded error bar and its bounds, and keep just the one solid black line with the 'Float dpCO2' data. Here's the code i'm using:
figure('Position', [100, 100, 600, 400]);
S=F9099Surface;
ice=F9099.Depthm(F9099Surface)>10;
hold on;
error=0.025; %%2.5% TOTAL UNCERTAINTY
errors=F9099.pCO2pHAlgALKALI(S)*error;
shadedErrorBar(F9099.datenum(S),F9099.pCO2pHAlgALKALI(S)-F9099.pCO2a(S),errors)%,'LineWidth',3);
%plot(F9099.datenum(S),F9099.AlgPCO2(S),'r','LineWidth',2);
%plot(F9099.datenum(S),F9099.T09pCO22015(S)-400,'m:','LineWidth',3);
plot(F9099.datenum(S),F9099.Taka2014dpCO2(S),'b:','LineWidth',3);
plot(F9099.datenum(S),F9099.Lands2014dpco2(S),'g:','LineWidth',3);
plot(F9099.datenum(S),zeros(size(F9099.datenum(S))),'color','b','LineWidth',2);
scatter(F9099.datenum(S(ice)),zeros(size(S(ice))),50,'*','k')
hold off;
legend '' '' '' 'Float dpCO_2' 'Takahashi 2014' 'Landschutzer 2014' 'pCO_2_a' 'Float sensed ice'...
'location' 'South'
ylabel '\DeltapCO_2 (\muatm)';
%ylim ([340 480]);
xlim ([min(F9099.datenum) max(F9099.datenum)])
datetick ('x', 'mmm','keeplimits');
print -dpng F9099dpCO2shadederrorclim;
crop ('F9099dpCO2shadederrorclim.png');
0 个评论
采纳的回答
Jonathan Kwang
2016-8-12
The "shadedErrorBar" function is a File Exchange submission and not a builtin MATLAB function. It is usually best to contact the author(s) of the submission to resolve any issues you may have.
2 个评论
Seble Zewdie
2019-3-26
Hi Nancy,
How did you manage to solve this issue of legend when using shaddedErrorBar?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!