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 and view the first few rows. The table includes fields that identify the location of the cellular tower by latitude and longitude, and identify the type of tower.

load cellularTowers
head(cellularTowers)
ans=8×10 table
     ID     Latitude    Longitude          City             County       State    NEPA    SUPSTRUC    ALLSTRUC    STRUCTYPE
    ____    ________    _________    _________________    ___________    _____    ____    ________    ________    _________

    2166     37.119      -121.83     "MORGAN HILL"        SANTA CLARA     CA       N        46.9        50.6        MAST   
    2167     37.346      -121.63     "SAN JOSE"           SANTA CLARA     CA       N         2.4         2.4        PIPE   
    2168     37.158      -121.98     "REDWOOD ESTATES"    SANTA CLARA     CA       N        24.7        25.3        TOWER  
    2169     37.366      -122.14     "LOS ALTOS HILLS"    SANTA CLARA     CA       N        18.3        19.8        POLE   
    2170     37.402      -122.18     "STANFORD"           SANTA CLARA     CA       N         6.4         6.4        POLE   
    2171     37.258      -122.03     "SARATOGA"           SANTA CLARA     CA       N        10.1        11.9        B      
    2172     37.434      -121.89     "MILPITAS"           SANTA CLARA     CA       N        17.1        17.7        POLE   
    2173     37.446      -121.89     "MILPITAS"           SANTA CLARA     CA       N        19.5        19.5        B      

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.

geoscatter(cellularTowers.Latitude, cellularTowers.Longitude, '.')
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(cellularTowers.Latitude, cellularTowers.Longitude)
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(cellularTowers.Latitude, cellularTowers.Longitude,'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(cellularTowers.Latitude, cellularTowers.Longitude)
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(cellularTowers.Latitude, cellularTowers.Longitude)
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

|

Related Topics