我无法更改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'))