views:

52

answers:

3

I want to plot a "Pointer" in a 3-D plot.

I want this "pointer" to point at a certain spot on a sphere that I have graphed.

This pointer does not have to have an arrowhead but would be nice if it did.

Is the only way to plot a line with a jpg at the end? Not too sure...

Thanks for any help!

ME

+2  A: 

Plain copy from The MathWorks documentation. For further details have a look at this.

% Create a sphere and color it using a topographic colormap:
cla reset;
load topo;
[x y z] = sphere(45);
s = surface(x,y,z,'FaceColor','texturemap','CData',topo);
colormap(topomap1);
% Brighten the colormap for better annotation visibility:
brighten(.6)
% Create and arrange the camera and lighting for better visibility:
campos([2 13 10]);
camlight;
lighting gouraud;
axis off vis3d;
% Set the x- and y-coordinates of the textarrow object:
x = [0.7698 0.5851];
y = [0.3593 0.5492];
% Create the textarrow object: 
txtar =  annotation('textarrow',x,y,'String','We are here.','FontSize',14);
zellus
+1  A: 

And the easy way to add arrows and such like is to use the Plot Tools. You can activate the Plot Tools by clicking on the rightmost icon in the toolbar on the window containing the figure you have drawn. Once you've got the arrow as you want it, you could then generate the m-file from the graphic.

High Performance Mark
+1  A: 

Also make sure to check out the excellent ARROW submission on FEX by Erik Johnson (dates back to 2000 but updated in 2009).

screenshot

Amro

related questions