View Density of Cellular Tower Placement
This example shows how to use a geographic density plot to view the density of cellular tower placement in California.
Load Cellular Tower Placement Data
Load a table of cellular tower placement data into the workspace. The table includes fields that identify the location of the cellular tower by latitude and longitude, and identify the type of tower.
load cellularTowers
View the Data as a Geographic Scatter Plot
Plot the cellular tower data using the geoscatter
function. In the plot, there are clear areas around San Francisco where the number of towers are too dense to be represented using a scatter plot.
lat = cellularTowers.Latitude; lon = cellularTowers.Longitude; geoscatter(lat,lon,'.') text(gca,37.75,-122.75,'San Francisco','HorizontalAlignment','right')
View the Data as a Geographic Density Plot
The dense area of towers in the San Francisco area can be shown using geodensityplot
.
geodensityplot(lat,lon) text(gca,37.75,-122.75,'San Francisco','HorizontalAlignment','right')
Create a Density Plot Specifying the Radius
When you create a geographic density plot, by default, the density plot automatically selects a radius value, using the latitude and longitude data. Use the Radius
property to manually select a radius in meters.
radiusInMeters = 50e3; % 50 km geodensityplot(lat,lon,'Radius',radiusInMeters)
Use axes properties to adjust transparency
When set to 'interp'
, the density plot's FaceAlpha
and FaceColor
properties use the Alphamap
and Colormap
properties of the underlying geographic axes, respectively. Changing the Alphamap
changes the mapping of the density values to color intensities.
geodensityplot(lat,lon)
alphamap(normalize((1:64).^0.5,'range'))
The AlphaScale
property on the geographic axes can also be used to alter the transparency. This property is particularly useful when trying to show where any density is found, rather than highlighting the most dense areas.
figure dp = geodensityplot(lat,lon)
dp = DensityPlot with properties:
FaceColor: [0 0.4470 0.7410]
FaceAlpha: 'interp'
LatitudeData: [1×1193 double]
LongitudeData: [1×1193 double]
WeightData: [1×0 double]
Radius: 1.8291e+04
Show all properties
gx = gca
gx = GeographicAxes with properties:
Basemap: 'streets-light'
Position: [0.1300 0.1100 0.7750 0.8150]
Units: 'normalized'
Show all properties
gx.AlphaScale = 'log';
Use DensityPlot
Object Properties to Specify Color
Add color.
dp.FaceColor = 'interp'; colormap hot
See Also
geodensityplot
| DensityPlot Properties