histogram

Histogram with "other" value at the end to show how many values were cut off

No votes yet

Sometimes you have to cut your histogram at some value but you want to still inform the reader how many values you cut off. Here I simply add one additional histogram bar at the right hand side, ">30", to display the missing values.

data(USArrests, "VADeaths")
data <- USArrests$Rape
h <- hist(data, breaks=seq(0,3000,1), plot=F)

subset <- h$counts[seq(1,limit)]
rest <- sum(h$counts[seq(limit+1,length(h$counts))])
data <- c(subset, rest)

labels <- c(seq(1,limit,1),paste(">",toString(limit), seq=""))

Read more

Density curve plotted over a histogram

No votes yet

Sometimes it's useful to plot a density curve over a histogram to help identify the distribution, or demonstrate the deviation between sample distributions and proposed population distributions:

data <- rnorm(1000)
hist(data, freq=FALSE)
curve(dnorm, add=TRUE)

Read more

Adding a boxplot to a histogram

No votes yet

This person wondered if it was possible to add a small boxplot in a histogram, like where the legend might be.

Read more

Syndicate content