Plot the live data on the map

5 views (last 30 days)
A.Romia
A.Romia on 23 Feb 2022
Edited: Pavan Sahith on 18 Oct 2023
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?

Answers (1)

Pavan Sahith
Pavan Sahith on 18 Oct 2023
Edited: Pavan Sahith on 18 Oct 2023
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

Categories

Find more on Geographic Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!