r spaghetti.R
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了r spaghetti.R相关的知识,希望对你有一定的参考价值。
plotSpaghetti<-function(X){
fill <- color <- "meow_realm"
#Spaghetti plots
colourCount = length(unique(X$meow_realm))
getPalette = colorRampPalette(brewer.pal(9, "Set1"))
g <- ggplot(X, aes(x = x, y = y, colour = meow_realm)) +
geom_point(aes(x = x, y = y, colour = meow_realm),
size = 2, data = subset(X, method == "observed"))
g <- g + geom_ribbon(aes(ymin = y.lwr, ymax = y.upr,
fill = meow_realm, colour = NULL, group = label),
alpha = 0.2, data = X)
g <- g + geom_line(aes(x = x, y = y, fill = meow_realm, group = label),
size = 0.5, linetype=1, data = subset(X, method == "interpolated" ))
g <- g +
geom_line(aes(x = x, y = y, fill = meow_realm, group = label),
size = 0.5, linetype=2, data = subset(X, method == "extrapolated" )) +
theme_bw() +
guides(col=guide_legend(nrow=2),linetype = guide_legend(title = "Method"),
colour = guide_legend(title = "Order"), fill = guide_legend(title = "Order"),
shape = guide_legend(title = "Site")) +
theme(legend.position = "bottom", text = element_text(size = 8))
g <- g +
scale_colour_manual(guide = guide_legend(title = ""),
values = colorRampPalette(brewer.pal(9, "Set1"))(colourCount)) +
scale_fill_manual(guide = guide_legend(title = ""),
values = colorRampPalette(brewer.pal(9, "Set1"))(colourCount)) +
guides(fill=F) +
theme(legend.key = element_rect(fill = "white")) +
theme(legend.position="bottom") +
xlab("Number of sequences sampled") +
ylab("Species diversity")
g <- g +
facet_grid(order~meow_realm, scale="free") +
theme(legend.key.size = unit(0.5, "cm")) +
guides(col = guide_legend(nrow = 2, byrow = TRUE))
return(g)
}
plotSpaghetti(inext_est_raw_rar %>% filter(water_depth <= 5, !is.na(meow_realm)))
以上是关于r spaghetti.R的主要内容,如果未能解决你的问题,请参考以下文章
——R的数据组织
+-r, +-s 的所有排列
shinydashboard ui.R 和 server.R 未读取 Global.R
R语言计算回归模型R方(R-Squared)实战
r语言中r-studio怎么调用
R电子书资料《学习R》+《R语言实战第2版》+《R数据科学》学习推荐