Putting Annotation in 3D Space - seems impossible
109 views (last 30 days)
Oliver Ng Kwong Sang on 2 Dec 2020
Problem: I am trying to put an annotation (An arrow and a text) in a figure that is 3D. But it has been a big struggle so far after trying for 2 days. First the problem with annotation is you have to use normalised units to position the annotation. I found a way around this and was able to use true x and y coordinate values instead to position the annotation.
But now I am trying to put the annotation in 3D space. I can easily put an annotation in 2D space but in 3D space, there is a problem: I cannot add the z-coordinate for it. The Syntax for annotation is like this: a = annotation('textarrow',x,y,'String','Write text here'); where x and y are the normalised unit for the figure. When I try to add z into it, MATLAB gives an error which states the vector ([x y z]) is too big.
Could someone please tell me how to solve this? Or is there another function instead to use in 3D space?
(Note: I tried using text function in 3D space and it works but I would like to use annotation because I can then put an arrow and a text.)
Thank you MATLAB community!
Divija Aleti on 8 Dec 2020
The annotation function with the same syntax - 'a= annotation('textarrow',x,y,'String','Write text here');' can be used for 3D space too. It shows the annotation on the figure, but the z-position cannot be specified.
However, in order to put an arrow in a particular position in 3D space, that is, specify x,y and z positions, you can use the 'arrow' function. This can be downloaded from the link below:
After putting the arrow, you can use the 'text' function to display your text: