With these toy data, how can I remove unused empty space between the bars?
 
#Toy data
x1 <- as.data.frame(rep(1:3,   c(10,2,6)))
colnames(x1) <- c("name")
x2 <- as.data.frame(rep(5:7,   c(14,5,8)))
colnames(x2) <- c("name")
x3 <- as.data.frame(rep(10:12, c(5,5, 8)))
colnames(x3) <- c("name")
x4 <- as.data.frame(rep(18, 9))
colnames(x4) <- c("name")
dat <- rbind.data.frame(x1, x2, x3, x4)
dat <- as.data.frame(dat)
colnames(data) <- c("name")
fix(dat)
require(ggplot2)
ggplot(dat , aes(x=name, y = ..density..)) +
         geom_histogram(colour = "darkgreen", fill = "blue", binwidth = 0.5) 
  
 


Peter Maclean
Department of Economics
UDSM

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to