MATLAB Examples

Display Several Geographic Bubble Charts Centered Within Specified Limits

This example shows how to create two geographic bubble charts with this same map limits.

Read Lyme Disease sample data into the workspace.

counties = readtable('counties.xlsx');

Create a geographic bubble chart that plots the occurrences of Lyme diaease in New England counties.

gb = geobubble(counties,'Latitude','Longitude','SizeVariable','Cases2010');

Pan and zoom the map until you see only Northern New England. For this example, use geolimits to set the latitude and longitude limits of the map and the zoomlevel.

[nlat nlon] = geolimits(gb)
nzoomlevel = gb.ZoomLevel
nlat =

   41.0906   46.8645


nlon =

  -74.9008  -66.0753


nzoomlevel =

    6.9777

Create another map with occurrence data for 2011 and set the map limits and zoomlevel to match the first chart.

figure
gb2 = geobubble(counties,'Latitude','Longitude','SizeVariable','Cases2011')
[n2lat n2lon] = geolimits(gb2,nlat,nlon)
gb2.ZoomLevel = nzoomlevel;
gb2 = 

  GeographicBubbleChart with properties:

              Basemap: 'darkwater'
            MapLayout: 'normal'
          SourceTable: [67x19 table]
     LatitudeVariable: 'Latitude'
    LongitudeVariable: 'Longitude'
         SizeVariable: 'Cases2011'
        ColorVariable: ''

  Use GET to show all properties


n2lat =

   41.0906   46.8645


n2lon =

  -74.9008  -66.0753