[英]remove fill color levels from a ggplotly legend
有沒有辦法從ggplotly
圖例中刪除填充顏色,因為它與刻面是多余的? 換句話說,我確實有四種組合,但我只想在圖例中顯示 alpha 的級別,因為分面告訴您與填充值相同的信息。 我不需要解釋紅色和綠色的含義,因為紅色只適用於 facet group3==0
而綠色只適用於 facet group3==1
。
---
title: "Example"
runtime: shiny
output:
flexdashboard::flex_dashboard:
vertical_layout: fill
---
```{r}
library(tidyverse)
library(plotly)
library(flexdashboard)
```
### Chart 1
```{r}
f <- list(family = "Poppins")
a <- list(tickfont = f)
p <- fortify(forecast::gold) %>%
mutate(group1 = sample(0:1, n(), replace=TRUE),
group2 = sample(0:1, n(), replace=TRUE),
group3 = sample(0:1, n(), replace=TRUE)
) %>%
ggplot(., aes(factor(group1), y, alpha=factor(group2), fill=factor(group3))) +
geom_col() +
scale_alpha_manual(values = c(.5, 1)) +
facet_wrap(~group3)
ggplotly(p)
```
我從谷歌來到這里是因為當ggplotly()
時,給出了一個沒有圖例的ggplotly()
。
如果影響其他人,答案是,使用:
theme(legend.position='none')
正如情節理解的那樣。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.