This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
library(readxl)
## Warning: 程辑包'readxl'是用R版本4.3.2 来建造的
data_UV <- read_excel("F:/(R) visualizations/plots for LYP/20250217/data_UV.xlsx")
data_sal <- read_excel("F:/(R) visualizations/plots for LYP/20250217/data_sal.xlsx")
data_T <- read_excel("F:/(R) visualizations/plots for LYP/20250217/data_T.xlsx")
data_UV$group = factor(data_UV$group, levels = data_UV$group[c(1, 7, 13, 19)])
data_sal$group = factor(data_sal$group, levels = data_sal$group[c(1, 7, 13, 19)])
data_T$group = factor(data_T$group, levels = data_T$group[c(1, 7, 13, 19)])
library(ggplot2)
## Warning: 程辑包'ggplot2'是用R版本4.2.3 来建造的
library(patchwork)
## Warning: 程辑包'patchwork'是用R版本4.3.2 来建造的
plot_UV = ggplot(data_UV, aes(days, value, fill = group)) + geom_line(aes(color = group), linewidth = 0.6) + geom_point(size = 5, shape = 21, alpha = 0.9) + geom_errorbar(aes(ymin=value-SD, ymax=value+SD), color = 'black', linewidth = 0.4, width = 1 ) + facet_grid(.~parameter) + theme_bw() + theme(strip.text = element_text(colour = 'black', size = 18, face = 'bold'), axis.text.y = element_text(colour = 'black', size = 14), axis.text.x = element_text(colour = 'black', size = 14), axis.title = element_text(colour = 'black', size = 18), axis.ticks.length = unit(1.2, 'mm'), panel.border = element_rect(linewidth = 0.8), legend.title = element_blank(), legend.text = element_text(colour = 'black', size = 14)) + scale_fill_manual(values = c('#a6cee3', '#b2df8a', '#fdbf6f', '#cab2d6')) + scale_color_manual(values = c('#a6cee3', '#b2df8a', '#fdbf6f', '#cab2d6')) + xlab('Time (h)') + ylab('DOC (mg/L)') + scale_y_continuous(limits = c(0, 15), expand = c(0, 0.03), breaks = c(0, 3, 6, 9, 12, 15), labels = c(0, 3, 6, 9, 12, 15)) + scale_x_continuous(expand = c(0, 3)) + theme(panel.grid.minor.x = element_blank(), legend.position = 'none')
plot_sal = ggplot(data_sal, aes(days, value, fill = group)) + geom_line(aes(color = group), linewidth = 0.6) + geom_point(size = 5, shape = 21, alpha = 0.9) + geom_errorbar(aes(ymin=value-SD, ymax=value+SD), color = 'black', linewidth = 0.4, width = 1 ) + facet_grid(.~parameter) + theme_bw() + theme(strip.text = element_text(colour = 'black', size = 18, face = 'bold'), axis.text.y = element_text(colour = 'black', size = 14), axis.text.x = element_text(colour = 'black', size = 14), axis.title = element_text(colour = 'black', size = 18), axis.ticks.length = unit(1.2, 'mm'), panel.border = element_rect(linewidth = 0.8), legend.title = element_blank(), legend.text = element_text(colour = 'black', size = 14)) + scale_fill_manual(values = c('#a6cee3', '#b2df8a', '#fdbf6f', '#cab2d6')) + scale_color_manual(values = c('#a6cee3', '#b2df8a', '#fdbf6f', '#cab2d6')) + xlab('Time (h)') + ylab('DOC (mg/L)') + scale_y_continuous(limits = c(0, 15), expand = c(0, 0.03), breaks = c(0, 3, 6, 9, 12, 15), labels = c(0, 3, 6, 9, 12, 15)) + scale_x_continuous(expand = c(0, 3)) + theme(panel.grid.minor.x = element_blank(), legend.position = 'none')
plot_T = ggplot(data_T, aes(days, value, fill = group)) + geom_line(aes(color = group), linewidth = 0.6) + geom_point(size = 5, shape = 21, alpha = 0.9) + geom_errorbar(aes(ymin=value-SD, ymax=value+SD), color = 'black', linewidth = 0.4, width = 1 ) + facet_grid(.~parameter) + theme_bw() + theme(strip.text = element_text(colour = 'black', size = 18, face = 'bold'), axis.text.y = element_text(colour = 'black', size = 14), axis.text.x = element_text(colour = 'black', size = 14), axis.title = element_text(colour = 'black', size = 18), axis.ticks.length = unit(1.2, 'mm'), panel.border = element_rect(linewidth = 0.8), legend.title = element_blank(), legend.text = element_text(colour = 'black', size = 14)) + scale_fill_manual(values = c('#a6cee3', '#b2df8a', '#fdbf6f', '#cab2d6')) + scale_color_manual(values = c('#a6cee3', '#b2df8a', '#fdbf6f', '#cab2d6')) + xlab('Time (h)') + ylab('DOC (mg/L)') + scale_y_continuous(limits = c(0, 15), expand = c(0, 0.03), breaks = c(0, 3, 6, 9, 12, 15), labels = c(0, 3, 6, 9, 12, 15)) + scale_x_continuous(expand = c(0, 3)) + theme(panel.grid.minor.x = element_blank(), legend.position = 'right')
plot_UV | plot_sal | plot_T
ggsave('test.pdf', dpi = 1200, height = 4, width = 12)
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## 'mbcsToSbcs'里转换'Temperature-35℃'出错:<e2>代替了dot
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## 'mbcsToSbcs'里转换'Temperature-35℃'出错:<84>代替了dot
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## 'mbcsToSbcs'里转换'Temperature-35℃'出错:<83>代替了dot
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## 'mbcsToSbcs'里转换'Temperature-35℃'出错:<e2>代替了dot
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## 'mbcsToSbcs'里转换'Temperature-35℃'出错:<84>代替了dot
## Warning in grid.Call(C_textBounds, as.graphicsAnnot(x$label), x$x, x$y, :
## 'mbcsToSbcs'里转换'Temperature-35℃'出错:<83>代替了dot
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## 'mbcsToSbcs'里转换'Temperature-35℃'出错:<e2>代替了dot
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## 'mbcsToSbcs'里转换'Temperature-35℃'出错:<84>代替了dot
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## 'mbcsToSbcs'里转换'Temperature-35℃'出错:<83>代替了dot
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## 'mbcsToSbcs'里转换'Temperature-35℃'出错:<e2>代替了dot
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## 'mbcsToSbcs'里转换'Temperature-35℃'出错:<84>代替了dot
## Warning in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, :
## 'mbcsToSbcs'里转换'Temperature-35℃'出错:<83>代替了dot