Incorrect marker size in legend in errorbar figures
이전 댓글 표시
I just installed the R2017b version to upgrade from R2016a. Now when I put a legend in an errorbar figure, the marker size in the legend is not the same as the marker size in the plot.
x = 0:0.25:5;
y = x.^2 + 3*x + 2;
rng(1)
y = y + 0.5*randn(1,length(y));
err = 0.5*ones(size(y));
figure
errorbar(x, y, err, 'k.', 'MarkerSize', 20)
legend('errorbar')
This does not happen for the 'plot' function. For example, the code below gives the correct marker size.
figure
plot(x, y, 'k.', 'MarkerSize', 20)
legend('plot')
Using the legacy version of the 'legend' function (as below) solves this issue, but also gets rid of the errorbars in the legend, which I would like to keep if possible.
figure
errorbar(x, y, err, 'k.', 'MarkerSize', 20)
[lgd, icons, plots, txt] = legend('errorbar');
Is there a way to keep the errorbars displayed, as in the new implementation of 'legend', but also have the correct marker size?
Thanks.
댓글 수: 2
William Davis
2019년 11월 30일
Was this problem ever resolved? I have the same issue.
Adam Danz
2019년 11월 30일
As of r2019b, the marker size in the legend does not necessarily match the marker size in the plot. Note that this is also true with the plot() function. Here's an example of the marker size differing between plot and legend.
clf()
plot(1:5, 1:5, 'k.', 'MarkerSize', 60)
legend('plot')

답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Errorbars에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!