How to overlay a UIAxes surface on a UIFigure 3D image

5 views (last 30 days)
I have two components, a UIFigure globe and a UIAxes hemisphere created with surf(). I want to overlay the surf object on the globe, but they are different type objects. The UIAxes object is a subset of the UIFigure, so they do not appear together. How can I resolve this?
Here is the UIFigure globe:
and here is the UIAxes hemisphere:
The relevant code looks like this:
.
.
.
% Create UIFigure and hide until all components are created
app.UIFigure = uifigure('Visible', 'off');
app.UIFigure.Position = [0 0 1000 650];
% Create Image
img = world_globe(app.UIFigure);
% Create UIAxes
app.UIAxes = uiaxes(app.UIFigure);
app.UIAxes.Position = [0 0 1000 600];
app.UIAxes.XLim = [0 1100];
app.UIAxes.YLim = [0 580];
app.UIAxes.Visible = 'off';
app.UIFigure.Visible = 'on';
% App creation and deletion
methods (Access = public)
% Construct app
function app = globe_frame
% Create UIFigure and components
createComponents(app);
% Register the app with App Designer
registerApp(app, app.UIFigure)
globe = app;
color = [0.8 0.8 0.8]; % grey
obj = draw_hemisphere(globe,90,45,color);
end
%--------------------------------------------------------
function object = draw_hemisphere(globe,azLeft,azRight,color)
global xEarth; % Earth's orbital coordinates
global yEarth;
global zEarth;
global ERad; % Earth radius
dtor = .017453292;
az1r = azLeft * dtor;
az2r = azRight * dtor;
r = 1; % scale factor
theta=[az1r:0.01:az2r]*2*pi;
phi=[0:0.01:pi/4];
[THETA,PHI]=meshgrid(theta,phi);
x=r .* (cos(THETA).*sin(PHI));
y=r .* (sin(THETA).*sin(PHI));
z=r .* cos(PHI);
object = surf(globe.UIAxes, xEarth+x, yEarth+y, zEarth+z, 'FaceAlpha', 0.5, 'FaceColor', color, EdgeColor = 'none');
end
You can't draw this globe using UIAxes, and you can't use surf() on a UIFigure. How do I resolve this?
I have also looked at various other techniques, such as using geoplot. I have the Mapping Toolbox, but not Image Processing, so that is not an option.

Answers (1)

Kurt
Kurt on 12 Dec 2023
It appears you can't get there from here usining geo data. I found another solution using a mesh:

Categories

Find more on Develop uifigure-Based Apps in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!