How can I plot land over a scatter plot? and how can I change the axis tickmark location?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Michael
el 23 de Sept. de 2014
Editada: Chad Greene
el 25 de Sept. de 2014
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)
Respuesta aceptada
Chad Greene
el 24 de Sept. de 2014
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 comentarios
Chad Greene
el 25 de Sept. de 2014
Editada: Chad Greene
el 25 de Sept. de 2014
What exactly is the problem with scatter?
Más respuestas (0)
Ver también
Categorías
Más información sobre Scatter Plots en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!