%% Display Tsunami Data Using Bubble Color to Indicate Tsunami Cause
% Read data about tsunamis into the workspace as a table. The rows represent individual tsunami occurrences. The columns represent data about each occurrence, such as the cause of each tsunami.

tsunamis = readtable('tsunamis.xlsx');

% Create a categorical variable because the data that controls the color of the bubbles must be a categorical variable. The tsunami table variable Cause already categorizes the tsunamis by seven criteria: Earthquake, Earthquake and Landslide, Volcano, Volcano and Landslide, Landslide, Meteorological, and Unknown Cause. Put the Cause variable data into a categorical variable.

cause = categorical(tsunamis.Cause);

% Create a geographic bubble chart, plotting the locations of the tsunamis on a map. Use bubble size to indicate the size of the wave, and use bubble color to indicate the cause. When you pass in the data, rather than specifying the names of table variables that contain the data, geobubble does not automatically add titles to the size and color legends.

geobubble(tsunamis.Latitude,tsunamis.Longitude,tsunamis.MaxHeight,cause)

% Copyright 2012 The MathWorks, Inc.