How to set plotly chart to have a transparent background in R?
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.
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)")