I am plotting a large number of Spearman's correlation analyses in R. I want to include the R value label in the plot, but I don't want to include the p value. The sample sizes for my actual plots are all large, so all the p values are small and their inclusion doesn't add anything useful to the plot. After creating the individual plots I am using gridExtra::grid.arrange
to combine plots and the extra label length is getting in the way (cleaner to include the information outside of the plot itself).
I've seen ways to alter the label size and position, but haven't found anything that limits or adjusts the output of the label contents. Is it possible to drop the p value from the plot in stat_cor
but keep the R? Is there another package that would allow more customization?
Here's the basic code I'm using to produce the plot.
df %>%
ggscatter(x = "Diameter", y = "Depth",
add = "reg.line", conf.int = TRUE,
title = "test",
xlab = "Diameter (m)", ylab = "Depth (m)",
shape = 21, fill = "lightgray", color = "black", size = 3) +
stat_cor(method = "spearman", label.x = 0.45, label.y = 1.2) +
coord_cartesian(ylim = c(0,1.25), xlim = c(0,0.7)) +
theme_minimal()
Here is basically the same setup using the iris
data set.
ggscatter(data = iris,x = "Sepal.Length", y = "Sepal.Width",
add = "reg.line", conf.int = TRUE,
title = "Iris test",
xlab = "Length", ylab = "Width",
shape = 21, fill = "lightgray", color = "black", size = 3) +
stat_cor(method = "spearman") +
theme_minimal()