Display error of worldmap and geoshow?

조회 수: 3 (최근 30일)
Liu Lilingjun
Liu Lilingjun 2020년 12월 7일
댓글: Liu Lilingjun 2021년 2월 2일
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?

채택된 답변

Tammy Viggato
Tammy Viggato 2021년 1월 29일
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
Liu Lilingjun
Liu Lilingjun 2021년 2월 2일
Thank you Tammy! Your code works perfectly. I finally got what I want.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by