Какая функция может заменить сюжетную? - PullRequest
0 голосов
/ 23 апреля 2020

Кто-нибудь знает функцию для замены сюжетной?

Я хочу составить график случаев и смертей, вызванных коронавирусом. Я нашел код, который использует плотно, но я хотел бы сохранить график в PDF-файл. Есть ли функция замены?

Это часть кода:

plotly::plot_ly(data = df, 
                x = ~ country, 
                y = ~ unrecovered, 
                # text =  ~ confirmed, 
                # textposition = 'auto',
                type = "bar", 
                name = "Active",
                marker = list(color = active_color)) %>%
  plotly::add_trace(y = ~ recovered, 
                    # text =  ~ recovered, 
                    # textposition = 'auto',
                    name = "Recovered",
                    marker = list(color = recovered_color)) %>%
  plotly::add_trace(y = ~ death, 
                    # text =  ~ death, 
                    # textposition = 'auto',
                    name = "Death",
                    marker = list(color = death_color)) %>%
  plotly::layout(title = "Distribution by type",
                 barmode = 'stack',
                 yaxis = list(title = "Total Cases (log scaled)",
                              type = "log"),
                 xaxis = list(title = paste("Last update:", format(max(coronavirus::coronavirus$date), '%d %B'), sep = " ")),
                 hovermode = "compare",
                 annotations = list(
                   text = paste("Last update:", format(max(coronavirus::coronavirus$date), '%d %B'), sep = " "),
                   xref = "paper",
                   yref = "paper",
                   showarrow = FALSE,
                  x = 0.95,
                  y = 1
                 ),
                 margin =  list(
                   # l = 60,
                   # r = 40,
                   b = 10,
                   t = 10,
                   pad = 2))
...