Ggplot2

R ggplot2 绘图二

Last update: 2021-02-09 See https://www.cedricscherer.com/2019/08/05/a-ggplot2-tutorial-for-beautiful-plotting-in-r/#panels. Table of Content Preparation The Dataset Default ggplot Pipeline operator Preparation The Dataset chic <- readr::read_csv("https://raw.githubusercontent.com/Z3tt/R-Tutorials/master/ggplot2/chicago-nmmaps.csv") tibble::glimpse(chic) load ggplot2 package Default ggplot library(tidyverse) ggplot(chic, aes(x = date, y = temp)) + geom_point(color = "firebrick") + labs(x = "Year", y = expression(paste("Temperature (", degree ~ F, ")"^"(Hey, why should we use metric units?!)"))) library(tidyverse) chic_high <- dplyr::filter(chic, temp > 25, o3 > 20) ggplot(chic_high, aes(x =