2016-05-22 33 views
5

Ecco quello che ho, finora:Come impostare un grafico grafico per avere uno sfondo trasparente in R?

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) 

Ho provato ad aggiungere paper_bgcolor=#00000000, plot_bgcolor=#00000000 dopo la xey informazioni asse entro layout(), ma quando faccio funzionare l'ordine, ottengo il segno più. Non so cosa fare, quindi ogni aiuto è apprezzato. Grazie!

risposta

8

Basta provare:

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' 

È possibile modificare i numeri RGB base alle proprie esigenze.

Problemi correlati