In this report, we explore the relationship between the weight of cars (wt) and their miles per gallon (mpg) using the mtcars dataset. An interactive scatter plot is created to visualize this relationship, providing insights into how these variables correlate.
# Create the interactive scatter plotplot <-ggplot(data, aes(x = wt, y = mpg, color = cyl)) +geom_point(size =3) +labs(title ="Scatter Plot of MPG vs Weight",x ="Weight (1000 lbs)",y ="Miles per Gallon",color ="Number of Cylinders")# Convert to interactive plotly objectinteractive_plot <-ggplotly(plot)interactive_plot