RWEP/SD/20240328_4_实践部分/index.qmd

100 lines
1.5 KiB
Plaintext

---
title: "数据前处理+ggplot2画图实践"
subtitle: 《区域水环境污染数据分析实践》<br>Data analysis practice of regional water environment pollution
author: 苏命、王为东<br>中国科学院大学资源与环境学院<br>中国科学院生态环境研究中心
date: today
lang: zh
format:
revealjs:
theme: dark
slide-number: true
chalkboard:
buttons: true
preview-links: auto
lang: zh
toc: true
toc-depth: 1
toc-title: 大纲
logo: ./_extensions/inst/img/ucaslogo.png
css: ./_extensions/inst/css/revealjs.css
pointer:
key: "p"
color: "#32cd32"
pointerSize: 18
revealjs-plugins:
- pointer
filters:
- d2
---
```{r}
#| echo: false
knitr::opts_chunk$set(echo = TRUE)
source("../../coding/_common.R")
library(tidyverse)
```
## 数据说明
```{r}
mpg
```
## 完成图1
```{r}
#| echo: false
mpg |>
ggplot(aes(x = displ, y = hwy, color = class)) +
geom_point()
```
## 完成图2
```{r}
#| echo: false
ggplot(mpg, aes(x = displ, y = hwy, color = drv)) +
geom_point() +
geom_smooth(aes(linetype = drv))
```
## 完成图3
```{r}
#| echo: false
ggplot(mpg, aes(x = displ, y = hwy)) +
geom_point(aes(color = class)) +
geom_smooth()
```
## 完成图4
```{r}
#| echo: false
ggplot(mpg, aes(x = displ, y = hwy)) +
geom_point() +
facet_wrap(~cyl)
```
## 完成图5
```{r}
#| echo: false
ggplot(mpg, aes(x = drv, fill = class)) +
geom_bar(position = "fill")
```
## 综合实践:三维荧光数据处理