Why does geodensityplot create a line rather than a full-cover colormap?
Afficher commentaires plus anciens
I am creating a geoaxes plot inside a panel in AppDesigner (not an issue w/ AppDesigner or panel). My code is as follows:
gx = geoaxes(app.MapPlotPanel);
geobasemap(gx,'topographic')
geodensityplot(gx,lats,lons,weights)
where lats, lons, weights are all of size 1xN.
I am creating these arrays as
% (webscrape not included but I can assure you the data's fine)
weights = double(weights); % cast webscraped data as double for correct format
lats = -90:2.5:90;
lons = -180:5:180;
transpose(weights);
transpose(lats);
transpose(lons); % with or without transpose doesn't fix
in an external function and passing back in a ButtonPushedCallback. The weights are in the correct order and everything to be plotted this way. When I plot this, I get the following line:

I have tested many many times to see if my arrays were the right size, same shape, etc.
Within my external function I plotted the data just to see what was up, and it looks like this 3D plot is actually projecting this way on my geodensityplot as well, instead of in a "meshed" way... from the top/2D view, it's just a straight line. It is curved on the map above because MATLAB takes into account the spherical distortion of the line.
plot3(lats,lons,weights)

Why is my densityplot not plotting the density? I mean this to be like a colormap where the whole -90 - 90, -180 - 180 surface is colored based on the value of weights(i) at lat(i) and lon(i). I have tried plotting in other ways instead of geodensityplot, but no matter what plotting function I use, they all end up in a warped line.
Plotting data that DOESNT cover the full surface creates a plot that makes sense... arrays that I'm plotting are the same format (all are 1xn).
w/ the little blobs being where the example data is. The points are also webscraped so I know it's not an issue w/ the data pulls/format.
I do not fully understand the meshgrid function but I believe it may be useful in some way. If anyone could point me in the right direction to project my data correctly I would appreciate it greatly. Thank you!
Using R2023A and Mapping Toolkit (not sure if required but shouldn't be).
Réponses (1)
VBBV
le 4 Juil 2023
0 votes
Use geoplot3 or geoglobe functions if you want 3D plots. They are able to handle the data well than other 2D/3D plot functions.
Check also if the lats lons data are in WGS84 coordinate reference system since geoaxes function uses the same type of coordinate system.
1 commentaire
Caroline
le 4 Juil 2023
Catégories
En savoir plus sur Image Processing Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!