The selected data set is an Iris data set. The main variables are sepal length, sepal width, petal length, petal width and species.

ggplot(iris, aes(x = Petal.Length, y = Petal.Width, color = Species)) +
  geom_point(alpha = 0.5, size = 3) +
  geom_smooth(method = "lm", se = FALSE, color = "black", linetype = "dashed") +
  labs(
    title = "Petal Dimensions of All Iris Species",
    x = "Petal Length (cm)",
    y = "Petal Width (cm)"
  ) +
  theme_minimal()

library(dplyr)
library(plotly)

# Prepare data
iris_plot_data <- iris %>%
  mutate(id = row_number())


plot_ly(
  data = iris_plot_data,
  x = ~Petal.Length,
  y = ~Petal.Width,
  type = 'scatter',
  mode = 'markers',
  color = ~Species,
  colors = c('#1f77b4', '#2ca02c', '#ff7f0e'),
  text = ~paste("Sepal Length:", Sepal.Length,
                "<br>Sepal Width:", Sepal.Width,
                "<br>Petal Length:", Petal.Length,
                "<br>Petal Width:", Petal.Width,
                "<br>Species:", Species),
  hoverinfo = 'text',
  marker = list(size = 10, opacity = 0.7)
) %>%
  layout(
    title = "Interactive Petal Plot with Tooltip",
    xaxis = list(title = "Petal Length (cm)"),
    yaxis = list(title = "Petal Width (cm)"),
    legend = list(title=list(text='Species'))
  )
iris$time <- rep(1:10, each = 15)  

plot <- ggplot(iris, aes(x = Petal.Length, y = Petal.Width, color = Species, frame = time)) +
  geom_point(alpha = 0.6, size = 3) +
  labs(title = "Petal Dimensions of All Iris Species Over Time",
       x = "Petal Length (cm)", y = "Petal Width (cm)") +
  theme_minimal()

animated_plot <- plot +
  transition_time(time) +
  ease_aes('linear')

animated_plot