boxplot(count ~ spray, data = InsectSprays, col = “lightgray”)
par(mfrow = c(5, 4), tcl = -0.3, family = ‘serif’,
cex.main = 0.75, cex.axis = 0.75, cex.lab = 0.75, mar = c(2, 2, 2, 2))
for(i in seq(length(Xt))){
ts.plot(mean.single.sample.results[,i] %>% unname(),
gpars = list(xlab = " “, #“iterations”,
ylab =” ", # “cumulative average values”,
lwd = 1, col = 1, lty = 1))
title(paste(“wine tastor”, i, sep = " "))
}
============================ ggplot2常用参数说明 =============================
data.plot = data.frame(t = t, actu = x.actu, train = x.train)
ggplot(data.plot, aes(t)) + geom_point(aes(y = train), size = 2, colour = “green”, aplha = 0.5) + # alpha 制定透明度
geom_line(aes(y = actu), linetype = 2, size = 2, colour = “black”) + geom_point(aes(y = actu), colour = “black”) + # linetype 制定线型
geom_line(aes(y = simu), colour = “red”) + geom_point(aes(y = simu), colour = “red”) + # size 线条粗细和标记大小
xlab(“t”) + ylab(“x(t)”) + ggtitle(paste(“polynomial order=”, poly_order, sep = “”))
library(ggplot2)
library(reshape2)
for(i in 1:7){
plt_ts = resample_numeric_ts[, c(2, 5*i+(-2:2))] %>%
reshape2::melt(., id = “time”) # 数据变形 宽 --> 长
windows()
print(
qplot(time, value, data = plt_ts, geom = “line”, group = variable) +
facet_grid(variable~., scale = “free_y”)
)
}
head(economics, 6)
A tibble: 6 x 6
date pce pop psavert uempmed unemploy
1 1967-07-01 507. 198712 12.5 4.50 2944
2 1967-08-01 510. 198911 12.5 4.70 2945
3 1967-09-01 516. 199113 11.7 4.60 2958
4 1967-10-01 513. 199311 12.5 4.90 3143
5 1967-11-01 518. 199498 12.5 4.70 3066
6 1967-12-01 526. 199657 12.1 4.80 3018
em = melt(economics, id = “date”)
qplot(date, value, data = em, geom = “line”, group = variable) +
facet_grid(variable ~., scale = “free_y”)