Aula de analise de dados - Criando Gráficos

Professor Adriano

Aluna: Luzileide

Rio de Janeiro, 15 de novembro.

Instalando o programa

library(dplyr) library(ggplot2)

library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(ggplot2)

Histogramas de ventos (wind) no decorrer dos anos anteriores a 2021.

storms %>%
  filter(year > 2012) %>%
ggplot() +
  geom_histogram(aes(wind), bins = 15) +
  facet_wrap(~ year) +
  theme_light()

Gráfico de linha

storms_processado <- storms %>%
  group_by(month) %>%
  summarise(media_pressao = mean(pressure, na.rm = TRUE))
print(storms_processado)
## # A tibble: 10 × 2
##    month media_pressao
##    <dbl>         <dbl>
##  1     1          992.
##  2     4          998.
##  3     5         1004.
##  4     6         1002.
##  5     7         1001.
##  6     8          996.
##  7     9          990.
##  8    10          991.
##  9    11          992.
## 10    12          998.

Histograma - é um gráfico de barras onde controlo os intervalos das barras no eixo x. No caso, defini 15 barras, bins = 15.

ggplot(storms) +
    aes(wind) +
    geom_histogram(bins = 15, color = "green", fill = "blue")

Gráfico de colunas - desenha um gráfico de colunas com 2 variáveis, x, y.

ggplot(storms) +
  aes(year, wind, color = year) +
  geom_col() 

Gráfico de calor

ggplot(storms) +
  aes(year, wind, color = category, size = wind) +
  geom_point()