Annotations with arrows for scatter plot
19 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Florian
el 11 de Oct. de 2018
Comentada: Star Strider
el 16 de Oct. de 2018
I have a scatter plot and would like to add labels with arrows for each data point (similar to the example below). I have a cellstring vector called ' labelc' with data labels of the same length as my x and y data vectors. I tried to use the annotation function in matlab to create the labels as follows...
a = annotation('textarrow',x,y,'String',labelc);
...but got an error message:
Error using annotation (line 121) unknown argument
Does anybody know how to achieve this?
0 comentarios
Respuesta aceptada
Star Strider
el 11 de Oct. de 2018
*‘... with data labels of the same length as my x and y data vectors.’
That could be the problem. The documentation does not appear to support array arguments for them. See if putting the annotation calls in a loop, with one value for each ‘x’, ‘y’, and ‘labelc’ in every iteration works:
for k = 1:...
a = annotation('textarrow',x(k),y(k),'String',labelc(k));
end
Make necessary changes to be certain ‘labelc’ is addressed correctly so it displays correctly.
(I am currently running a long optimization, and cannot test this approach just now.)
14 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Annotations en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!