library(plotly)
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
# Example data
df <- data.frame(
year = 2015:2024,
crashes = c(120, 135, 150, 142, 160, 170, 165, 180, 190, 210)
)
plot_ly(
data = df,
x = ~year,
y = ~crashes,
type = "scatter",
mode = "lines+markers"
) |>
layout(
title = "Example Interactive Plotly Chart",
xaxis = list(title = "Year"),
yaxis = list(title = "Number of Crashes")
)