FAQ
overflow

Great Answers to
Questions About Everything

QUESTION

If I write:

Histogram[{1, 1, 1, 2, 2, 2}]

I get a nice histogram chart

but if I write

Histogram[{"A", "A", "A", "B", "B", "B"}]

I get an empty chart!!

How can I tell mathematica to generate an histogram from nominal data?

{ asked by Luxspes }

ANSWER

One posibility is to use Tally with BarChart.

For example:

hist = Tally[{"A", "A", "B", "B", "B"}];
BarChart[hist[[All, 2]], ChartLabels -> hist[[All, 1]]]

bar chart

{ answered by Ajasja }
Tweet