How to display an imagesc plot and mapshow plot with same geographic direction?
조회 수: 19 (최근 30일)
이전 댓글 표시
![countary boundary](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1124665/countary%20boundary.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1124670/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1124675/image.png)
Here, I have attached three images ,countary border shape lines(top), data plot(middle) and both mereged (bottom). I am facing problem that countary border shape lines gets inverted when it is plotted with my data_plot(imagesc).
I here attached my code which i am using.
sed_thick2=xlsread('data87972030.xlsx'); %data
sed_thick3=sed_thick2(:,5);
sed_thick4=reshape(sed_thick3,301,301);
sed_thick=sed_thick4';
csia21=sed_thick;
m_data1= reshape(csia21',90601,1);
X= [87 97];
Y=[20 30];
im= imagesc(X,Y,csia21,'Interpolation', 'bilinear');
im.AlphaData = 1;
hold on
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x5=87:0.033333333:97;
y5=20:0.033333333:30;
minx = round(min(csia21(:)),1);
maxx = round(max(csia21(:)),1);
levels = minx:5:maxx;
levels2=round(levels);
[X5,Y5] = meshgrid(x5,y5);
[C,h]=contour(X5,Y5,csia21,'linewidth',0.01,'LineColor',[0,0,0]+0.4);
clabel(C,h,'FontSize',6);
hold on
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
S = shaperead('IND_adm1.shp');
xLim = [87,97];
yLim = [20,30];
mapshow(S,'FaceColor', 'none','LineWidth',0.5);
set(gca,'XLim', xLim, 'YLim',yLim);
xlabel('longitude(deg.)')
ylabel('latitude(deg.)')
xtickformat('%g\x00B0 E')
ytickformat('%g\x00B0 N')
xticks(87:2:97)
yticks(20:2:30)
hax = gca;
hax.YTickLabel = flipud(hax.YTickLabel);
hold off
colormap jet
grid on
Anyone please suggest me how to get both data plot and boundary line in same direction.
댓글 수: 2
DGM
2022년 9월 22일
I'm not super familiar with the mapping tools (or with shaperead() for that matter), so trying to intuit this without the corresponding files is a bit beyond me. That said, I see what you're talking about. Image display tools (image, imagesc, imshow) will set the 'YDir' property of the parent axes to 'reverse'. By convention, the origin for images is the NW corner, whereas for other plotting tools, it's the SW corner. You may be able to resolve this through some combination of pre-flipping raster images/data or manipulating the 'YDir' property of the axes.
Forgive me if that's not really a great answer (that's why I'm posting as a comment). I'd prefer to have a concrete example to prove. If it's not too late for your needs, I could perhaps come up with something proven if you can provide the source data (or something equivalent if the specific sources can't be shared).
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!