Clear Filters
Clear Filters

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

7 views (last 30 days)
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
m_data1= reshape(csia21',90601,1);
X= [87 97];
Y=[20 30];
im= imagesc(X,Y,csia21,'Interpolation', 'bilinear');
im.AlphaData = 1;
hold on
minx = round(min(csia21(:)),1);
maxx = round(max(csia21(:)),1);
levels = minx:5:maxx;
[X5,Y5] = meshgrid(x5,y5);
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);
xtickformat('%g\x00B0 E')
ytickformat('%g\x00B0 N')
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.
DGM on 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).

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!