Entering edit mode
16 months ago
rene.j.erhardt
▴
30
I am stuck with what I thought was rather simple: all I want is changing the order of the 2 items in my legend in a scatterplot. Maybe my brain is in Sunday mode??? I've got 2 items in "Group" and R puts them in alphabetical order into the legend. I want them the other way round but can't work it out. Anyone got an idea?
ggscatter(df, x = "T1", y = "T0",
color="Group",palette = c("red", "blue"),
add = "reg.line", conf.int = TRUE,
add.params = list(color = "brown"),
cor.coef = TRUE, cor.method = "spearman",
cor.coef.coord = c(2.5,5),
cor.coef.size = 5,
ylim = c(0, 5),
xlab = "T1", ylab = "T0")+
scale_x_continuous(n.breaks=7) +
theme(legend.position = "right", legend.justification = "top" )+
theme(axis.line=element_line(size=1))+
theme(text = element_text(size = 13))
Yes, that you so much. Did the trick.