%% Specify Word Colors
% Load the example data sonnetsTable. The table tbl contains a list of words in the Word variable, and corresponding frequency counts in the Count variable.

load sonnetsTable
head(tbl)

% Plot the table data using wordcloud. Specify the words and corresponding word sizes to be the Word and Count variables respectively. To set the word colors to random values, set 'Color' to a random matrix or RGB triplets with one row for each word.

numWords = size(tbl,1);
colors = rand(numWords,3);
figure
wordcloud(tbl,'Word','Count','Color',colors);
title("Sonnets Word Cloud")

%