Scatter Plots on Maps in MATLAB®
How to make Scatter Plots on Maps plots in MATLAB® with Plotly.
Plotly is known for its graphing libraries, but it's also a broader ecosystem for building interactive data apps, AI data analysis tools, and deploying and hosting Dash apps. Explore the full set of tools and platforms designed to help turn data into action. Discover Plotly.
Note: We are retiring documentation for R, MATLAB, Julia, and F#. Learn more about this change here.
Create Geographic Scatter Plot Controlling Color, Size, and Shape of Markers
Set up latitude and longitude data.
lon = (-170:10:170);
lat = 50 * cosd(3*lon);
Define data that controls the area of each marker.
lon = (-170:10:170);
lat = 50 * cosd(3*lon);
A = 101 + 100*(sind(2*lon));
Define data to control the color of each marker.
lon = (-170:10:170);
lat = 50 * cosd(3*lon);
A = 101 + 100*(sind(2*lon));
C = cosd(4*lon);
Plot the data on a geographic scatter plot, specifying the marker size data and the color data. Specify the marker as a triangle, rather than the default circle.
lon = (-170:10:170);
lat = 50 * cosd(3*lon);
A = 101 + 100*(sind(2*lon));
C = cosd(4*lon);
geoscatter(lat,lon,A,C,'^')
fig2plotly(gcf);
Create Geographic Scatter Plot Specifying Basemap
Set up latitude and longitude data.
lon = (-170:10:170);
lat = 50 * cosd(3*lon);
Define the data that controls the area of each marker.
lon = (-170:10:170);
lat = 50 * cosd(3*lon);
A = 101 + 100*(sind(2*lon));
Define the data that controls the color of each marker.
lon = (-170:10:170);
lat = 50 * cosd(3*lon);
A = 101 + 100*(sind(2*lon));
C = cosd(4*lon);
Create the scatter plot on a set of geographic axes, specifying the marker size data and the color data. The example specifies the marker as a triangle, rather than the default circle.
lon = (-170:10:170);
lat = 50 * cosd(3*lon);
A = 101 + 100*(sind(2*lon));
C = cosd(4*lon);
geoscatter(lat,lon,A,C,'^')
fig2plotly(gcf);
Change the basemap of the geographic scatter plot.
lon = (-170:10:170);
lat = 50 * cosd(3*lon);
A = 101 + 100*(sind(2*lon));
C = cosd(4*lon);
geoscatter(lat,lon,A,C,'^')
geobasemap colorterrain
fig2plotly(gcf);