ggplot2 - boxplots with missing values in R - ggplot -
i trying make boxplots matrix (athtp) 6 variables (columns) many missing values, '
ggplot(athtp)+geom_boxplot()
but maybe sth doing wrong...
i tried make many box plots , after arrange grid, final plot small (in desired dimensions), loosing many of details.
q1 <- ggplot(athtp,aes(x="v1", y=athtp[,1]))+ geom_boxplot()
..continue other 5 columns
grid.arrange(q1,q2,q3,q4,q5,q6, ncol=6) ggsave("plot.pdf",plot = qq, width = 8, height = 8, units = "cm")
do have ideas? in advance!
# ok data has 6 columns set.seed(666) dat <- data.frame(matrix(runif(60,1,20),ncol=6)) names(dat) <- letters[1:6] head(dat) # let's in long format ggplot likes library(reshape2) longdat <- melt(dat) head(longdat) # , try plot call again specifying want box plot per column # indicated "variable" column # [remember should specify x , y axes `aes()`] library(ggplot2) ggplot(longdat, aes(x=variable, y=value)) + geom_boxplot(aes(colour = variable))
Comments
Post a Comment