How to create overlaping heatmap in geoplot
12 ビュー (過去 30 日間)
古いコメントを表示
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.
0 件のコメント
採用された回答
Yash
2024 年 4 月 4 日
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!
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Geographic Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!