Changing the refline name in the legend
12 次查看(过去 30 天)
显示 更早的评论
The refline is in the legend but I cannot change its name when writing the legend function. I tried
(refline.Name = 'reference') but that does not exist.

This documentation relates exactly to my issue. The line name corresponds to "dataN." Maybe this would help.

0 个评论
回答(1 个)
Star Strider
2019-2-20
Try this:
figure
scatter(rand(1,10), rand(1,10), 's', 'DisplayName','Validation')
hold on
scatter(rand(1,10), rand(1,10), 'p', 'DisplayName','Calibration')
rl = refline
hold off
hl = legend
hl.String{3} = 'Validation Reference Line';
hl.String{4} = 'Calibration Reference Line';
2 个评论
Star Strider
2019-2-20
My pleasure!
You did not post your code, so I have no idea what the problem is with it, or what your constraints are.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Legend 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!