R language drawing-add mathematical expressions and R2

R language drawing-add mathematical expressions and R2

code show as below:

filepath <- file.choose()
df1 <- read.csv(filepath, header = T)
df1
library(ggplot2)

QTs <- ggplot(data = df1, aes(x = Ts, y = Q10, shape = factor)) + 
  geom_point(size = 3) +
  scale_shape_manual(values = c(1, 17)) +
#白天的拟合曲线(实线)
  stat_function(fun = function(x)1.5015*exp(x*(-0.009)), 
                color = "black", size = 1) +
#晚上的拟合曲线(虚线)
  stat_function(fun = function(x)1.4864*exp(x*(-0.009)), 
                color = "black", size = 1, linetype = "dashed") +
  annotate("text", x = 20, y = 2, parse = TRUE, label = "y == 1.5015*e^{-0.009*x}", size = 4) +
  annotate("text", x = 20, y = 1.93, label = "atop(R^2==0.3174)", parse = TRUE) + 
  theme(panel.grid.major = element_blank(), 
       panel.grid.minor = element_blank(),
       panel.background = element_blank(), 
       axis.line = element_line(colour = "black"),
       panel.border = element_rect(colour = "black", fill = NA),
       legend.position = "none") +
  xlab("Soil temperature") 
  
QTs

As shown in the figure: screenshot part of the picture
Insert picture description here

supplement

Yesterday, Sao Fan honorably retired.

Insert picture description here

The new cup is here!

Insert picture description here

Guess you like

Origin blog.csdn.net/m0_46461702/article/details/112424870