creating legend with only string

22 visualizaciones (últimos 30 días)
sermet
sermet el 11 de Ag. de 2016
Comentada: Lina KORONFEL el 14 de Jul. de 2020
x=rand(10,1);
h_x=histfit(x);
title('error');
xlabel('north (cm)')
ylabel('Number of Measurement')
mean_x=mean(x);
h_x = legend([':mean (cm)=' num2str(mean_x)], 'Location','NorthEast');
How can I delete the blue box left near to "mean (cm)=" string in figure to display only string?

Respuesta aceptada

Pham Dang
Pham Dang el 11 de Ag. de 2016
Hi, you should consider using the annotation command. Add these commands after yours :
annotation('textbox',get(h_x,'Position'),'String',['mean (cm)=' num2str(mean_x)])
legend('toggle')
The first command places the text box at the same position of the legend ; the second hides the legend.
  2 comentarios
RG
RG el 1 de Feb. de 2019
Is there a way jus to remove the legend labels but keep the legend text? (remove legend colored lines and other labels).
The annotation box creates a string, while in the legend I wand it to be number of rows. Also the font in annotation is huge compared to the whole figure.
Thanks.
Lina KORONFEL
Lina KORONFEL el 14 de Jul. de 2020
Is this question answered?

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by