How to set plotly chart to have a transparent background in R?

前端 未结 2 1128
情话喂你
情话喂你 2021-02-07 21:32

Here\'s what I have, so far:

f1 <- list(
   family = \"Arial, sans-serif\",
   size = 25,
   color = \"white\"
)
f2 <- list(
   family = \"Old Standard TT,         


        
相关标签:
2条回答
  • 2021-02-07 21:57

    I find toy need to use rgba AND fig_bgcolor in layout

    plt %>%
        layout(plot_bgcolor  = "rgba(0, 0, 0, 0)",
               paper_bgcolor = "rgba(0, 0, 0, 0)",
               fig_bgcolor   = "rgba(0, 0, 0, 0)")
    
    0 讨论(0)
  • 2021-02-07 22:09

    Just try:

    salesplot <-plot_ly(producersales, type="scatter", x=Producer, y=SalesPerSong, color=SongRange, colors=cols, mode="markers", size=SalesPerSong) %>% 
    layout(xaxis = a, yaxis = a) %>% 
    layout(plot_bgcolor='rgb(254, 247, 234)') %>% 
    layout(paper_bgcolor='rgb(254, 247, 234)') #will also accept paper_bgcolor='black' or paper_bgcolor='transparent'
    

    You can change the rgb numbers to fit your needs.

    0 讨论(0)
提交回复
热议问题