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 comentarios

Umar
Umar el 24 de Jul. de 2024
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 el 25 de Jul. de 2024
Editada: Walter Roberson el 25 de Jul. de 2024
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.
Muskula
Muskula el 27 de Jul. de 2024
Thank you Umar, for the reply.
The issue is solved the problem was with the projection of the data set
Umar
Umar el 27 de Jul. de 2024
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 el 27 de Jul. de 2024
Editada: Muskula el 27 de Jul. de 2024
Thank you Umar!
Yeah the answer you gave indeed worked !

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Productos

Preguntada:

el 24 de Jul. de 2024

Editada:

el 27 de Jul. de 2024

Community Treasure Hunt

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

Start Hunting!

Translated by