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

84 views (last 30 days)
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

Accepted Answer

Neuropragmatist
Neuropragmatist on 14 Aug 2019
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.

More Answers (0)

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!