How to display data on plot without overlapping displayed data.

I've been trying to display the data that my plot is displaying, but my problem is certain data is overlapping the other one.
Is there a way were I can display the numbers without them covering each other?
% Get the data and construct the polynomial interpolant.
n = 11; ind = transpose([1:11]);
x = -4+8*(ind-1)/(n-1);
x2 = 4*cos((pi*(2*ind-1))/(2*n));
y = exp(-x.^2);
c = interpnewt(x,y);
%c2 = interpnewt(x2,y);
plot(x, y, 'rx')
hold on
z = transpose(linspace(-4,4,500));
p = hornernewt(c,x,z);
%p1 = hornernewt(c2,x2,z);
set(gca, 'fontsize', 9)
fp = plot(z,p)
strValues = strtrim(cellstr(num2str([round(x(:),3,'significant') round(y(:),3,'significant')],'(%df3,%df3)')));
text(x,y,strValues,'HorizontalAlignment','center','FontSize',14);
fp(1).LineWidth=3;

 Respuesta aceptada

You could rotate the text to 45 degrees (or any angle) using
text(___, 'rotation',45)

2 comentarios

That is awesome! Thank you!!!
Adam Danz
Adam Danz el 23 de Oct. de 2020
Editada: Adam Danz el 23 de Oct. de 2020
Glad I could help.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Productos

Etiquetas

Preguntada:

el 22 de Oct. de 2020

Editada:

el 23 de Oct. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by