필터 지우기
필터 지우기

how to remove labels from legend in plot and keep only text

조회 수: 12 (최근 30일)
RG
RG 2019년 2월 1일
댓글: Image Analyst 2019년 2월 1일
Hi, there,
I'm using legend and I want to remove the colored labels and keep only the text in the legend (Matlab 2018b).
Is there any way to do that?
(I tried using annotation, I don't want the box to be there - just text)

채택된 답변

Image Analyst
Image Analyst 2019년 2월 1일
Did you try just making up a cell array of strings that are spaces and passing that cell array to legend()? Should be rather straightforward.
ca = {' ', ' ', ' '};
legend(ca);
If you can't figure it out, let me know how many items there are in the legend.
  댓글 수: 2
RG
RG 2019년 2월 1일
I'm not trying to pass a defined text to legend, cell array won't work.
This is how my legend looks like:
legend(strcat('One = ',num2str(round(One*100)/100),'one'),strcat('Two = ',num2str(round(TWO*100)/100),'two'),strcat('Three = ',num2str(round(three*100)/100),'three'))
Image Analyst
Image Analyst 2019년 2월 1일
Oh, sorry - that will get rid of the text and keep the colors. You want the opposite - keep the text and get rid of the colors. So for that you use the text() function. it gives you complete control.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Legend에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by