How to incorporate axesm-based maps in an app
2 views (last 30 days)
Show older comments
I am interested in creating axesm-based maps:
h = axesm('MapProjection','mercator')
However, there appears to be no way to tie the axesm object back to a parent app container:
h = axesm(app,'MapProjection','mercator') % doesn't work
I need to reference the various app components, for example:
app.panel.earth = axesm(app.panel,"Geoid",grs80, "Grid", "on"); % or something
There are lots of examples of how to use the other axes(), but not so much for axesm.
I intend to create, move and destroy lines in the app. I know how to do this in a UIAxes component, storing the line segments in Children. But axesm still throws me. I started with this example, but now I need to fold it into a GUI app:
0 Comments
Accepted Answer
Walter Roberson
on 22 Dec 2023
There is no straight-forward way of doing this. axesm() does not have anything similar to a 'Parent' property. axesm() is written in terms of gca
To use axesm with a uifigure() you need to work around the fact that uifigure HandleVisibility is Off
fig = ancestor(app.panel, 'figure');
fig.HandleVisibility = 'on';
Then you have to have an axes within the panel, and make it the current axes
ax = findobj(app.panel, 'type', 'axes');
if isempty(ax)
ax = axes(app.panel);
end
fig.CurrentAxes = ax(1);
Then you can axesm
h = axesm('MapProjection','mercator');
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!