Shapefile not overlapping perfectly over pcolor plot

I am trying to plot a pcolor plot for Sea surface temperature data set and to represent the coastaline in the plot i have downloadwed global coastline shapefile and when i am using geoshow to read and overlay on the pcolor plot it is not matching perfectly

댓글 수: 6

Hi Muskula,
Since you have not shared data and code, the only conclusion I can draw is alignment issues which can occur due to differences in coordinate systems or projections. Ensure that both the coastline shapefile and the pcolor plot are using the same coordinate system. You may need to reproject one of the datasets to match the other.
Hi Umar,
Thank you for the reply,
The size of the data is too large to data, I am sharing a part of the code for your reference.
[Y, X] = meshgrid(linspace(-179.750, 179.750, 720), linspace(89.750,-89.750, 360));
h1 = pcolor(Y,X,Data);
hold on
geoshow("ne_50m_coastline.shp",Color=[0 0 0]);
here Data=squeeze(SST_Var_EEMD_trend_reshaped(:,:,40)); %where SST_Var_EEMD_trend_reshaped is of size 360,720,42 (42 here is no of years)
I have used squeeze function to extract the data for 1 year at all lat and lon values
Umar
Umar 2024년 7월 25일
편집: Walter Roberson 2024년 7월 25일
Hi Muskula,
Here is an updated version of the code snippet provided by you with some modifications for better alignment:
[Y, X] = meshgrid(linspace(-179.750, 179.750, 720), linspace(89.750, -89.750, 360));
h1 = pcolor(Y, X, Data);
hold on
coastline = shaperead("ne_50m_coastline.shp");
geoshow(coastline, 'DisplayType', 'line', 'EdgeColor', [0 0 0]);
In this updated code snippet, you can read the coastline shapefile using shaperead to obtain the coastline data, use geoshow with 'DisplayType', 'line' to overlay the coastline as a line on the pcolor plot, Adjusting the properties of the coastline display as needed for better alignment. By following these steps and ensuring proper coordinate system alignment and scaling, you should be able to overlay the coastline accurately on the pcolor plot. Please let me know if this helps resolve your issue.
Thank you Umar, for the reply.
The issue is solved the problem was with the projection of the data set
Hi Muskula,
Like I said in my earlier comments, “ Since you have not shared data and code, the only conclusion I can draw is alignment issues which can occur due to differences in coordinate systems or projections”. Glad to know your problem is resolved. So, this answers your question.
Muskula
Muskula 2024년 7월 27일
편집: Muskula 2024년 7월 27일
Thank you Umar!
Yeah the answer you gave indeed worked !

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 Mapping Toolbox에 대해 자세히 알아보기

질문:

2024년 7월 24일

편집:

2024년 7월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by