I want to shift the y axis labels in the ggcorrplot()
output in a way that they are placed adjacent to each circle on the right-hand side. Is this possible? I tried using +theme(axis.text.y = element_text(hjust =...)
. I want a similar output as the plots returned by the corrplot()
package.
library(ggcorrplot)
library(ggplot2)
data(mtcars)
corr<-cor(mtcars)
cortest<-cor_pmat(mtcars, sig.level = 0.05)
ggcorrplot(
corr,
p.mat = cortest,
hc.order = F,
method = "circle",
type = "lower",
outline.color = "black",
legend.title = "",
lab = TRUE,
lab_size = 2.5,
ggtheme = ggplot2::theme_void,
colors = c("#6D9EC1", "white", "#E46726")
)
Thanks.
This isn't exactly what you're requesting but one way to address the white space issue is to move the y-axis to the other side.
library(ggcorrplot)
library(ggplot2)
data(mtcars)
corr<-cor(mtcars)
cortest<-cor_pmat(mtcars, sig.level = 0.05)
ggcorrplot(
corr,
p.mat = cortest,
hc.order = F,
method = "circle",
type = "lower",
outline.color = "black",
legend.title = "",
lab = TRUE,
lab_size = 2.5,
ggtheme = ggplot2::theme_void,
colors = c("#6D9EC1", "white", "#E46726")
) + scale_y_discrete(position='right')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.