Я создал сюжет с помощью ggplot2 и хочу опубликовать его в моем приложении Shiny с помощью plottly.К сожалению, положение легенды не принято.Кроме того, 1 добавляется к каждой записи в легенде, и заголовок сюжета исчезает.
Часть моего сюжета
plot = ggplot() +
geom_bar(data = pi_plot, aes(x = as.Date(Month), y = value, fill = Domain), position = "stack", stat = "identity") +
geom_line(data = pi_fc_ly_plot, aes(x = as.Date(Month), y = value, group = PI, colour = PI), size = 0.75) +
theme(legend.title = element_blank()) +
labs(title = "Traffic",
subtitle = "Visits",
y = "Pageviews",
x = "Month",
caption = "Source: Google Analytics") +
scale_x_date(labels = date_format("%B"),
date_breaks = "month",
expand = c(0, 0)) +
scale_y_continuous(legend.position = "bottom")
Вызов сюжета в приложении
ggplotly(plot)