Display error of worldmap and geoshow?

10 views (last 30 days)
When I try to visualize a rainfall gridded data of a certain area, of which latlim and lonlim is known, I referred to the official suppor at the link. In the official site, the figure is plotted with worldmap and geoshow function. However, I find that the coastlines will be covered by the data surface in yellow area.
Here is the demo figure. Pay attention to the left corner, some coastline of the east Australia is blocked. Meanwhile, the position of the longitute label is also wired. Is there any ways to visualize such a figure correctly?

Accepted Answer

Tammy Viggato
Tammy Viggato on 29 Jan 2021
I understand that you have two problems that you are trying to find a solution for.
1) Part of the coastlines plot is being covered by the surface map
2) You do not like the positioning of the longitude label.
Lets stat with part 1. Within MATLAB, a line plot could disapeer under a surface plot when the plotted surface is higher than the height the line is plotted at (see https://www.mathworks.com/matlabcentral/answers/97362-how-can-i-place-a-linear-plot-on-top-of-a-surface-plot). This seems to be the problem in this situation. There are two options to fix this - either raise the height of the line or lower the surface. In this case it is prefered to raise the line so as to preserve the surface color mapping.
Re-writing the example would look like this:
[N,R] = egm96geoid;
load coastlines
latlim = [-50 50];
lonlim = [160 -30];
worldmap(latlim,lonlim)
% The example uses 'surface', but I am changing to mesh to accentuate the problem
geoshow(N,R,'DisplayType','mesh')
h = geoshow(coastlat,coastlon,'Color','k')
% Add ZData so coastlat and coastlon are plotted to a higher elevation
h.ZData(1:size(h.XData,2)) = 100;
For your second problem, the longitude label positions are being controlled by worldmap. The easiest solution may be to use mlabel (https://www.mathworks.com/help/map/ref/mlabel.html) or plabel as appropriate to turn off the labels. Alternatively, you could use axesm with latitude / longitude limits set if you know an appropriate projection for your data region, which will not create the labels as such by default.
  1 Comment
Liu Lilingjun
Liu Lilingjun on 2 Feb 2021
Thank you Tammy! Your code works perfectly. I finally got what I want.

Sign in to comment.

More Answers (0)

Categories

Find more on Geographic Plots in Help Center and File Exchange

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!