How to fit axes to contourm plot?

조회 수: 5 (최근 30일)
George Koh
George Koh 2017년 1월 8일
답변: Nithin Sivadas 2018년 9월 30일
Hello, I'm trying to create a map of mean wind speed in the region of Greece. My lat and lon are coming from the variables XLAT and XLONG respectively and the variable WS_mean contains the data I want to map. My code is:
axesm ('MapProjection', 'lambert', 'MapLatLimit', [min(min(double(XLAT))) max(max(double(XLAT)))],'MapLonLimit', [min(min(double(XLONG))) max(max(double(XLONG)))],'Frame','on','Grid','on', 'MeridianLabel', 'on', 'ParallelLabel', 'on');
contourm(double(XLAT),double(XLONG),double(WS_mean),'Linestyle','none','Fill','on');
geoshow ('landareas.shp','FaceColor','white', 'FaceAlpha',0,'Linewidth',2)
colormap(jet(125));
I'm attaching the resulting figure. As you can see the axes are not properly aligned with the result of the contourm. I've tried all of the MapProjections and none is fitting my needs. How do I fit the axes to the contourm plot? Or is something wrong with the way i'm depicting the data with the contourm command??
Thanks in advance

채택된 답변

George Koh
George Koh 2017년 1월 15일
편집: George Koh 2017년 1월 15일
I solved it by using the properties of axesm, Origin,FLatLimit, FLonLimit instead of MapLatLimit and MapLonLimit
  댓글 수: 1
Walter Roberson
Walter Roberson 2017년 6월 7일
Muhammad Usman Saleem comments to George Koh:
Need more explaination for this answer

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

추가 답변 (2개)

Muhammad Usman Saleem
Muhammad Usman Saleem 2017년 1월 8일
[min(min(double(XLAT))) max(max(double(XLAT)))]
fix this in this manner
[(min(double(XLAT)) max(double(XLAT))]
let me know after check?
  댓글 수: 1
George Koh
George Koh 2017년 1월 8일
Thanks for answering. Tried that and did not work. My XLAT and XLONG are 228x174 and doing what you suggested returns an ans 1x174. The MapLatLimit requires two numbers as inputs in its brackets.

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


Nithin Sivadas
Nithin Sivadas 2018년 9월 30일

There is another way to fix this. Turns out that when one uses contourm(), sometimes the Cartesian axes limits change. I am assuming this is a bug. I found a solution to be to store the Cartesian limits before the contourm() and replace the buggy limits with it, after executing the function like this:

ax = gca;
xlim = ax.XLim;
ylim = ax.YLim;
contourm(double(XLAT),double(XLONG),double(WS_mean),'Linestyle','none','Fill','on');
ax.XLim = xlim;
ax.YLim = ylim;

카테고리

Help CenterFile Exchange에서 Geographic Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by