How do I get the legend to ignore certain entries when plotting using the shadedErrorBar function?
3 views (last 30 days)
Show older comments
Nancy Williams
on 9 Aug 2016
Commented: Seble Zewdie
on 26 Mar 2019
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 Comments
Accepted Answer
Jonathan Kwang
on 12 Aug 2016
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 Comments
Seble Zewdie
on 26 Mar 2019
Hi Nancy,
How did you manage to solve this issue of legend when using shaddedErrorBar?
More Answers (0)
See Also
Categories
Find more on Legend 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!