Figure is not properly overlapped on shape file, little shifted.

조회 수: 2 (최근 30일)
Jitesh Dadich
Jitesh Dadich 2019년 5월 1일
답변: Jitesh Dadich 2019년 5월 2일
When I plot the output and overlay it on shape file, it comes little shifted.
Any suggestion would help me.
  댓글 수: 5
Jitesh Dadich
Jitesh Dadich 2019년 5월 1일
Here it is :
S = shaperead('india_state.shp') ;
n = length(S);
x = zeros(n,1) ;
y =zeros(n,1) ;
a=pcolor(lon,lat,Temp);
%Temp is temperature
title('Tempeature')
xlabel('Longitude')
ylabel('Latitude')
colorbar
shading flat;
hold on
for i = 1:n
x = S(i).X ; y = S(i).Y ;
plot(x,y,'k')
end
Walter Roberson
Walter Roberson 2019년 5월 1일
pcolor() uses surf() underneath it. Each face is derived by interpolating the four corner vertices, so the number of faces shown is one less in x and y direction than the number of matrix entries. This can result in a shift relative to plotting the same coordinates due to differences in interpretation of what the coordinates mean. For pcolor, coordinates are vertices, but the what the user sees as color is faces between the vertices.
If there is no significant curvature in what you are drawing, you could consider using image() or imshow(), which accept XData and YData coordiantes that relate to the lower left and upper right corners. The coordinates are considered to be coordinates of the center of pixels.. but only uniform rectangular grids are possible image() or imshow()
Your code does not show where you are getting lon or lat or Temp from, so it is not clear that they relate to anything you read from S.

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

답변 (1개)

Jitesh Dadich
Jitesh Dadich 2019년 5월 2일
Thanks for your reply dear Walter Roberson.
I have attached a mat file of lat, lon and temp.
please tell me what to do?

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by