我从aes中打印了一些东西,即"alpha“和"Continent",我不知道为什么是这样的。请帮我删除它!
查看右上角的->

ggplot的部分代码:
server <- function(input, output) {
observe({
output$plot1 <- renderPlotly({
p <- ggplot(df1(), aes(x = df1()[,4], y = Happiness.Score))
p <- p + geom_point(size = 2, aes(text = paste("Country:", df1()[,1]), color = Continent, alpha = 0.85)) +
labs(title = "How happy is the country?", x = names(df1())[4], y = "Happiness Score") +
theme_light(base_size = 12) + ylim(2,8)
ggplotly(p, tooltip = c("text", "y"))
})
})发布于 2019-02-21 17:58:16
Continent是图例标题。要更改它,您可以执行以下操作:
...... + scale_color_discrete(name = "MY_LEGEND_TITLE")要删除alpha,请将其设置在aes之外
geom_point(aes(text = paste("Country:", df1()[,1]), color = Continent),
size = 2, alpha = 0.85)https://stackoverflow.com/questions/54803398
复制相似问题