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?
|
If I write:
I get a nice histogram chart but if I write
I get an empty chart!! How can I tell mathematica to generate an histogram from nominal data? |
|||
|
|
|
Perhaps like this:
EDIT: Incorporating @Simon Wood´s splendid suggestion (we learn that the legend is a plain Bigger sorted input with monster legend. Notice: Bin widths other than one mess this up somewhat...
And now for some fun:
ToDo: modify the ticks accordingly. |
|||||
|
|
Here is a variation that works with multiple data sets: BarChart: pure categorical variables
Alternatively, you can use
gives the same result. Histogram: ordered categorical variables:
|
||||
|
|
|
One posibility is to use For example:
|
||||
|
|