How to display an imagesc plot and mapshow plot with same geographic direction?

5 vues (au cours des 30 derniers jours)
Priyank Pathak
Priyank Pathak le 14 Sep 2022
Commenté : Priyank Pathak le 22 Sep 2022
countary boundary
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 commentaires
DGM
DGM le 22 Sep 2022
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).

Connectez-vous pour commenter.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by