簡體   English   中英

ggplotly 中的 Aes

[英]Aes in ggplotly

ggplotly 從 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"))
    })
  })

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)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM