Sliders <- ggplot(Sales_Profit, aes(x=GrossProfit/1000000,
y=Revenue/1000000,
color = Country, size = Margin,
alpha = 0.00001)) +
geom_point(aes(frame = Year)) +
scale_x_continuous()+
labs (x= 'Profit (million)',
y = ' Revenue (million) ',
title = 'Revenue & Profit 2012-2014',
legend ="Country",
size = " ",
alpha = "")+
theme(panel.background = element_rect(fill = "white", colour = "grey50"),
panel.grid.major = element_line(colour = "grey50"),
plot.margin = margin(0, 0, 3, 2, "cm"))
## Warning: Ignoring unknown aesthetics: frame
ggplotly(Sliders, session = 'knitr') %>%
animation_opts(1000, easing = "elastic", redraw = FALSE) %>%
animation_slider( currentvalue = list(prefix = "YEAR ", font = list(color="violet")))
## We recommend that you use the dev version of ggplot2 with `ggplotly()`
## Install it with: `devtools::install_github('hadley/ggplot2')`