- Plot Temperature Data on a Geographic Map: Use "geoshow" or another geographic plotting function to display your temperature data on a map. This ensures the plot is in a geographic context.
- Overlay Lightning Data: On the same geographic plot, overlay your lightning data using "geodensityplot".
How to combine pcolor map to geodensityplot map?
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I wanted to combine the lightning data and temperature data into one map, I was trying to combine the pcolor map and geodensityplot map. However, it showed that :
Error using geodensity plot, adding Geographics to Axes is not supported.
Then I looked through other solutions in the Community and it seemed not applicable for my case. May I know what can I do? Thank you very much.
My code was:
ncdisp("temp.nc")
lat=ncread("temp.nc","lat")
lon=ncread("temp.nc","lon")
temp=ncread("temp.nc","dpt")
temp1=temp(:,:,145)
map=pcolor(lon,lat,temp1)
map.EdgeAlpha=0
colorbar
caxis([223 323])
load Lightning_WWLLN_201701
mix=[lightning.lat lightning.lon]
mix(lightning.lat<18 | lightning.lat>45 | lightning.lon<90 | lightning.lon>130,:)=[]
hold on
geodensityplot(mix(:,1),mix(:,2),'FaceColor','interp')
colorbar
0 comentarios
Respuestas (1)
Abhinaya Kennedy
el 4 de Abr. de 2024
Hey,
To combine lightning data and temperature data into one map and avoid the error you're encountering, you should use a geographic plotting function for both datasets instead of mixing Cartesian plotting "pcolor" with geographic plotting "geodensityplot". Here's a simplified approach:
Here's a short example:
% Load temperature data
lat = ncread("temp.nc", "lat");
lon = ncread("temp.nc", "lon");
temp = ncread("temp.nc", "dpt");
temp1 = temp(:,:,145);
% Create a geographic map for temperature data
figure;
worldmap('World');
geoshow(lat, lon, temp1, 'DisplayType', 'texturemap');
caxis([223 323]); % Adjust temperature range
colorbar;
% Load and overlay lightning data
load Lightning_WWLLN_201701; % Assuming this loads lightning data
mix = [lightning.lat, lightning.lon];
geodensityplot(mix(:,1), mix(:,2), 'FaceColor', 'interp');
colorbar;
This approach keeps everything within a geographic plotting context, avoiding the error you encountered.
0 comentarios
Ver también
Categorías
Más información sobre Geographic 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!