Previous: Descriptive Plots: Box-plots Up: Examples Next: Advanced Examples

Density Plots: A Histogram

Histograms are easy ways to evaluate the density of a quantity of interest.

40#40

Here's the code to create this graph:

> library(Zelig)                              # Loads the Zelig package.
> data(turnout)                               # Loads the sample data set.
> truehist(turnout$income,  col = "wheat1",   # Calls the main plot, with   
+      xlab = "Annual Income in $10,000s",    #  options.  
+      main = "Histogram of Income") 
> lines(density(turnout$income))              # Adds the kernel density line.



Gary King 2011-11-29