Columnlegend not working when plotting with errorbar

Hi,
I am trying to plot multiple lines with the function errorbar (it works). Then I want to use multicolumn for the legend, but this does not work. It works if I use plot instead of errorbar though.
Could you please help me? I need to separate my legend in more than 1 column since there are several data lines.
Thanks in advance!

댓글 수: 6

Adam Danz
Adam Danz 2018년 7월 12일
편집: Adam Danz 2018년 7월 12일
It works for me (see below). What is the error you're getting and could you provide the code that produces the error? Are you using the 'NumColumns" parameter in the call to legend? What's multicolumn?
x = 0:.2:pi;
y = sin(x);
err = ones(size(x))*.2;
figure;
eh = errorbar(x,y,err);
hold on
eh2 = errorbar(x,y./2,err);
legend({'ex1','ex2'}, 'NumColumns',2)
Auryn_
Auryn_ 2018년 7월 12일
편집: Auryn_ 2018년 7월 12일
Hi, I downloaded the function "multicolumn" to be able to do so when plotting. If I use NumColumns I receive the following error message: Unknown property: NumColumns. Apparently this functionality is available only in Matlab2018. I am using R2015.
I see. What's not working with your code? Are you getting an error (if so, please share it)? Is your legend empty? Could you share a snippet of code?
This is the error I receive when using columnlegend (which works when using plot instead of errorbar):
Error using matlab.graphics.primitive.Group/get There is no vertices property on the Group class. Error in columnlegend (line 97) vertices_1 = get(child, 'vertices');
Adam Danz
Adam Danz 2018년 7월 13일
편집: Adam Danz 2018년 7월 13일
Looks like the most recent version of this function as of July 13, 2018 addresses your concerns.
Found it, thanks!

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Errorbars에 대해 자세히 알아보기

질문:

2018년 7월 12일

댓글:

2018년 7월 13일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by