Changing the refline name in the legend

조회 수: 6 (최근 30일)
Truman Cassady
Truman Cassady 2019년 2월 20일
댓글: Star Strider 2019년 2월 20일
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.
legendName.JPG

답변 (1개)

Star Strider
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
Truman Cassady
Truman Cassady 2019년 2월 20일
Thank you!
I tried this but the scatter function does not produce a line and I it is requried that I label my curves with different colors.
Star Strider
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 CenterFile Exchange에서 Legend에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by