Coastlines not showing or incomplete with geoshow
Show older comments
I am plotting geopotential height data with geoshow and would like to have coastlines superimposed on my data. In the code below, data is a 41x25 matrix. The shape of the matrix is always the same, but the values change with different levels of geopotential height. For my first level, the code below works as desired (first attached image). However, when I change the levels, the coast lines appear incomplete (second image) or not at all (third image). I do not change the code that produces the image, only the values in data change, as reflected by the scale on the colourbar. Any suggestions about where the problem is here would be greatly appreciated.
fig1= figure ('name', 'test');
worldmap(latMap, lonMap)
geoshow(latgrid, longrid, data, 'DisplayType','surface')
coast = load('coast.mat');
geoshow(coast.lat, coast.long)
c = colorbar;
1 Comment
Chin Hsien Cheng
on 15 Jul 2022
I have the same problem using geoshow... appreciate if someone can answer
geoshow(coastlat,coastlon, 'Color', 'black')
Answers (1)
Chin Hsien Cheng
on 15 Jul 2022
1 vote
Okay, I have figured out a solution:
In brief, if the Displaytype of data (double) is plotted in "texturemap" rather than "surface", the "disappearing problem" can then be resolved.
For my case:
load coastlines
figure
axesm('eqacylin', 'maplonlimit', [0 360], 'frame', 'on');
geoshow(Lat180', Lon360', DATA(:,:,1)','DisplayType','texturemap'); %this is ok
geoshow(coastlat,coastlon, 'Color', 'black')
geoshow(Lat180', Lon360', DATA(:,:,1)','DisplayType','surface'); %this will partially cover the coastlines
Categories
Find more on Create Plots on Maps in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!