Borrar filtros
Borrar filtros

How to create overlaping heatmap in geoplot

8 visualizaciones (últimos 30 días)
Jonathan
Jonathan el 4 de Abr. de 2024
Comentada: Jonathan el 4 de Abr. de 2024
Hello!
So I have a matlab code that plots geo lat and lon points and using geodensityplot, each point have a raduis of 7 meter. My question is, how can I makes the plotted density discrete, and when there circle are overlaping, the overlapping part has a different color? Btw, I dont have the mapping toolbox.

Respuesta aceptada

Yash
Yash el 4 de Abr. de 2024
To achieve a discrete density plot with overlapping circles of different colors, you can use the scatter function in MATLAB. This code generates random latitudes and longitudes and plots them as discrete circles with a radius of 7 meters. The circles that overlap will have different colors. Note that the distance function used here is part of the Mapping Toolbox, so you may need to find an alternative implementation if you don't have the toolbox. Here's an example code snippet:
% Generate random latitudes and longitudes
lat = rand(100, 1) * 180 - 90;
lon = rand(100, 1) * 360 - 180;
radius = 7;
figure;
for i = 1:numel(lat)
% Calculate the distance between each point and all other points
distances = distance(lat(i), lon(i), lat, lon);
% Find the indices of points within the radius
indices = find(distances <= radius);
% Plot the points within the radius with different colors
scatter(lon(indices), lat(indices), 'filled');
hold on;
end
xlim([-180 180]);
ylim([-90 90]);
% Set the aspect ratio to equal
daspect([1 1 1]);
grid on;
colorbar;
title('Discrete Density Plot');
xlabel('Longitude');
ylabel('Latitude');
Hope this helps!

Más respuestas (0)

Categorías

Más información sobre Geographic Plots en Help Center y File Exchange.

Productos


Versión

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by