# Categorical or continuous scale for area chart?

I would like to plot the attached income distribution dataset (rendered as an image) as an area chart. As you can see, personal income is divided into 26 intervals of varying width. I also have the average and mean income in the intervals.

To convey a truthful area graphic of this data, I wonder what my options really are?
Plotting the ordinal categorical data at hand would yield a big hump in the area chart for the 400-499 interval. But this is only because that interval is wider and the user can hence be misguided by the shape. Another issue with the categorical data is that the average of the "1000+ interval" is very far from 1000 (= 1644). An area graphic not taking this into account would do a bad job in showing the actual distribution.

How would you go about and is there any way in which I can use the average/mean to "convert the categorical scale to a continuous scale"?

## 2 Answers

This is not exactly what you asked, but still may be helpful.

You may rely on the plot.histogram command in R. The usual use is to run a hist command, which prepares an object of class histogram and passes it to plot.histogram. You may prepare a customized histogram object yourself and plot it with plot.histogram.

The following code prints a histogram object:

data(cars); dput(hist(cars$dist, plot=FALSE))  You can make a similar object, and plot it: k = structure(list(breaks = c(0, 5, 10, 15, 25, 50, 75), counts = NULL, intensities = NULL, density = c(0.01, 0.018, 0.011, 0.006, 0.004, 0.001), mids = NULL, xname = "dist", equidist = FALSE), .Names = c("breaks", "counts", "intensities", "density", "mids", "xname", "equidist" ), class = "histogram") plot(k) A histogram with a continuous scale as described by GaBorgulya is clearly the way to go. When the blocks are wider, you need to adjust the density appropriately: the block 380-399 with 42246 people should be about 1.6 times the density of the block 400-499 with 132485 people. Except for the extremes of 0 and 1000+, you can just use the blocks you have, with the densities (number of people divided by width of block) as height. You can get even closer to the distribution by dividing each block at the medians: so for example you have 58700 in the interval "600 to 799 tkr" (i.e to just under 800), for a density of 293.5. Or you could divide this at the median of 681.3 into two blocks representing 29350 each, to have an interval from 600 to 672.6 of density 404.3 and an interval from 672.6 to 800 of density 230.4. You could go further and also take into account the means in each interval, but I don't think it is a priority. The extreme of 1000+ (23143 people, median 1281.0, mean 1644.2) is slightly harder but you can use the median to give you an interval from 1000 to 1281 with density 41.2. Now it is worth using the mean. You could for example have the top interval from 1281 to 3014.8 with density 6.7. This is not realistic as the maximum income is likely to be higher than 3014.8 and the curve is likely to be decreasing rather than flat, but it does illustrate the issue. Illustrating the extreme at 0 is even harder. Depending on how wide you make the block, you can have a spike there as high as you like. Here is an example from Households Below Average Income where they used £10 blocks. It has other design features, some of which you may find interesting, such as a cutoff at the top end and words describing how many were cut off. • Thanks for your great answer. It would be very helpful if you could you detail how you reach this conclusion? "The block 380-399 with 42246 people should be about 1.6 times the density of the block 400-499 with 132485 people". Would it be incorrect to divide the 132485 people with 5 (because the interval is 5 times bigger than the normal interval)? Thanks. – user4003 Apr 4 '11 at 11:34 • @user4003: If you base your graph on bands of width 20 then yes, you should divide the 132485 by 5, as it will be 5 bands wide. The density ratio of about 1.6 comes from$\frac{42246}{400-380} \div \frac{132485}{500-400}\$ – Henry Apr 4 '11 at 12:46