Hello, I have data of age (X) and species richness per sample (y). I made a glmm and would like to know how to write the equation correctly in figure in R. Does anyone have any website / paper to indicate?
Obg,
Hello, I have data of age (X) and species richness per sample (y). I made a glmm and would like to know how to write the equation correctly in figure in R. Does anyone have any website / paper to indicate?
Obg,
There are several ways to include the equation in the figure, depending on how you are plotting the graph. Here are some examples, if you would like a more specific answer to your problem, please enter the code you created.
Using plot
:
x<- runif(1000, min = 0, max=5)
y<- pi + x^2
plot(x, y, main= expression(Gráfico ~ da ~ Equação ~ pi + x^2))
Usingggplot
:
library(ggplot2)library(ggpmisc)dados<-data.frame(x=c(1:100))dados$y<-pi+dados$x^2+rnorm(100,sd=500)minha.formula<-y~xggplot(data=dados,aes(x=x,y=y))+geom_point()+geom_smooth(method="glm", se=FALSE, color="blue", formula = minha.formula) +
stat_poly_eq(formula = minha.formula,
eq.with.lhs = "italic(hat(y))~'='~",
aes(label = paste(..eq.label.., ..rr.label.., ..AIC.label.., sep = "*plain(\",\")~")),
parse = TRUE) +
labs(title= expression(Gráfico ~ da ~ Equação: ~ pi +x^2))
Generate the figure:
I hope I have helped:)