![untitled.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/233845/untitled.png)
How to change several text parts in legend to be bold and colored and unchange others?
조회 수: 109 (최근 30일)
이전 댓글 표시
Hi
I need to highlight some pats of my legend, I wanted to set color and bold type to some text parts of my legend, but what I have found dont work in Matlab 2019, for example Bold symbol in Matlab legend or How do I change just one text in a legend without also changing the properties of the other text in the legened in MATLAB 7.8 (R2009a)?
Simple \bf with differents types of Interpreter does not work as well.
So is there a way to do it? Could you please help me
Thanks, looking forward to yours reply
댓글 수: 0
채택된 답변
Neuropragmatist
2019년 8월 14일
What is wrong specifically with using the tex interpreter?:
figure
plot(rand(10,1),rand(10,1),'ko',rand(10,1),rand(10,1),'ro',rand(10,1),rand(10,1),'bo','MarkerSize',10);
hold on
daspect([1 1 1])
ax = gca;
l = legend('\color{black}\bf legend entry 1','\color{red} legend entry 2','\color{red} legend {\bfentry\rm} \color{blue}foo','Location','EastOutside');
legend boxoff
![untitled.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/233845/untitled.png)
Here I have a legend entry with bold black text, red normal text and red text with only one word in bold that then changes to blue at the end.
That seems to cover every combination you could possibly want.
Hope this helps,
M.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Legend에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!