%
% Homework 5
% plotFreqs.m
% CS 1109, Summer 2011
% July 25
%
% plotFreqs: Plots a histogram of letter frequency data
%
%    This function takes as input a frequency table of letter appearances
%    as generated by letterFreqs and plots the appearance frequencies as a
%    bar chart. The function returns no values.
%
% USAGE: plotFreqs(str);
%

function plotFreqs(histData)

% Plot the frequency data
x = 1:1:26;
bar(x, histData);

% Set figure properties
xlabel('Letter');
ylabel('Number of appearances');
title(['Frequency of appearances of the letters of the alphabet ' ...
    'in the cipher text']);

% Reset the axes
axis([0 27 0 1.1*(max(histData))]);

% Print bar labels and change axis tick labels
beautifyPlot(histData);

end

%
% Common mistakes / other observations:
%
% 1) Most people scored perfect on this problem; some got points deductions
% for code standard violations.
%
% 2) The substitution alphabet used was: bdwharlngjockfuvitqxezsymp
% You can plug this into the decrypt function to retrieve the original
% plaintext message, which is an essay by George Orwell titled `Shooting an
% Elephant'.
%

