Plot the live data on the map

5 次查看(过去 30 天)
A.Romia
A.Romia 2022-2-23
编辑: Pavan Sahith 2023-10-18
Hello everyone,
I am trieng to visualize the data of certain location on the map over the time .I want to visualize it by changing the color of each point depending on the value of the data.Now, I have the data for each specific points on the map and the data change over time and I couldn't create the loop that visualize my data over the time by changing the color of each point. I tried to use the geobubble(lat,lon) function to create the point but how can I plot over time?

回答(1 个)

Pavan Sahith
Pavan Sahith 2023-10-18
编辑:Pavan Sahith 2023-10-18
Hello Romia,
I understand you have the data for each specific points on the map and the data change over time and you need to create a loop that visualize your data over time by changing the colour of each point. To achieve that, you can try using geobubble orgeoscatter function.
Please refer to this below example code that visualize sample data over time by changing the colour of each point.
% Sample latitude, longitude, and data values
lat = [40.7128, 34.0522, 51.5074, 35.6895, 52.5200];
lon = [-74.0060, -118.2437, -0.1278, 139.6917, 13.4050];
data = [10, 5, 8, 12, 7; 9, 4, 7, 11, 6; 11, 6, 9, 13, 8];
% Define the number of time steps
numTimeSteps = size(data, 1);
% Create a figure
figure;
% Loop through each time step
for t = 1:numTimeSteps
% Get the data values at the current time step
currentData = data(t, :);
% Plot the points with colors based on the data values
geoscatter(lat, lon, [], currentData, 'filled');
% Customize the plot properties
colormap jet;
colorbar;
title(['Data Visualization at Time Step ' num2str(t)]);
% Pause to show the plot for 1 second
pause(1);
end
You can also use ‘geobubble’ which specifies different colour bubbles to different categories of data.
Please refer to the MathWorks documentation to know more about
Hope it helps

类别

Help CenterFile Exchange 中查找有关 Geographic Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by