# Load necessary packages
library(ggplot2)
library(gsheet)
library(plotly)
##
## 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
# Import data
ranking <- gsheet2tbl("https://docs.google.com/spreadsheets/d/1Ap5h86minzUi-wOqE9SREHGCa_nGTDPspa7V5WFDnEI/edit#gid=408435445")
## No encoding supplied: defaulting to UTF-8.
NAMES <- c("Date", "Name", "Time", "Experience",
"Controller", "Course", "CC", "Items Used",
"Character", "Coins", "Switch", "Place")
names(ranking) <- NAMES
# Scatterplot
p <- ggplot(ranking, aes(x = Time, y = Experience)) +
geom_point(color = "#00843D", size = 3) + # Red for Mario
geom_smooth(method = "lm", color = "#DC291E", se = FALSE) + # Green for Luigi
scale_y_continuous(limits = c(1, 10)) +
scale_x_continuous(limits = c(150, 250)) +
labs(x = "Time (Seconds)", y = "Experience") +
theme_minimal()
# Convert to interactive plot
ggplotly(p)
## `geom_smooth()` using formula = 'y ~ x'