Errorbar + multiple plots + one legend
2 次查看(过去 30 天)
显示 更早的评论
For 'plot' function it is possible to 'merge' legends by integrating into a vector:
a = plot(rand(4));
hold on
b = plot(rand(4));
legend([a; b], {'a', 'b', 'c', 'd', 'a2', 'b2', 'c2', 'd2'});
But for errorbar plots it doesn work:
a = errorbar(rand(4),rand(4));
hold on
b = errorbar(rand(4),rand(4));
legend([a; b], {'a', 'b', 'c', 'd', 'a2', 'b2', 'c2', 'd2'});
How come and what to do about it?
0 个评论
采纳的回答
更多回答(2 个)
Sorcha Craven Heffernan
2017-12-13
I am having a similar problem errorbar(x, y, yneg, ypos, xpos, xneg, 'kx-', 'MarkerSize',10); hold on errorbar(x, y, y1neg, y1pos, xpos, xneg, 'rx-', 'MarkerSize',10); legend('Increasing current', 'Decreasing Current') hold off
my code is only plotting the second line
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Errorbars 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!