How to omit legend entry
98 views (last 30 days)
Show older comments
victoria yap
on 14 Sep 2015
Commented: Star Strider
on 15 Sep 2015
I am trying to omit the legend entry for graph b, but the following code still shows the curve in the legend. Thanks!
a = @(x) sin(x)
fplot (a,[1,10])
hold on
b = @(x) cos (x)
fplot (b,[1,10])
c = @(x) tan (x)
fplot (c,[1,10])
legend ('sinx','','tanx')
0 Comments
Accepted Answer
Star Strider
on 14 Sep 2015
The fplot function won’t let you do that, but plot will:
x = linspace(1,10);
a = @(x) sin(x);
ha = plot (x,a(x));
hold on
b = @(x) cos (x);
hb = plot (x,b(x));
c = @(x) tan (x);
hc = plot (x,c(x));
legend ([ha hc],'sinx','tanx')
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!