When map is plotted in appDesigner, it is greyed out and not interactive, but did not behave this way initially.

8 views (last 30 days)
I am plotting lines across a map in appdesigner by creating a geoaxes object inside a panel (so it can be cleared). When I first used it, the map was interactive, scrollable, etc. with data plotted, so the plotting itself is not the issue. In fact, it was originally an animatedline and still worked... once this problem popped up I simplified it massively just to see if I can un-grey the map. A small snip of the code is included:
delete(allchild(app.MapPlotFourPanel)) % clears panel of previous plot each time the button callback is called
app.StatusLabel.Text = 'Status: Plotting...';
drawnow() % update to show StatusReadyLabel update (does not affect map, I've tested that plenty)
ax = geoaxes(app.MapPlotFourPanel); % create geoaxes as child of panel
geobasemap(ax,'topographic')
% hold(ax,'on')
% for ii = 1:2:num_elevs
% plot(ax,data(ii).lat, data(ii).lon,'r')
% end
Regardless of whether or not I actually plot something on the map, it now shows up grey and unscrollable, unclickable, undraggable. The change was sudden and unexplained...
The only differnce I can think of is that I originally had a UIAxes in place of the panel. I'm not inclined to believe that's the issue though because I have four other tabs with their own panels and children geoaxes/plots/geoglobe objects that are interactive, and I also tested it back to plotting in a UIAxes before and had the same issue.
Any ideas?

Answers (1)

VBBV
VBBV on 1 Jul 2023
Edited: VBBV on 1 Jul 2023
h = get(gca,"Children")
delete(h)

Try using gca instead of app.MapPlotFourPanel

  3 Comments
VBBV
VBBV on 3 Jul 2023
There are four tabs in my app doing, at the base level, the same thing. I'm clearing that tab's panel in the first line or so of a ButtonPushedCallback
As you mention, clearing that tab's panel, in the first line , which means all the plots and axes of those four tabs in that panel would be deleted. As a result, only the last known plot in the active tab would be shown as output.
So for example, I have a 3D globe plot in my first tab. If I plotted on my globe tab before this, then the globe is cleared rather than this tab's axes.
what is globe tab ? and do you mean this as first tab ? something that is not so clear for me.
can you share the app code ?
Caroline
Caroline on 3 Jul 2023
Thank you for the question. Unfortunately, I cannot share the app code. To clarify, I have the following simplified layout w/ most user edit fields removed.
In each tab, there are user inputs, a button, and a panel (red arrow), all w/ different identifiers/handles. Each button has its own ButtonPushed callback as follows:
% Button pushed function: RefreshMapFourButton
function RefreshMapFourButtonPushed(app, event)
delete(allchild(app.MapPlotFourPanel))
% take all user inputs and format before passing to external function
[lats, lons, weights] = examplefunction(input1, input2, etc); % get data from function
gx = geoaxes(app.MapPlotFourPanel);
geobasemap(gx,'topographic')
geodensityplot(gx,lats,lons,weights)
end
so that each time a button is pushed, the panel only from that tab is cleared, and then some axes object is created within. So if I want to plot in my third tab and then my second tab, the plot in the third tab stays in place while the plot in the second tab is generated. If I want to plot in the same tab twice though, the existing plot there will delete so there isn't a duplicate. That is all.
The globe tab is just referring to the fact that the plot generated in my first tab is a geoglobe, wasn't really relevant:
erf = geoglobe(app.TESTPanel);
% erf.Terrain = "none";
hold(erf,'on')
% plot on globe using geoplot3
geoplot3(erf, struct.lat, struct.lon, struct.height, 'b') % example struct name
hold(erf,'off')

Sign in to comment.

Categories

Find more on Develop Apps Using App Designer 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!