library(ggplot2)
library(plotly)

car_plot <- ggplot(mtcars, aes(x = wt, y = qsec, color = factor(cyl))) +
  geom_point(size = 3, shape = 15) +
  labs(
    title = "Car Weight vs Quarter-Mile Time",
    subtitle = "Colored by Number of Cylinders",
    x = "Weight (1000 lbs)",
    y = "Quarter-Mile Time (seconds)",
    caption = "Source: mtcars dataset"
  ) +
  theme_minimal()

# Interactive version
car_plot_interactive <- ggplotly(car_plot)
car_plot_interactive
library(ggplot2)
library(plotly)

# Reverse axes: qsec on x-axis, wt on y-axis
reversed_car_plot <- ggplot(mtcars, aes(x = qsec, y = wt, color = factor(cyl))) +
  geom_point(size = 3, shape = 15) +
  labs(
    title = "Quarter-Mile Time vs Car Weight",
    subtitle = "Colored by Number of Cylinders",
    x = "Quarter-Mile Time (seconds)",
    y = "Weight (1000 lbs)",
    caption = "Source: mtcars dataset"
  ) +
  theme_minimal()

# Convert to interactive
reversed_car_plot_interactive <- ggplotly(reversed_car_plot)
reversed_car_plot_interactive