MATLAB: How to avoid geoshow shrinking the axis

geoshowMapping Toolbox

Hi there,
apparently, the function geoshow shrinks the current axes: My plots are smaller when I add the coastline with geoshow than when I do not use geoshow. This is especially annoying, since I want to make 36 subplots on an A4-sheet. The subplots are just very tiny with a lot of space between them. Does anybody know how to avoid the shrinking and can help? Thanks, Iris

Best Answer

If you aren't plotting to a map axis, geoshow resets the data aspect ratio to [1 1 1], which may shrink the axis in one direction or the other. If you want to keep the proper aspect ratio of the plot (which I assume you do, or there's really no point of using geoshow rather than plot, patch, etc), you should probably manually position the subplots to occupy as much space as possible prior to calling geoshow. There are a variety of functions on the FEX to help with this (subtightplot, subaxis, subplotplus, etc). The tightmap function can also help you use as much real estate as possible.
For example:
for ii = 1:4
ax(ii) = subaxis(2,2,ii,'sp',0,'mar',0); % FEX #3696
end
C = load('coast');
geoshow(ax(1), C); % Geoshow, no map axis
plot(ax(2), C.long, C.lat); % No projection
axes(ax(3)); axesm('mercator'); geoshow(C); tightmap;
axes(ax(4)); axesm('robinson', 'frame','on'); geoshow(C); tightmap;