How to separate the two leftmost bins of a histogram in R
Suppose I need to plot a dataset like below: set.seed(1) dataset <- sample(1:7, 1000, replace=T) hist(dataset) As you can see in the plot below, the two leftmost bins do not have any space between them unlike the rest of the bins. I tried changing xlim, but it didn't work. Basically I would like to have each number (1 to 7) represented as a bin, and additionally, I would like any two adjacent bins to have space beween them...Thanks! The best way is to set the breaks argument manually. Using the data from your code, hist(dataset,breaks=rep(1:7,each=2)+c(-.4,.4)) gives the following plot: The