Load library and data:
Code
library(ggplot2)
bikes <- readr::read_csv("https://raw.githubusercontent.com/z3tt/graphic-design-ggplot2/main/data/london-bikes-custom.csv",
col_types = "Dcfffilllddddc"
)
bikes$season <- forcats::fct_inorder(bikes$season)
Playing with aesthetics, scales, facets, and coordinates:
Code
ggplot(bikes, aes(x=temp_feel, y=count)) +
geom_point(aes(color = day_night,
shape = is_workday),
size=1.5) +
geom_smooth()
`geom_smooth()` using method = 'gam' and formula = 'y ~ s(x, bs = "cs")'
Code
ggplot(bikes, aes(x=temp_feel, y=count, color = day_night)) +
geom_point(aes(shape = is_workday),
size=1.5) +
geom_smooth() +
facet_wrap(~is_workday) +
coord_flip()
`geom_smooth()` using method = 'loess' and formula = 'y ~ x'
Code
ggplot(bikes, aes(x=count, y=temp_feel, color = day_night)) +
geom_point(aes(shape = is_workday),
size=1.5) +
geom_smooth() +
facet_wrap(~is_workday)
`geom_smooth()` using method = 'loess' and formula = 'y ~ x'