


If so, what do I have to change to get the labels right (e.g.So, what do I have to do to get the stacked bars to represent a histogram?.qplot(factor(PAIR), data=d, geom="bar", fill=factor(PREFERENCE_FIXED)) So I tried this, and it gets me somewhat closer to what I'm trying to achieve, but it still uses the count of PREFERENCE, I suppose? Note the ylab being "count" here, and the values ranging to 19. I know I can create a simple bar chart with something like: ggplot(d, aes(x=factor(PAIR), y=factor(PREFERENCE))) + geom_bar(position="fill") I figured it'd be easiest using ggplot2, but I don't even know where to start. Something similar to the "100% stacked columns" in Excel, or (although not quite the same, a so-called "mosaic plot"):

a 100% high column, for each pair, indicating the distribution of the PREFERENCE values. In total, there are 19 pairs, and the PREFERENCE ranges from 1 to 5, as discrete values. You can find an example dataset as CSV here. I have data in the following format (here, imported from a CSV file).
