如何更改ggplot geom_point上的图例标签?

时间:2019-02-04 14:02:34

标签: r ggplot2 legend

enter image description here我无法更改ggplot + geom_point的标签。我尝试了多个scale_shape_xxx / scale_fill_xxx,但无济于事。我想将标签更改为“ n = 20”和“ n = 50”。

library(tidyr)
library(ggplot2)

df <- data.frame(m_index, data_frame_20, data_frame_50) 
df_long <- gather(df, legend, value, -m_index)
ggplot(df_long, aes(x = m_index, y = value, colour = legend)) + geom_point() + 
labs(x = "Values of m", y = " Probability of Maximum Absolute Correlation ", 
     title = "Dot plot of probability") +
scale_shape_manual(name = 'Legend', labels = c('n = 20', 'n = 50')) 

0 个答案:

没有答案
相关问题