lenend keep only text
21 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nikolas Spiliopoulos
el 5 de Nov. de 2020
Comentada: Nikolas Spiliopoulos
el 5 de Nov. de 2020
Hi all,
I want to put 3 text phrases in a legend wuth red, green, and blue colour respectively (example: 'one' (red), 'two' (green),'three' (blue))
I have seen a similar question here:
I tried to create the first phrase with red using the following commnads:
dummyh = line(nan, nan, 'Linestyle', 'none', 'Marker', 'none', 'Color', 'none');
legend(dummyh,'\color{red}one')
However I cannot add the next 2
could you help me with that?
thanks
0 comentarios
Respuesta aceptada
VBBV
el 5 de Nov. de 2020
Editada: VBBV
el 5 de Nov. de 2020
dummyh = line(nan, nan, 'Linestyle', 'none', 'Marker', 'none', 'Color', 'none');
dummyv = line(nan, nan, 'Linestyle', 'none', 'Marker', 'none', 'Color', 'none');
dummyz = line(nan, nan, 'Linestyle', 'none', 'Marker', 'none', 'Color', 'none');
legend([dummyh dummyv dummyz],{'\color{red}one','\color{green}two','\color{blue}three'})
Más respuestas (1)
Sylvain
el 5 de Nov. de 2020
dummyh_1= line(nan, nan, 'Linestyle', 'none', 'Marker', 'none', 'Color', 'none');hold on
dummyh_2= line(nan, nan, 'Linestyle', 'none', 'Marker', 'none', 'Color', 'none');
dummyh_3= line(nan, nan, 'Linestyle', 'none', 'Marker', 'none', 'Color', 'none');
legend([dummyh_1,dummyh_2,dummyh_3], ...
{'One legend entry to rule them all!', 'Yes that s it!','Does it answer your Question?'})
1 comentario
Sylvain
el 5 de Nov. de 2020
Thanks to the answer from @Vasishta, here is an updated verision:
dummyh_1= line(nan, nan, 'Linestyle', 'none', 'Marker', 'none', 'Color', 'none');hold on
dummyh_2= line(nan, nan, 'Linestyle', 'none', 'Marker', 'none', 'Color', 'none');
dummyh_3= line(nan, nan, 'Linestyle', 'none', 'Marker', 'none', 'Color', 'none');
legend([dummyh_1,dummyh_2,dummyh_3], ...
{'\color{red}One legend entry to rule them all!', ...
'\color{green}Yes that s it!',...
'\color{blue}Does it answer your Question?'})
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!