显示ggplot BOXPROOT的意外结果
我正在绘制这些数据:显示ggplot BOXPROOT的意外结果,r,ggplot2,R,Ggplot2,我正在绘制这些数据: Day,Property,Violent Mon,7.2,5.7 Tue,5,4.5 Wed,6.3,3.6 Thu,5.4,4 Fri,9.5,5.6 Sat,16,10.9 Sun,14.2,8.6 使用以下代码: library(ggplot2) library(reshape) week <- read.csv("week.csv", header=TRUE) data.melt <- melt(week,id="Day") ggplot() + g
Day,Property,Violent
Mon,7.2,5.7
Tue,5,4.5
Wed,6.3,3.6
Thu,5.4,4
Fri,9.5,5.6
Sat,16,10.9
Sun,14.2,8.6
使用以下代码:
library(ggplot2)
library(reshape)
week <- read.csv("week.csv", header=TRUE)
data.melt <- melt(week,id="Day")
ggplot() +
geom_boxplot(aes(x=Day, y= value, fill= variable),
data= data.melt, position = position_dodge(width = .9))
库(ggplot2)
图书馆(重塑)
周
DF <- read.table(text="Day,Property,Violent
Mon,7.2,5.7
Tue,5,4.5
Wed,6.3,3.6
Thu,5.4,4
Fri,9.5,5.6
Sat,16,10.9
Sun,14.2,8.6", header=TRUE, sep=",")
#I would consider the weekdays ordered, so let's turn them into an ordered factor.
DF$Day <- ordered(as.character(DF$Day), as.character(DF$Day))
library(ggplot2)
library(reshape2)
data.melt <- melt(DF,id.vars="Day")
ggplot() +
geom_boxplot(aes(x=Day, y= value, fill= variable),
data= data.melt, position = position_dodge(width = .9))
ggplot() +
geom_point(aes(x=Day, y= value, colour= variable),
data= data.melt, position = position_dodge(width = .9))