@@ -115,24 +115,24 @@ library(ggthemes)
115115# But, to save space in the package so that we meet the CRAN 5mb guideline, we
116116# use a version on Github.
117117
118- url <- "https://raw.githubusercontent.com/PPBDS/r4ds.tutorials/main/data-raw/portlandtemp.csv"
119-
120- portland_data <-
121- read_csv(url,
122- col_types = cols(
123- date = col_date(format = ""),
124- tmax = col_double(),
125- tmin = col_double()
126- )
127- ) |>
128- filter(date >= as.Date("1979-01-01")) |>
129- mutate(
130- yday = lubridate::yday(date),
131- year = lubridate::year(date),
132- recent_high = if_else(tmax > 100 & year == 2021,
133- TRUE, FALSE
134- )
135- )
118+ # url <- "https://raw.githubusercontent.com/PPBDS/r4ds.tutorials/main/data-raw/portlandtemp.csv"
119+ #
120+ # portland_data <-
121+ # read_csv(url,
122+ # col_types = cols(
123+ # date = col_date(format = ""),
124+ # tmax = col_double(),
125+ # tmin = col_double()
126+ # )
127+ # ) |>
128+ # filter(date >= as.Date("1979-01-01")) |>
129+ # mutate(
130+ # yday = lubridate::yday(date),
131+ # year = lubridate::year(date),
132+ # recent_high = if_else(tmax > 100 & year == 2021,
133+ # TRUE, FALSE
134+ # )
135+ # )
136136
137137months <-
138138 tibble(
@@ -143,51 +143,51 @@ months <-
143143 )
144144 )
145145
146- portland_graph <- ggplot(
147- data = portland_data,
148- mapping = aes(
149- x = yday,
150- y = tmax
151- )
152- ) +
153- geom_point(alpha = .05, size = .9) +
154- geom_point(
155- data = filter(
156- portland_data,
157- recent_high != FALSE
158- ),
159- mapping = aes(color = "#C1392B"),
160- alpha = 1,
161- size = 2.3
162- ) +
163- guides(color = "none") +
164- scale_x_continuous(
165- breaks = months$yday,
166- labels = months$label,
167- expand = c(.01, .01)
168- ) +
169- scale_y_continuous(
170- labels = function(x) paste0(x, "°F"),
171- breaks = seq(
172- from = 20,
173- to = 120,
174- by = 20
175- )
176- ) +
177- theme_minimal() +
178- labs(
179- x = NULL,
180- y = NULL,
181- title = "Daily maximum temperatures in Portland, 1979–2021",
182- caption = "Data: National Oceanic and Atmospheric Administration via Oregon Live. \nGraphic: Cédric Scherer."
183- ) +
184- theme(
185- plot.title = element_text(face = "bold"),
186- panel.grid.minor = element_blank(),
187- panel.grid.major.x = element_blank(),
188- axis.line.x = element_line(linewidth = 0.2),
189- axis.ticks.x = element_line()
190- )
146+ # portland_graph <- ggplot(
147+ # data = portland_data,
148+ # mapping = aes(
149+ # x = yday,
150+ # y = tmax
151+ # )
152+ # ) +
153+ # geom_point(alpha = .05, size = .9) +
154+ # geom_point(
155+ # data = filter(
156+ # portland_data,
157+ # recent_high != FALSE
158+ # ),
159+ # mapping = aes(color = "#C1392B"),
160+ # alpha = 1,
161+ # size = 2.3
162+ # ) +
163+ # guides(color = "none") +
164+ # scale_x_continuous(
165+ # breaks = months$yday,
166+ # labels = months$label,
167+ # expand = c(.01, .01)
168+ # ) +
169+ # scale_y_continuous(
170+ # labels = function(x) paste0(x, "°F"),
171+ # breaks = seq(
172+ # from = 20,
173+ # to = 120,
174+ # by = 20
175+ # )
176+ # ) +
177+ # theme_minimal() +
178+ # labs(
179+ # x = NULL,
180+ # y = NULL,
181+ # title = "Daily maximum temperatures in Portland, 1979–2021",
182+ # caption = "Data: National Oceanic and Atmospheric Administration via Oregon Live. \nGraphic: Cédric Scherer."
183+ # ) +
184+ # theme(
185+ # plot.title = element_text(face = "bold"),
186+ # panel.grid.minor = element_blank(),
187+ # panel.grid.major.x = element_blank(),
188+ # axis.line.x = element_line(linewidth = 0.2),
189+ # axis.ticks.x = element_line()
190+ # )
191191
192192```
193193
0 commit comments