How to combine geoaxes and contourf plot?
Show older comments
I would like to combine geoaxes with satellite view and a contourf plot. For example:
geoaxes(); geolimits([20, 30], [-90, -80]); geobasemap('satellite')
And now, given longitude, latitude and sea surface temperature, plot the sea surface temperature as a contour plot. For instance:
contourf(lon, lat, SST)
But this throws this error:
Error using newplot (line 81)
Adding Cartesian plot to geoaxes is not supported.
Error in contourf (line 75)
cax = newplot(cax);
Trying the corresponding function from the Mapping Toolbox:
contourfm(lon, lat, SST)
Error using hggroup
Group cannot be a child of GeographicAxes.
Error in internal.mapgraph.HGGroupAdapter (line 62)
g = hggroup('Parent',ax);
Error in internal.mapgraph.ContourGroup (line 282)
h = h@internal.mapgraph.HGGroupAdapter(args{:});
Error in internal.mapgraph.GeographicContourGroup (line 55)
h = h@internal.mapgraph.ContourGroup(varargin{:});
Error in contourm (line 111)
h = internal.mapgraph.GeographicContourGroup(ax, Z, R, levelList);
Error in contourfm (line 39)
contourm(varargin{:},'Fill','on','DefaultLineColor','black');
I am wondering if it is possible to combine the satellite land view offered by geoaxes together with a contour plot of a 2D geographical array. Or perhaps is it possible to get a satellite land view with the Mapping Toolbox and then use contourfm?
Thanks in advance
Accepted Answer
More Answers (1)
Shai Katz
on 18 Jul 2022
I looked at your suggestion and I have a similar qestion with the error:
Adding Cartesian plot to geoaxes is not supported.
I would like to plot wind vectors on geobasemap:
S= wind_speed;
D = 270 - wind_direction;
u = S.*cosd(D);
v = S.*sind(D);
figure(1)
quiver(lat, lon, u, v);
axis equal
grid on
hold on;
gx = geoaxes;
geobasemap(gx,'topographic');
I want in this way because geobasemape has maps with better visualtion of the surfac such as topography, soil, etc.
Do you have any idea how to make it?
Thanks,
Shai
1 Comment
I've come across this problem in the past and just used map axes. That's probably not the answer you're looking for 🙁 .
Categories
Find more on Vector Fields in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

