2016-05-22 5 views
5

Hier ist, was ich habe, so weit:Wie wird Plot-Diagramm so eingestellt, dass es einen transparenten Hintergrund in R hat?

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) 

Ich versuchte paper_bgcolor=#00000000, plot_bgcolor=#00000000 nach den x- und y-Achse Informationen innerhalb layout() Zugabe, aber wenn ich den Befehl ausführen, bekomme ich auf das Pluszeichen. Ich weiß nicht, was zu tun ist, also wird jede Hilfe geschätzt. Vielen Dank!

Antwort

8

Versuche mal:

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' 

Sie können die RGB-Nummern ändern, um Ihre Bedürfnisse anzupassen.