-
Notifications
You must be signed in to change notification settings - Fork 0
/
aula4.qmd
57 lines (47 loc) · 1.12 KB
/
aula4.qmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
title: "Aula4"
author: "ARLAM"
format: html
editor_options:
chunk_output_type: console
---
# No ggplot2, os gráficos são construídos camada por camada (ou, layers, em inglês).
## Importa dados
```{r}
library(tidyverse)
library(readxl)
curve<-read_excel("C:dados-diversos.xlsx", "curve")
```
## Gráficos
```{r}
curve |>
ggplot(aes(Irrigation, severity,
shape = Irrigation))+
geom_point(alpha = 0.5)
```
```{r}
curve2 <- curve |>
select(day, rep, severity) |>
group_by(day) |>
summarize(sev = mean(severity))
```
```{r}
curve2 |>
ggplot(aes(day, sev*100))+
geom_line(color = "darkorange")+
geom_point(size = 3,
color = "darkorange")+
scale_x_continuous(breaks = c(0,7, 14, 21, 28, 35, 42, 49, 56, 63))+
scale_y_continuous(n.breaks = 5,
limits = c(0,100))+
labs(x = "Time (days)",
y = "Severity (%)",
title = "My first disease progress curve",
subtitle = "Using ggplot",
caption = "Source: FIP 606")+
theme_light()
ggsave("figures/myfirstggplot.png",
bg = "white",
width = 4,
height = 3)
```