How can I display the azimuth and elevation information on a figure in MATLAB?

32 visualizaciones (últimos 30 días)
When I use the the Rotate 3D tool at the top of a figure, I can see the azimuth (Az) and elevation (El) information at the bottom of the Figure. However, as soon as I release the mouse button, the information is no longer displayed. How can it be placed on the plot itself?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 14 de Oct. de 2022
Editada: MathWorks Support Team el 14 de Oct. de 2022
The ability to show the azimuth (Az) and the elevation (El) on a figure after the mouse button has been released when using the Rotate 3D tool is not available in MATLAB.
To work around this issue, you can return the elevation (El) and the azimuth(Az) information using the 'view' function and then display the values as text in the figure.
Here is an example of a text box which displays this information:
figure; % create a figure
membrane % plot the membrane
tBox = annotation('textbox', [0, 0.05, 0.1, 0.1], 'LineStyle', 'none'); % create your text box and place it in about the same place as is automatically displayed
rotateObj = rotate3d(gcf);
rotateObj.ActionPreCallback = @(~,~)(set(tBox, 'String', []));% don't want our text box when the automatic one is around
rotateObj.ActionPostCallback = @(~, event_obj)(set(tBox, 'String', ['Az: ', num2str(event_obj.Axes.View(1)), ' El: ',num2str(event_obj.Axes.View(2))])); % populate when done rotating
rotate3d on
Here are the relevant documentations for your reference:

Más respuestas (0)

Categorías

Más información sobre Graphics Object Programming en Help Center y File Exchange.

Etiquetas

Productos


Versión

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by