## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
## 
## 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
fig <- plot_ly(
  data = coffee_data,
  x = ~altitude_mean_meters,
  y = ~total_cup_points,
  type = 'scatter',
  mode = 'markers',
  color = ~species,  # Color by species
  marker = list(size = 10),
  text = ~paste(
    "Owner:", owner, "<br>",
    "Species:", species, "<br>",
    "Harvest Year:", harvest_year
  ),
  hoverinfo = "text"
)

fig <- fig %>%
  layout(
    title = "Total Cup Points vs. Altitude (Filtered by Species)",
    xaxis = list(title = "Mean Altitude (meters)"),
    yaxis = list(title = "Total Cup Points"),
    showlegend = TRUE
  )

fig
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels
## Warning in RColorBrewer::brewer.pal(N, "Set2"): minimal value for n is 3, returning requested palette with 3 different levels