library(readr)
GMCConstation <- read_csv("GMCConstation.csv")
## Parsed with column specification:
## cols(
## site = col_character(),
## season = col_double(),
## Plot = col_double(),
## treat = col_character(),
## subtreat = col_character(),
## rep = col_double(),
## biomass = col_double(),
## `biomass/1000` = col_double(),
## grain = col_double(),
## `grain/1000` = col_double()
## )
View(GMCConstation)
attach(GMCConstation)
rep=as.factor(rep)
season=as.numeric(season)
treat=as.factor(treat)
subtreat=as.factor(subtreat)
site=as.factor(site)
library(ggplot2)
library(plyr)
library(maps)
##
## Attaching package: 'maps'
## The following object is masked from 'package:plyr':
##
## ozone
library(ggalt)
## Registered S3 methods overwritten by 'ggalt':
## method from
## grid.draw.absoluteGrob ggplot2
## grobHeight.absoluteGrob ggplot2
## grobWidth.absoluteGrob ggplot2
## grobX.absoluteGrob ggplot2
## grobY.absoluteGrob ggplot2
library(extrafontdb)
library(MASS)
library(pscl)
## Classes and Methods for R developed in the
## Political Science Computational Laboratory
## Department of Political Science
## Stanford University
## Simon Jackman
## hurdle and zeroinfl functions by Achim Zeileis
library(psych)
##
## Attaching package: 'psych'
## The following objects are masked from 'package:ggplot2':
##
## %+%, alpha
library(gridExtra)
library(repr) ### adjusting the length and width of your plot
library(beanplot)
library("devtools")
## Loading required package: usethis
library("yarrr")
## Loading required package: jpeg
## Loading required package: BayesFactor
## Loading required package: coda
## Loading required package: Matrix
## ************
## Welcome to BayesFactor 0.9.12-4.2. If you have questions, please contact Richard Morey (richarddmorey@gmail.com).
##
## Type BFManual() to open the manual.
## ************
## Loading required package: circlize
## ========================================
## circlize version 0.4.6
## CRAN page: https://cran.r-project.org/package=circlize
## Github page: https://github.com/jokergoo/circlize
## Documentation: http://jokergoo.github.io/circlize_book/book/
##
## If you use it in published research, please cite:
## Gu, Z. circlize implements and enhances circular visualization
## in R. Bioinformatics 2014.
## ========================================
## yarrr v0.1.5. Citation info at citation('yarrr'). Package guide at yarrr.guide()
## Email me at Nathaniel.D.Phillips.is@gmail.com
##
## Attaching package: 'yarrr'
## The following object is masked from 'package:ggplot2':
##
## diamonds
library(agricolae)
library(easynls)
library(MVN)
## Registered S3 method overwritten by 'GGally':
## method from
## +.gg ggplot2
## sROC 0.1-2 loaded
library(lme4)
## Registered S3 methods overwritten by 'lme4':
## method from
## cooks.distance.influence.merMod car
## influence.merMod car
## dfbeta.influence.merMod car
## dfbetas.influence.merMod car
library(ggsignif)
library(ggpubr)
## Loading required package: magrittr
##
## Attaching package: 'ggpubr'
## The following object is masked from 'package:plyr':
##
## mutate
library(tidyverse)
## -- Attaching packages --------------------------------------------------------- tidyverse 1.2.1 --
## v tibble 2.1.3 v dplyr 0.8.3
## v tidyr 0.8.3 v stringr 1.4.0
## v purrr 0.3.2 v forcats 0.4.0
## -- Conflicts ------------------------------------------------------------ tidyverse_conflicts() --
## x psych::%+%() masks ggplot2::%+%()
## x psych::alpha() masks ggplot2::alpha()
## x dplyr::arrange() masks plyr::arrange()
## x dplyr::combine() masks gridExtra::combine()
## x purrr::compact() masks plyr::compact()
## x dplyr::count() masks plyr::count()
## x tidyr::expand() masks Matrix::expand()
## x tidyr::extract() masks magrittr::extract()
## x dplyr::failwith() masks plyr::failwith()
## x dplyr::filter() masks stats::filter()
## x dplyr::id() masks plyr::id()
## x dplyr::lag() masks stats::lag()
## x purrr::map() masks maps::map()
## x dplyr::mutate() masks ggpubr::mutate(), plyr::mutate()
## x dplyr::rename() masks plyr::rename()
## x dplyr::select() masks MASS::select()
## x purrr::set_names() masks magrittr::set_names()
## x dplyr::summarise() masks plyr::summarise()
## x dplyr::summarize() masks plyr::summarize()
library(ggalluvial)
#################density plots#################
################site#############################
ggplot(data = GMCConstation, mapping = aes(x = grain/1000, fill = site)) + geom_density(alpha = 0.5)
## Warning: Removed 1 rows containing non-finite values (stat_density).

ggplot(data = GMCConstation, mapping = aes(x = biomass/1000, fill = site)) + geom_density(alpha = 0.5)

####################treat##############
ggplot(data = GMCConstation, mapping = aes(x = grain/1000, fill = treat)) + geom_density(alpha = 0.5)
## Warning: Removed 1 rows containing non-finite values (stat_density).

ggplot(data = GMCConstation, mapping = aes(x = biomass/1000, fill = treat)) + geom_density(alpha = 0.5)

################subtreat################
ggplot(data = GMCConstation, mapping = aes(x = grain/1000, fill = subtreat)) + geom_density(alpha = 0.5)
## Warning: Removed 1 rows containing non-finite values (stat_density).

ggplot(data = GMCConstation, mapping = aes(x = biomass/1000, fill = subtreat)) + geom_density(alpha = 0.5)

######################ANOVA grain###############
mod<-aov(grain/1000~rep+site+season+treat+subtreat+season:rep+treat+season+subtreat:rep+site:treat:subtreat+season:site+season:subtreat:treat:site,data=GMCConstation)
anova(mod)
## Analysis of Variance Table
##
## Response: grain/1000
## Df Sum Sq Mean Sq F value Pr(>F)
## rep 1 4.621 4.621 4.5750 0.0340616 *
## site 1 209.406 209.406 207.3015 < 2.2e-16 ***
## season 1 2.786 2.786 2.7578 0.0988729 .
## treat 3 19.670 6.557 6.4909 0.0003692 ***
## subtreat 1 76.812 76.812 76.0399 4.867e-15 ***
## rep:season 1 3.765 3.765 3.7272 0.0554187 .
## rep:subtreat 1 7.153 7.153 7.0809 0.0086394 **
## site:season 1 0.034 0.034 0.0340 0.8539643
## site:treat:subtreat 10 33.009 3.301 3.2677 0.0007556 ***
## site:season:treat:subtreat 14 3.596 0.257 0.2542 0.9972001
## Residuals 150 151.523 1.010
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## rep 1 4.62 4.62 4.575 0.034062 *
## site 1 209.41 209.41 207.301 < 2e-16 ***
## season 1 2.79 2.79 2.758 0.098873 .
## treat 3 19.67 6.56 6.491 0.000369 ***
## subtreat 1 76.81 76.81 76.040 4.87e-15 ***
## rep:season 1 3.77 3.77 3.727 0.055419 .
## rep:subtreat 1 7.15 7.15 7.081 0.008639 **
## site:season 1 0.03 0.03 0.034 0.853964
## site:treat:subtreat 10 33.01 3.30 3.268 0.000756 ***
## site:season:treat:subtreat 14 3.60 0.26 0.254 0.997200
## Residuals 150 151.52 1.01
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 1 observation deleted due to missingness
y<-HSD.test(mod,"treat",group = TRUE)
y
## $statistics
## MSerror Df Mean CV
## 1.010153 150 3.549678 28.31422
##
## $parameters
## test name.t ntr StudentizedRange alpha
## Tukey treat 4 3.674218 0.05
##
## $means
## grain/1000 std r Min Max Q25 Q50 Q75
## CWP_INT 3.036052 1.602772 46 0.24519 6.88070 1.971215 3.171710 4.270168
## MCN_INT 3.556997 1.820034 46 0.35795 7.03610 1.996983 3.618105 5.112255
## PGP_INT 3.777216 1.563560 47 0.74712 6.59893 2.553470 4.227500 4.965125
## SL_MZ 3.823499 1.614068 46 0.51414 6.52717 2.697475 4.066180 5.321438
##
## $comparison
## NULL
##
## $groups
## grain/1000 groups
## SL_MZ 3.823499 a
## PGP_INT 3.777216 a
## MCN_INT 3.556997 ab
## CWP_INT 3.036052 b
##
## attr(,"class")
## [1] "group"
x<-HSD.test(mod,"season",group = TRUE)
x
## $statistics
## MSerror Df Mean CV
## 1.010153 150 3.549678 28.31422
##
## $parameters
## test name.t ntr StudentizedRange alpha
## Tukey season 3 3.34774 0.05
##
## $means
## grain/1000 std r Min Max Q25 Q50 Q75
## 2017 3.729701 1.880264 64 0.24519 7.03610 2.217955 3.87283 5.350732
## 2018 3.460603 1.333071 58 0.40583 5.75700 2.563395 3.41775 4.470198
## 2019 3.448803 1.728212 63 0.35885 6.52717 1.884560 3.76507 4.877025
##
## $comparison
## NULL
##
## $groups
## grain/1000 groups
## 2017 3.729701 a
## 2018 3.460603 a
## 2019 3.448803 a
##
## attr(,"class")
## [1] "group"
v<-HSD.test(mod,"subtreat",group = TRUE)
v
## $statistics
## MSerror Df Mean CV
## 1.010153 150 3.549678 28.31422
##
## $parameters
## test name.t ntr StudentizedRange alpha
## Tukey subtreat 2 2.794352 0.05
##
## $means
## grain/1000 std r Min Max Q25 Q50 Q75
## FERT 4.163272 1.301861 95 1.52985 7.03610 3.176410 4.303290 5.064450
## NO_FERT 2.901995 1.772252 90 0.24519 5.99544 1.314715 2.769415 4.603178
##
## $comparison
## NULL
##
## $groups
## grain/1000 groups
## FERT 4.163272 a
## NO_FERT 2.901995 b
##
## attr(,"class")
## [1] "group"
################bar group chart##################
bar.group(y$groups, ylim=c(0,7.5), density=4,border="blue")

bar.group(v$groups, ylim=c(0,7.5), density=4,border="blue")

#####################grain#########################
m<-ggplot(GMCConstation, aes(x = treat, y = grain/1000))+ geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("grey","grey","grey","grey")) + geom_smooth(method=lm)+ ylab("Grain/1000 [kg/ha]") + xlab("treat")+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold", color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.0, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.6, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 3.7, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 3.8, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
m
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

#################facet by season###################
m<-ggplot(GMCConstation, aes(x = treat, y = grain/1000))+ geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("grey","grey","grey","grey","grey","grey","grey","grey","grey","grey","grey","grey")) + geom_smooth(method=lm)+ ylab("Grain/1000 [kg/ha]") + xlab("treat")+facet_wrap(~season)+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold",color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.0, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.6, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 3.7, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 3.8, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
m
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

#################facet by site###################
m<-ggplot(GMCConstation, aes(x = treat, y = grain/1000))+ geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("grey","grey","grey","grey","grey","grey","grey","grey")) + geom_smooth(method=lm)+ ylab("Grain/1000 [kg/ha]") + xlab("treat")+facet_wrap(~site)+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold",color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.0, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.6, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 3.7, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 3.8, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
m
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

#################facet by site###################
m<-ggplot(GMCConstation, aes(x = treat, y = grain/1000))+ geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("grey","grey","grey","grey","grey","grey","grey","grey")) + geom_smooth(method=lm)+ ylab("Grain/1000 [kg/ha]") + xlab("treat")+facet_wrap(~subtreat)+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold",color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.0, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.6, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 3.7, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 3.8, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
m
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

##########new ones box plots grain##############
ggplot(GMCConstation, aes(x=treat, y=grain/1000)) + geom_boxplot() + geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("gold","gold","gold","gold")) + geom_smooth(method=lm)+ ylab("Grain/1000 [kg/ha]") + xlab("treat")+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold",color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.0, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.6, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 3.7, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 3.8, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

##########reordered grain#############
ggplot(GMCConstation, aes(x=reorder(treat, grain/1000, FUN=median), y=grain/1000)) + geom_boxplot()+ geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("gold","gold","gold","gold")) + geom_smooth(method=lm)+ ylab("Grain/1000 [kg/ha]") + xlab("treat")+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold",color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.0, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.6, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 3.7, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 3.8, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

#############################facets grain################
##########reordered#############
ggplot(GMCConstation, aes(x=reorder(treat, grain/1000, FUN=median), y=grain/1000)) + geom_boxplot()+ geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("gold","gold","gold","gold","gold","gold","gold","gold","gold","gold","gold","gold")) + geom_smooth(method=lm)+ ylab("Grain/1000 [kg/ha]") + xlab("treat")+facet_wrap(~season)+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold",color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.0, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.6, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 3.7, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 3.8, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

################################
##########reordered#############
ggplot(GMCConstation, aes(x=reorder(treat, grain/1000, FUN=median), y=grain/1000)) + geom_boxplot()+ geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("gold","gold","gold","gold","gold","gold","gold","gold")) + geom_smooth(method=lm)+ ylab("Grain/1000 [kg/ha]") + xlab("treat")+facet_wrap(~subtreat)+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold",color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.0, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.6, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 3.7, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 3.8, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

############VIOLIN PLOTS EMBEDDED WITH BOX PLOTS#########
######################grain##################
theme_set(theme_gray(base_size =15))
m <- ggplot(data=GMCConstation,aes(x=treat, y=grain/1000))
m + geom_violin(size=1.3,shape=8) + geom_boxplot(width=.2, outlier.size=0,fill=c("grey","grey","grey", "grey"))+ylab("Grain [t/ha]") + xlab("treatment")+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold",color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.0, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.6, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 3.7, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 3.8, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5))
## Warning: Ignoring unknown parameters: shape
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Warning: Removed 1 rows containing non-finite values (stat_ydensity).
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

######################ANOVA BIOMASS###############
mod<-aov(biomass/1000~rep+site+season+treat+subtreat+season:rep+treat+season+subtreat:rep+site:treat:subtreat+season:site+season:subtreat:treat:site,data=GMCConstation)
anova(mod)
## Analysis of Variance Table
##
## Response: biomass/1000
## Df Sum Sq Mean Sq F value Pr(>F)
## rep 1 0.43 0.43 0.4306 0.5126741
## site 1 419.08 419.08 415.9461 < 2.2e-16 ***
## season 1 12.60 12.60 12.5107 0.0005378 ***
## treat 3 15.33 5.11 5.0719 0.0022505 **
## subtreat 1 34.76 34.76 34.5006 2.618e-08 ***
## rep:season 1 1.86 1.86 1.8484 0.1759977
## rep:subtreat 1 4.79 4.79 4.7568 0.0307300 *
## site:season 1 77.17 77.17 76.5950 3.888e-15 ***
## site:treat:subtreat 10 26.46 2.65 2.6265 0.0056485 **
## site:season:treat:subtreat 14 13.69 0.98 0.9704 0.4862376
## Residuals 151 152.14 1.01
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
summary(mod)
## Df Sum Sq Mean Sq F value Pr(>F)
## rep 1 0.4 0.4 0.431 0.512674
## site 1 419.1 419.1 415.946 < 2e-16 ***
## season 1 12.6 12.6 12.511 0.000538 ***
## treat 3 15.3 5.1 5.072 0.002250 **
## subtreat 1 34.8 34.8 34.501 2.62e-08 ***
## rep:season 1 1.9 1.9 1.848 0.175998
## rep:subtreat 1 4.8 4.8 4.757 0.030730 *
## site:season 1 77.2 77.2 76.595 3.89e-15 ***
## site:treat:subtreat 10 26.5 2.6 2.627 0.005649 **
## site:season:treat:subtreat 14 13.7 1.0 0.970 0.486238
## Residuals 151 152.1 1.0
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
y<-HSD.test(mod,"treat",group = TRUE)
y
## $statistics
## MSerror Df Mean CV
## 1.007533 151 3.788915 26.49201
##
## $parameters
## test name.t ntr StudentizedRange alpha
## Tukey treat 4 3.673944 0.05
##
## $means
## biomass/1000 std r Min Max Q25 Q50
## CWP_INT 3.389346 1.801647 47 0.61757 6.62492 1.846195 3.406520
## MCN_INT 3.682649 2.198736 46 0.57262 8.02652 2.099118 3.362310
## PGP_INT 4.021449 2.025792 47 0.75273 7.83127 2.688945 3.870390
## SL_MZ 4.065846 2.047185 46 0.68263 8.12553 2.406365 3.863765
## Q75
## CWP_INT 4.866320
## MCN_INT 5.223208
## PGP_INT 4.931870
## SL_MZ 5.245570
##
## $comparison
## NULL
##
## $groups
## biomass/1000 groups
## SL_MZ 4.065846 a
## PGP_INT 4.021449 a
## MCN_INT 3.682649 ab
## CWP_INT 3.389346 b
##
## attr(,"class")
## [1] "group"
x<-HSD.test(mod,"season",group = TRUE)
x
## $statistics
## MSerror Df Mean CV
## 1.007533 151 3.788915 26.49201
##
## $parameters
## test name.t ntr StudentizedRange alpha
## Tukey season 3 3.347518 0.05
##
## $means
## biomass/1000 std r Min Max Q25 Q50 Q75
## 2017 3.662971 1.507887 64 0.58746 6.14377 2.818840 4.117085 4.783417
## 2018 3.374314 1.526706 58 0.74327 7.71588 2.255095 3.287395 4.283755
## 2019 4.290590 2.687805 64 0.57262 8.12553 1.619317 4.272855 6.843987
##
## $comparison
## NULL
##
## $groups
## biomass/1000 groups
## 2019 4.290590 a
## 2017 3.662971 b
## 2018 3.374314 b
##
## attr(,"class")
## [1] "group"
v<-HSD.test(mod,"subtreat",group = TRUE)
v
## $statistics
## MSerror Df Mean CV
## 1.007533 151 3.788915 26.49201
##
## $parameters
## test name.t ntr StudentizedRange alpha
## Tukey subtreat 2 2.794202 0.05
##
## $means
## biomass/1000 std r Min Max Q25 Q50 Q75
## FERT 4.20044 1.697844 95 1.13164 8.12553 2.89028 4.10214 5.144080
## NO_FERT 3.35930 2.247144 91 0.57262 7.87607 1.34109 2.95704 4.948145
##
## $comparison
## NULL
##
## $groups
## biomass/1000 groups
## FERT 4.20044 a
## NO_FERT 3.35930 b
##
## attr(,"class")
## [1] "group"
################bar group chart##################
bar.group(y$groups, ylim=c(0,8.5), density=4,border="blue")

bar.group(v$groups, ylim=c(0,8.5), density=4,border="blue")

#####################biomass#########################
m<-ggplot(GMCConstation, aes(x = treat, y = biomass/1000))+ geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("grey","grey","grey","grey")) + geom_smooth(method=lm)+ ylab("Biomass/1000 [kg/ha]") + xlab("treat")+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold", color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.4, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.7, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 4, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 4.1, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5,8,8.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
m
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

#################facet by season###################
m<-ggplot(GMCConstation, aes(x = treat, y = biomass/1000))+ geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("grey","grey","grey","grey","grey","grey","grey","grey","grey","grey","grey","grey")) + geom_smooth(method=lm)+ ylab("Biomass/1000 [kg/ha]") + xlab("treat")+facet_wrap(~season)+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold", color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.4, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.7, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 4, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 4.1, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5,8,8.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
m
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

#################facet by site###################
m<-ggplot(GMCConstation, aes(x = treat, y = biomass/1000))+ geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("grey","grey","grey","grey","grey","grey","grey","grey")) + geom_smooth(method=lm)+ ylab("Biomass/1000 [kg/ha]") + xlab("treat")+facet_wrap(~site)+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold", color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.4, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.7, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 4, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 4.1, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5,8,8.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
m
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

#################facet by subtreat###################
m<-ggplot(GMCConstation, aes(x = treat, y = biomass/1000))+ geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("grey","grey","grey","grey","grey","grey","grey","grey")) + geom_smooth(method=lm)+ ylab("Biomass/1000 [kg/ha]") + xlab("treat")+facet_wrap(~subtreat)+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 8500)+ theme(axis.text.x = element_text(face="bold",color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.0, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.6, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 3.7, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 3.8, label = "a")+
ylim(100,8500) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5,8,8.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
m
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

##########new ones box plots biomass##############
ggplot(GMCConstation, aes(x=treat, y=biomass/1000)) + geom_boxplot() + geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("gold","gold","gold","gold")) + geom_smooth(method=lm)+ ylab("Biomass/1000 [kg/ha]") + xlab("treat")+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold", color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.4, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.7, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 4, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 4.1, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5,8,8.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

##########reordered biomass#############
ggplot(GMCConstation, aes(x=reorder(treat, biomass/1000, FUN=median), y=biomass/1000)) + geom_boxplot()+ geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("gold","gold","gold","gold")) + geom_smooth(method=lm)+ ylab("Biomass/1000 [kg/ha]") + xlab("treat")+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold", color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.4, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.7, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 4, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 4.1, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5,8,8.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

#############################facets biomass################
##########reordered#############
ggplot(GMCConstation, aes(x=reorder(treat, biomass/1000, FUN=median), y=biomass/1000)) + geom_boxplot()+ geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("gold","gold","gold","gold","gold","gold","gold","gold","gold","gold","gold","gold")) + geom_smooth(method=lm)+ ylab("Biomass/1000 [kg/ha]") + xlab("treat")+facet_wrap(~season)+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold", color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.4, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.7, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 4, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 4.1, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5,8,8.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

################################
##########reordered#############
ggplot(GMCConstation, aes(x=reorder(treat, biomass/1000, FUN=median), y=biomass/1000)) + geom_boxplot()+ geom_boxplot(size=0.8,varwidth =FALSE,outlier.colour = "red",outlier.shape = 2, shape=6,fill=c("gold","gold","gold","gold","gold","gold","gold","gold")) + geom_smooth(method=lm)+ ylab("Biomass/1000 [kg/ha]") + xlab("treat")+facet_wrap(~subtreat)+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold", color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.4, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.7, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 4, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 4.1, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5,8,8.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

####################VIOLIN PLOTS EMBEDDED WITH BOXPLOTS####################
theme_set(theme_gray(base_size =15))
m <- ggplot(data=GMCConstation,aes(x=treat, y=biomass/1000))
m + geom_violin(size=1.3,shape=8) + geom_boxplot(width=.2, outlier.size=0,fill=c("grey","grey","grey", "grey"))+ylab("Biomass [t/ha]") + xlab("treatment")+ theme(axis.title = element_text(size=20, face="bold"), axis.text.x = element_text(size=12, face="bold", angle = 90, hjust = 1), axis.text.y = element_text(size=16, face="bold"))+
stat_summary(fun.y=mean, geom="point", shape=10, size=2, color="blue", fill="red")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold", color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.4, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.7, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 4, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 4.1, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5,8,8.5))
## Warning: Ignoring unknown parameters: shape
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

ggplot(GMCConstation, aes(biomass/1000, grain/1000)) +
geom_point() + geom_smooth(mapping = aes(linetype = "r2"),
method = "lm",
formula = y ~ x + log(x), se = FALSE,
color = "blue")+
facet_grid(. ~ treat)+ scale_y_continuous(breaks = c(0,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7))
## Warning: Removed 1 rows containing non-finite values (stat_smooth).
## Warning: Removed 1 rows containing missing values (geom_point).

##########################
ggplot(GMCConstation, aes(biomass/1000, grain/1000)) +
geom_point() +
facet_grid(. ~ season)
## Warning: Removed 1 rows containing missing values (geom_point).

##################
ggplot(GMCConstation, aes(biomass/1000, grain/1000)) +
geom_point() +
facet_grid(. ~ site)
## Warning: Removed 1 rows containing missing values (geom_point).

########################
ggplot(GMCConstation, aes(biomass/1000, grain/1000)) +
geom_point() +
facet_grid(. ~ subtreat)
## Warning: Removed 1 rows containing missing values (geom_point).

################# bar graphs biomass###################
m<-ggplot(GMCConstation, aes(x = treat, y = biomass/1000))+ geom_bar(stat="identity", width=0.5, position = "dodge")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold", color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.4, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.7, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 4, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 4.1, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5,8,8.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
m
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found

################# bar graphs grain###################
m<-ggplot(GMCConstation, aes(x = treat, y = grain/1000))+ geom_bar(stat="identity", width=0.5, position = "dodge")+
stat_summary(
fun.data = GMCConstation,
geom = "text",
hjust = 0.5,
vjust = 0.9,
size=3,
face="bold"
)+ theme_classic(base_size = 14)+ ylim(100, 7500)+ theme(axis.text.x = element_text(face="bold",color="black",
size=6),
axis.text.y = element_text(face="bold", color="black",
size=10))+geom_text(data =GMCConstation, x = 1, y = 3.0, label = "b")+geom_text(data =GMCConstation, x = 2, y = 3.6, label = "ab")+geom_text(data =GMCConstation, x = 3, y = 3.7, label = "a")+ geom_text(data =GMCConstation, x = 4, y = 3.8, label = "a")+
ylim(100,7000) + scale_y_continuous(breaks = c(0,0.5,1,1.5,2,2.5,3,3.5,4,4.5,5,5.5,6,6.5,7, 7.5))
## Warning: Ignoring unknown parameters: face
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
## Scale for 'y' is already present. Adding another scale for 'y', which
## will replace the existing scale.
m
## Warning: Removed 1 rows containing non-finite values (stat_summary).
## Warning: Computation failed in `stat_summary()`:
## object 'fun.data' of mode 'function' was not found
## Warning: Removed 1 rows containing missing values (geom_bar).

#########aaluvials grain###########
ggplot(GMCConstation, aes(kg = grain/1000, axis1 = treat, axis2 = season)) +
geom_alluvium(aes(fill = treat), color = "black") + geom_stratum()

########Add text##############
ggplot(GMCConstation, aes(kg = grain/1000, axis1 = treat, axis2 = season)) +
geom_alluvium(aes(fill = treat), color = "black") + geom_stratum() +
geom_text(stat = "stratum", label.strata = TRUE) +
theme(legend.position = "true",
axis.text = element_text(size=14))

#########aaluvials biomass###########
ggplot(GMCConstation, aes(kg = biomass/1000, axis1 = treat, axis2 = season)) +
geom_alluvium(aes(fill = treat), color = "black") + geom_stratum()

########Add text##############
ggplot(GMCConstation, aes(kg = biomass/1000, axis1 = treat, axis2 = season)) +
geom_alluvium(aes(fill = treat), color = "black") + geom_stratum() +
geom_text(stat = "stratum", label.strata = TRUE) +
theme(legend.position = "true",
axis.text = element_text(size=14))

ggplot(data = GMCConstation, mapping = aes(x = grain/1000, fill = site)) + geom_density(alpha = 0.5)
## Warning: Removed 1 rows containing non-finite values (stat_density).
