I spent hours looking at the documentation and StackOverflow, but it seems that not a single solution has solved my problem. When using ggplot I cannot get the correct text in the legend, even if it is in my data frame. I tried scale_colour_manual , scale_fill_manual with different values ββfor labels= such as c("T999", "T888")", "cols" .
Here is my code:
T999 <- runif(10, 100, 200) T888 <- runif(10, 200, 300) TY <- runif(10, 20, 30) df <- data.frame(T999, T888, TY) ggplot(data = df, aes(x=T999, y=TY, pointtype="T999")) + geom_point(size = 15, colour = "darkblue") + geom_point(data = df, aes(x=T888, y=TY), colour = 'red', size = 10 ) + theme(axis.text.x = element_text(size = 20), axis.title.x =element_text(size = 20), axis.text.y = element_text(size = 20)) + xlab("Txxx") + ylab("TY [Β°C]") + labs(title="temperatures", size = 15) + scale_colour_manual(labels = c("T999", "T888"), values = c("darkblue", "red")) + theme(legend.position="topright")
Help will be much appreciated!
text r ggplot2 label
user3633161 May 13 '14 at 15:36 2014-05-13 15:36
source share