ggplo— title: “Visualizando personagens do StarWars” author: “Mine Çetinkaya-Rundel - tradução e adaptação: Renata Oliveira” output: tufte::tufte_html: tufte_variant: “envisioned” highlight: pygments link-citations: yes —
glimpse(starwars)
## Rows: 87
## Columns: 14
## $ name <chr> "Luke Skywalker", "C-3PO", "R2-D2", "Darth Vader", "Leia Or~
## $ height <int> 172, 167, 96, 202, 150, 178, 165, 97, 183, 182, 188, 180, 2~
## $ mass <dbl> 77.0, 75.0, 32.0, 136.0, 49.0, 120.0, 75.0, 32.0, 84.0, 77.~
## $ hair_color <chr> "blond", NA, NA, "none", "brown", "brown, grey", "brown", N~
## $ skin_color <chr> "fair", "gold", "white, blue", "white", "light", "light", "~
## $ eye_color <chr> "blue", "yellow", "red", "yellow", "brown", "blue", "blue",~
## $ birth_year <dbl> 19.0, 112.0, 33.0, 41.9, 19.0, 52.0, 47.0, NA, 24.0, 57.0, ~
## $ sex <chr> "male", "none", "none", "male", "female", "male", "female",~
## $ gender <chr> "masculine", "masculine", "masculine", "masculine", "femini~
## $ homeworld <chr> "Tatooine", "Tatooine", "Naboo", "Tatooine", "Alderaan", "T~
## $ species <chr> "Human", "Droid", "Droid", "Human", "Human", "Human", "Huma~
## $ films <list> <"The Empire Strikes Back", "Revenge of the Sith", "Return~
## $ vehicles <list> <"Snowspeeder", "Imperial Speeder Bike">, <>, <>, <>, "Imp~
## $ starships <list> <"X-wing", "Imperial shuttle">, <>, <>, "TIE Advanced x1",~
ggplot(starwars,
aes(x = height, y = mass, color = species, size=birth_year)) +
geom_point(color = "blue")
## Warning: Removed 51 rows containing missing values (geom_point).
ggplot(starwars,
aes(x = height, y = mass, color = as.factor(gender), size = birth_year)) +
geom_point() +
labs(
title = "Título do Gráfico",
x = "altura",
y = "massa",
size = "Idade"
)
## Warning: Removed 51 rows containing missing values (geom_point).
(Um pouco de código inicial é fornecido abaixo, e o chunk é definido para não ser rodado com eval = FALSE porque o código atual ali não é válido e, portanto, o documento não permitia o knit. Uma vez substituído o código por um código válido, defina a opção “eval = TRUE”, ou remova a opção “eval” por completo, uma vez que está definida como “TRUE” por padrão).
ggplot(starwars, aes(gender)) +
geom_bar()
(Desta vez nenhum código inicial é fornecido, você está por sua conta!)
ggplot(starwars, aes(height)) +
geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 6 rows containing non-finite values (stat_bin).
ggplot(starwars,
aes(x = height, y = mass, color = as.factor(gender), size = birth_year)) +
geom_polygon()
labs(
title = "Título do Gráfico",
x = "altura",
y = "massa",
size = "Idade"
)
## $x
## [1] "altura"
##
## $y
## [1] "massa"
##
## $size
## [1] "Idade"
##
## $title
## [1] "Título do Gráfico"
##
## attr(,"class")
## [1] "labels"
ggplot(starwars,
aes(x = gender, y = species, color = as.factor(gender), size = height)) +
geom_polygon()
labs(
title = "Título do Gráfico",
x = "mundo",
y = "espécie",
size = "Idade"
)
## $x
## [1] "mundo"
##
## $y
## [1] "espécie"
##
## $size
## [1] "Idade"
##
## $title
## [1] "Título do Gráfico"
##
## attr(,"class")
## [1] "labels"
ggplot(starwars,
aes(x = mass, y = species, color = as.factor(gender), size = height)) +
geom_polygon()
labs(
title = "Título do Gráfico",
x = "massa",
y = "espécie",
size = "Idade"
)
## $x
## [1] "massa"
##
## $y
## [1] "espécie"
##
## $size
## [1] "Idade"
##
## $title
## [1] "Título do Gráfico"
##
## attr(,"class")
## [1] "labels"