MATLAB Answers

How to change several text parts in legend to be bold and colored and unchange others?

225 ビュー (過去 30 日間)
Yurii Iotov
Yurii Iotov 2019 年 8 月 14 日
コメント済み: Yurii Iotov 2019 年 8 月 14 日
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
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
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.

  1 件のコメント

Yurii Iotov
Yurii Iotov 2019 年 8 月 14 日
Thanks a lot!
Now I understand how to use it

サインインしてコメントする。

その他の回答 (0 件)

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by