# Scatter Plots on Maps in MATLAB®

How to make Scatter Plots on Maps plots in MATLAB® with Plotly.

## 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);