Filter löschen
Filter löschen

How to incorporate axesm-based maps in an app

4 Ansichten (letzte 30 Tage)
Kurt
Kurt am 22 Dez. 2023
Kommentiert: Kurt am 3 Jan. 2024
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:

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 22 Dez. 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');
  1 Kommentar
Kurt
Kurt am 3 Jan. 2024
This is great! Encapsulating the axesm() with an axes makes it dual-purpose, and I can do UIAxes-type functions on it. Thanks.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Develop uifigure-Based Apps finden Sie in Help Center und File Exchange

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by