I am trying to visualize a list of positive integers using a bar chart. In general, integers in that list may appear more than once. For example, I may have
list=Sort@RandomInteger[{1,10},20]
{1, 2, 2, 2, 3, 4, 5, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8, 9, 10, 10}
The bar chart I have in mind has the shape of
BarChart[DeleteDuplicates[list], BarSpacing -> 0, ChartBaseStyle -> EdgeForm[]]
It basically forgets about the multiplicity of each integer. I prefer to have the multiplicity reflected in the color of the bars, so
BarChart[Tally[list][[All, 2]], BarSpacing -> 0,
ChartBaseStyle -> EdgeForm[], ColorFunction -> "Rainbow"]
has the color scheme I want on my first bar chart.
Here is a slightly more general problem:
Given two lists containing the same number of positive integers, to produce a bar chart with heights and colors determined by the respective lists.





