how to show my output data in map.
Show older comments
sir i want to plot my own output data in map.please help me. how will do this.sir i have 8 years annual time series of rainfall frequency and sir my data size is (20x22x8)(lon,lat,time).
thank you in advance.please sir help me.
1 Comment
José-Luis
on 10 Jun 2014
Accepted Answer
More Answers (3)
David Sanchez
on 10 Jun 2014
you could take a look at the demos within Matlab documentation. You will find many working examples on data representation, like this one:
z=peaks(25);
surf(z);
colormap(jet);

Adapt your data to any of those examples.
5 Comments
devendra
on 10 Jun 2014
David Sanchez
on 10 Jun 2014
You say your data size is (20x22x8)(lon,lat,time), could you give an example row of any year? I guess you have a 20x22 matrix for each year, but I'm guessing what's the 20x22 data
José-Luis
on 10 Jun 2014
There is no way you can get such a high-resolution map with the data you have.
David Sanchez
on 11 Jun 2014
You will have to present your data by year:
XX YY]= meshgrid(X1,Y1);
z=ltm(:,:,1);
surf(XX,YY,z')
xlabel('XX')
ylabel('YY')
view([0 90])

11 Comments
devendra
on 11 Jun 2014
Kelly Kearney
on 11 Jun 2014
I'm guessing the density of your data is too high, hence the outlines of the grid cells are overwhelming the colors. Try adding
shading flat
after whatever you did to plot.
As for reading from a shapefile, do you have the Mapping Toolbox? (Several people asked this when you posted your original question, and you have yet to answer). If so, look at shaperead.
devendra
on 12 Jun 2014
devendra
on 12 Jun 2014
Kelly Kearney
on 12 Jun 2014
What is "map viewer"? Does your license include the Mapping Toolbox? If you type ver, do you see it listed?
Did shading flat help at all?
You're going to have to put some effort in here, or we can't help you.
José-Luis
on 12 Jun 2014
You keep asking for help, but you are not really answering the requests for clarification properly. That makes it difficult for people to help you.
José-Luis
on 12 Jun 2014
Have you tried reading the documentation
doc shaperead
doc plotm
devendra
on 12 Jun 2014
devendra
on 12 Jun 2014
peterhack
on 11 Nov 2016
As I have a question on the above example I will utilize this thread, hope that is alright. I am using the presented code to mask the data points outside the border. Works fine so far. However, I want to use the DisplayType surface. Thus I am using geoshow to plot the data. Unfortunately it does not fill the whole map within the borders as a buffer is left. Any hint?
file = 'TM_WORLD_BORDERS-0.3.shp';
S = shaperead(file, 'usegeocoords', true, 'selector', ...
{@(x) strcmp(x,'India'), 'NAME'});
x = linspace(min(S.Lon), max(S.Lon), 100);
y = linspace(min(S.Lat), max(S.Lat), 100);
[x,y] = meshgrid(x,y);
z = rand(100);
isin = inpolygon(x,y,S.Lon,S.Lat);
z2 = z;
z2(~isin) = NaN;
lnlim = [65 100];
ltlim = [5 40];
lt = linspace(ltlim(1), ltlim(2), 3);
ln = linspace(lnlim(1), lnlim(2), 3);
for ii = 1:2
ltbox{ii} = lt([1 2 2 1 1]'+(ii-1));
lnbox{ii} = ln([1 1 2 2 1]'+(ii-1));
end
[lnmask, ltmask] = deal(cell(2));
for ii = 1:2
for jj = 1:2
[lnmask{ii,jj}, ltmask{ii,jj}] = polybool('-', ...
lnbox{ii}, ltbox{jj}, S.Lon, S.Lat);
end
end
ltboxall = ltlim([1 2 2 1 1]);
lnboxall = lnlim([1 1 2 2 1]);
[lnmaskall, ltmaskall] = polybool('-', lnboxall, ltboxall, S.Lon, S.Lat);
figure('color','w');
worldmap('India');
geoshow(y, x, z2, 'DisplayType','surface')
contourcmap('jet',min(z):1:max(z),'colorbar','on','location','horizontal')
for ii = 1:4
patchm(ltmask{ii}, lnmask{ii}, 'w', 'edgecolor', 'none');
end
plotm(ltmaskall, lnmaskall, 'k');
Categories
Find more on Mapping Toolbox in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

