2016-11-10 7 views
0

私は6つの変数(列)ではなく、多くの欠損値と行列(athTp)用の箱ひげ図を作成しようとしています、「Rにおける欠損値を持つ箱ひげ - ggplot

ggplot(athTp)+geom_boxplot() 

しかし、多分私が間違っているのSTH ...

グリッドを配置するために多くのボックスプロットを作成しようとしましたが、最終的なプロットは非常に小さく(希望の寸法で)、多くの細部を失っていました。他の5つの列

grid.arrange(q1,q2,q3,q4,q5,q6, ncol=6) 

ggsave("plot.pdf",plot = qq, width = 8, height = 8, units = "cm") 

q1 <- ggplot(athTp,aes(x="V1", y=athTp[,1]))+ geom_boxplot() 

..continueあなたが任意のアイデアを持っていますか? ありがとうございます! "長い形式" ..so

答えて

0
# ok so your data has 6 columns like this 
set.seed(666) 
dat <- data.frame(matrix(runif(60,1,20),ncol=6)) 
names(dat) <- letters[1:6] 
head(dat) 

# so let's get in long format like ggplot likes 
library(reshape2) 
longdat <- melt(dat) 
head(longdat) 

# and try your plot call again specifying that we want a box plot per column 
# which is now indicated by the "variable" column 
# [remember you should specify the x and y axes with `aes()`] 
library(ggplot2) 
ggplot(longdat, aes(x=variable, y=value)) + geom_boxplot(aes(colour = variable)) 

enter image description here

+0

それが問題でした!ありがとう、それは今働きます! – Marz

関連する問題