Closed sfd99 closed 2 years ago
Hi, sfd99
Thanks for your comments. In the ggtrendline package,
the arguments 'eq.x' and 'eq.y' are for the equation position,
and the arguments 'rrp.x' and 'rrp.y' are for the R^2 and P-vlaue position.
Try the following codes:
library(ggplot2)
library(ggtrendline)
x <- iris$Petal.Width
y <- iris$Petal.Length
group <- iris$Species
ggtrendline(x, y, "exp3P", eSize = 5, eq.x = 1, eq.y = 6.5, rrp.x = 1, rrp.y = 5.8) +
geom_point(aes(x, y, color = group))
Best regards
Perfect, Weiping!.
I guess my [Plot Panel] in Rstudio was sized too small, so the EQ and R2 lines were "cut-off" and I was losing some of that text...
Works great now!.
Thank you / 谢谢你
PS:
in addition to params: xlab and ylab , would also be nice to add a label parameter (glab ?) for the "group" LEGEND label, (shown on the right of the plot).
So you could add : glab="Species" for the iris example :-)
SFd99 San Francisco ggtrendline PKG v 1.0.3 latest version of R, RStudio and Ubuntu LINUX 20.04.
Thank you.
The legend title could be modified as follows:
library(ggtrendline)
library(ggplot2)
x <- iris$Petal.Width
y <- iris$Petal.Length
group <- iris$Species
ggtrendline(x, y, "exp3P", eSize = 5, eq.x = 1, eq.y = 6.5, rrp.x = 1, rrp.y = 5.8) +
geom_point(aes(x, y, color = group))+
labs(color = "DIY legend")
ggtrendline(x, y, "exp3P", eSize = 5, eq.x = 1, eq.y = 6.5, rrp.x = 1, rrp.y = 5.8) +
geom_point(aes(x, y, color = group))+
guides(color = guide_legend(title = "DIY2"))
library(ggtrendline)
library(ggplot2)
x <- iris$Petal.Width
y <- iris$Petal.Length
Species <- iris$Species
ggtrendline(x, y, "exp3P", eSize = 5, eq.x = 1, eq.y = 6.5, rrp.x = 1, rrp.y = 5.8) +
geom_point(aes(x, y, color = Species))
library(ggtrendline)
library(ggplot2)
x <- iris$Petal.Width
y <- iris$Petal.Length
group <- iris$Species
ggtrendline(x, y, "exp3P", eSize = 5, eq.x = 1, eq.y = 6.5, rrp.x = 1, rrp.y = 5.8,
xlab = "DIY xname", ylab = "DIY yname") +
geom_point(aes(x, y, color = group))+
labs(color = "DIY legend")
Best regards
Ah, understood. Thank you, Weiping.
ggtrendline PKG is truly very good.
SFd99 San Francisco ggtrendline PKG v 1.0.3 latest version of R, RStudio and Ubuntu LINUX 20.04.
Hi Weiping,
Really like the ggtrendline PKG. Easy to use and very helpful !.
The EQ text line and the R2 text line are by default very small and hard to read.
I was able to make the text font bigger,, using the eSize parameter = 5.
Q: How to position the EQ text line and the R2 text line more to the center of the plot?.
Right now, these 2 important text lines are almost "cut-off" on the left side of the plot...
I'd like to move them horizontally, a little to the right of the plot. ===>
Here's my test code, with the larger font...eSize=5
Help, Weiping!
SFd99 San Francisco ggtrendline PKG v 1.0.3 latest version of R, RStudio and Ubuntu LINUX 20.04.