---
title: "Homework 6"
format:
  typst:
    fig-format: png
    fig-dpi: 300
    fig-width: 6
    fig-height: 4
---

```{r}
#| echo: false
#| message: false
# !! Do not edit this code chunk !!
library(tidyverse)

# data prep:
sf_trees <- read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/master/data/2020/2020-01-28/sf_trees.csv')

tree_species <- c(
  "Tristaniopsis laurina :: Swamp Myrtle",
  "Lophostemon confertus :: Brisbane Box",
  "Magnolia grandiflora :: Southern Magnolia",
  "Pittosporum undulatum :: Victorian Box"
)

trees <- sf_trees |>
  filter(
    !is.na(date),
    !is.na(dbh),
    species %in% tree_species
  ) |>
  mutate(
    year = year(ymd(date))
  ) |>
  filter(
    year >= 1969,
    dbh < 40
  ) |>
  select(species, year, diameter = dbh)
```

**This homework is due on Apr. 3, 2025 at 11:00pm. Please submit as a pdf file on Canvas.**

We will work with the dataset `trees` that contains information about various trees in San Francisco. You can find out more about this dataset here: <https://github.com/rfordatascience/tidytuesday/blob/master/data/2020/2020-01-28/readme.md>

The dataset we will be working with here has been simplified and cleaned up and contains three columns, `species` (the tree species), `year` (the year the tree was planted), and `diameter` (the diameter of the tree, in inches).
```{r}
trees
```

For this homework, you will be visualizing this dataset. Pick any visualization you like, but use all three columns of the dataset. Appropriate visualizations may include but are not limited to scatter plots, strip charts, box plots, sina plots, density plots, histograms, or ridgeline plots.

**Problem 1: (10 pts)** Make the worst possible visualization of this dataset you can imagine. Really make it ugly. Don't hold back. For full points, you must customize the plot theme, axes, and color scales (if used).

```{r}
#| fig-width: 6
#| fig-height: 6
#| out-width: "75%"
# Add your code here
```

**Problem 2: (10 pts)** Now make the best possible visualization of this dataset you can imagine. Try your best to come up with a beautiful, polished, publication-quality visualization. For full points, you must customize the plot theme, axes, color scales (if used). Also, for full points, the plot must be legible and clear.

```{r}
#| fig-width: 6
#| fig-height: 6
#| out-width: "75%"
# Add your code here
```

