library(ggplot2)
library(dplyr)
library(plotly)
library(lubridate)
library(plyr)
library(paletteer)
df <- baseball
plots <- ggplot(df, aes(h, rbi, colour = team, frame = year)) +
geom_point(size = 3, show.legend = FALSE) +
theme(legend.position='none')+
scale_color_paletteer_d("palettesForR::MATLAB")+
# facet_wrap(~lg)+
labs(x="",
y="")
ggplotly(plots, height = 500, width = 500) %>%
animation_opts(frame = 200,
easing = "linear",
redraw = FALSE)