14

到目前为止,这是我所拥有的:

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

)
a <- list(
   title = "SALES PER SONG",
   titlefont = f1,
   showgrid = FALSE,
   showticklabels = TRUE,
   showline=TRUE,
   tickangle = 45,
   tickfont = f2
  )

 salesplot <-plot_ly(producersales, type="scatter", x=Producer, y=SalesPerSong, color=SongRange, colors=cols, mode="markers", size=SalesPerSong) %>% 
layout(xaxis = a, yaxis = a)

我尝试paper_bgcolor=#00000000, plot_bgcolor=#00000000在 x 和 y 轴信息之后添加layout(),但是当我运行命令时,我得到了加号。我不知道该怎么做,所以任何帮助表示赞赏。谢谢!

4

2 回答 2

29

试试看嘛:

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'

您可以更改 rgb 数字以满足您的需要。

于 2016-05-22T23:11:10.163 回答
3

我发现玩具需要在布局中使用 rgba 和 fig_bgcolor

plt %>%
    layout(plot_bgcolor  = "rgba(0, 0, 0, 0)",
           paper_bgcolor = "rgba(0, 0, 0, 0)",
           fig_bgcolor   = "rgba(0, 0, 0, 0)")
于 2020-04-23T15:08:10.853 回答