![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 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Yurii Iotov
el 14 de Ag. de 2019
Comentada: Yurii Iotov
el 14 de Ag. de 2019
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 comentarios
Respuesta aceptada
Neuropragmatist
el 14 de Ag. de 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](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.
Más respuestas (0)
Ver también
Categorías
Más información sobre Legend en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!