%% Normalize Colors Along Each Row or Column
% Create a heatmap and normalize the colors along each column or row by setting the ColorScaling property.
% Read the sample file outages.csv into a table. The sample file contains data representing electric utility outages in the Unites States. The table contains six columns: Region, OutageTime, Loss, Customers, RestorationTime, and Cause. Display the first five rows of each column.

T = readtable('outages.csv');
T(1:5,:)

%
% Create a heatmap that shows the different regions along the x-axis and the different outage causes along the y-axis. In each cell, show how many times each region experienced a power outage due to a particular cause.

h = heatmap(T,'Region','Cause');

%
% Normalize the colors along each column. The smallest value in each column maps to the first color in the colormap and the largest value maps to the last color. The last color indicates the cause that caused the most power outages for each region.

h.ColorScaling = 'scaledcolumns';

%
% Normalize the colors along each row instead. The smallest value in each row maps to the first color in the colormap and the largest value maps to the last color. The last color indicates the region that experienced the most power outages due to each cause.

h.ColorScaling = 'scaledrows';

% Copyright 2012 The MathWorks, Inc.