library(tidyverse)
## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.2 ✓ purrr 0.3.4
## ✓ tibble 3.0.3 ✓ dplyr 1.0.2
## ✓ tidyr 1.1.2 ✓ stringr 1.4.0
## ✓ readr 2.0.1 ✓ forcats 0.5.0
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
wildfires<-readr::read_csv("https://raw.githubusercontent.com/BuzzFeedNews/2018-07-wildfire-trends/master/data/calfire_frap.csv") %>%
mutate(plot_date = as.Date(format(alarm_date,"2017-%m-%d")))
## Rows: 14847 Columns: 18
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (7): state, agency, unit_id, fire_name, inc_num, comments, fire_num
## dbl (9): objectid, year_, cause, report_ac, gis_acres, c_method, objective,...
## date (2): alarm_date, cont_date
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
library(lubridate)
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
wildfiremonth <- wildfires %>%
mutate(DayMonth = format(as.Date(plot_date), "%m-%d"))
ggplot(wildfiremonth, aes(x = plot_date, y = year_))+
geom_point()
## Warning: Removed 1617 rows containing missing values (geom_point).
ggplot(wildfiremonth, aes(x = plot_date, y= year_, size = gis_acres)) +
geom_jitter(alpha = 0.6, color = "orange")
## Warning: Removed 1623 rows containing missing values (geom_point).
### Scale Reverse
ggplot(wildfiremonth, aes(x = plot_date, y= year_, size = gis_acres)) +
geom_jitter(alpha = 0.6, color = "orange")+
scale_y_reverse()
## Warning: Removed 1623 rows containing missing values (geom_point).
### Background color and Axis Lines
ggplot(wildfiremonth, aes(x = plot_date, y= year_, size = gis_acres)) +
geom_jitter(alpha = 0.6, color = "orange")+
scale_y_reverse()+
theme(panel.background = element_rect(fill = "black"),
panel.grid = element_blank())
## Warning: Removed 1623 rows containing missing values (geom_point).
ggplot(wildfiremonth, aes(x = plot_date, y= year_, size = gis_acres)) +
geom_jitter(alpha = 0.6, color = "orange")+
scale_y_reverse()+
theme(panel.background = element_rect(fill = "black"),
panel.grid = element_blank())
## Warning: Removed 1623 rows containing missing values (geom_point).
#### Code from Heather
scale_x_continuous(“Departure time”, breaks = c(0, 6, 12, 18, 24), labels = c(“midnight”, “6am”, “noon”, “6pm”, “midnight”))