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: [37.1189 37.3464 37.1575 37.3656 37.4019 37.2581 37.4339 37.4458 37.0081 38.9806 38.9403 38.8361 39.3886 39.3222 39.1967 39.3900 39.0958 39.1019 38.8036 39.1450 34.7386 34.8347 34.5264 34.5700 34.8883 34.9200 … ] (1×1193 double) LongitudeData: [-121.8336 -121.6303 -121.9839 -122.1356 -122.1769 -122.0336 -121.8867 -121.8925 -121.2875 -121.6619 -121.4147 -121.5636 -121.1775 -121.6694 -121.9978 -122.0133 -121.4058 -121.7769 -121.7211 -121.9100 -120.4456 … ] (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