How can I plot land over a scatter plot? and how can I change the axis tickmark location?

1 回表示 (過去 30 日間)
Problem 1:
I have a scatter plot (shown in attached picture), but I want to plot land over this and extend the space to -90:90 in the latitude.
Problem 2:
The scattered data has to be flipped by 90 degrees and the latitude reversed. I can do this, but I then get the tickmarks on the right of the plot and would like it back on the left.
End result:
I would like a map showing scattered data with land coloured in black and areas where no data in white (i.e. the blobs within the ocean and above 66 degrees north and south. I guess I can just extend the lat by the tickmark locations but then I need to plot land here aswell (e.g. Antarctica)
here is my code so far (after loading in data):
% REF_lat & REF_lon = (3127 x 254)
% mask & sl = (3127 x 254)
% interpolate land mask into same dimensions as scattered data:
F=griddedInterpolant({latt,lonn'},mask);
m=F(y,x);
m(find(m<1 & m>0)) = 1;
m(find(isnan(m)))=0;
sl = s.*m;
h = scatter(REF_lat(:),REF_lon(:),10,sl(:));
[r,c] = find(isnan(h)) ;
hold on ;
plot(c, r, 'ko') ;
set(gca,'YDir','reverse');
camroll(90)

採用された回答

Chad Greene
Chad Greene 2014 年 9 月 24 日
Problem 1: If you have the mapping toolbox, this will be much easier. This describes a similar task of plotting sea level rise with or without the Mapping Toolbox. If you do not have the Mapping Toolbox, m_map is a free alternative.
Problem 1b: Are you sure you want to extend your map all the way to +/- 90 degrees latitude? There's an awful lot of distortion at the poles in unprojected data like this, and it's far beyond the oribital limit of the satellite (the source of your data) anyway, so why not set the axes to, say, +/- 70 degrees with ylim([-70 70]). Or if you prefer 90 degrees, replace those 70s with 90s.
Problem 2: Remember that lat is equivalent to the y axis and lon is equivalent to the x axis. So replace your scatter line with:
h = scatter(REF_lon(:),REF_lat(:),10,sl(:));
and delete the set and camroll lines at the end.
  2 件のコメント
Michael
Michael 2014 年 9 月 25 日
thanks for the help! problem 1b and 2 are fine, but I am still having trouble with problem 1....it doesn't seem to work with scatter..
Chad Greene
Chad Greene 2014 年 9 月 25 日
編集済み: Chad Greene 2014 年 9 月 25 日
What exactly is the problem with scatter?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeScatter Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by