praticas/09-plotly.R

library(dados)
library(tidyverse)
library(plotly)

p <- dados_starwars |>
  filter(massa < 1000) |>
  ggplot() +
  aes(x = massa, y = altura, colour = genero) +
  geom_point() +
  geom_smooth(aes(group = 1)) +
  theme(
    legend.position = "bottom"
  )

p

ggplotly(p) |>
  layout(
    legend = list(orientation = 'h')
  )

dados_starwars |>
  filter(massa < 1000) |>
  plot_ly(x = ~massa, y = ~altura)
curso-r/202204-visualizacao documentation built on June 15, 2022, 3:16 p.m.