Borrar filtros
Borrar filtros

Is there any way to display a value instead of circles for points on a plot?

1 visualización (últimos 30 días)
Is there any way to display a value instead of circles for points on a plot?

Respuesta aceptada

Walter Roberson
Walter Roberson el 18 de Nov. de 2016
a=1:10:100;
b=sin(a);
plot(a,b);
labels = arrayfun(@(A,B) sprintf('%g:%g', A, B), a, b, 'Uniform', 0);
text(a, b, labels)

Más respuestas (1)

Brendan Hamm
Brendan Hamm el 17 de Nov. de 2016
You can use the text function.
x = rand(5,1);
y = rand(5,1);
txt = num2str((1:5)');
text(x,y,txt)
  1 comentario
joys roselin
joys roselin el 18 de Nov. de 2016
Editada: Walter Roberson el 18 de Nov. de 2016
It doesn't work it out...can u tell me whether it suits for this code?
a=1:10:100;
b=sin(a);
plot(a,b);
txt = num2str((a:b)');
text(a,b,txt);

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by