Plotly for 3d and interactive plots in R
table
stargazer
package
1 Setup
2 Interactive plots with Plotly
Code
p <- starwars |>
drop_na(height, mass, eye_color) |>
filter(mass < 250,
eye_color %in% c("blue", "brown", "black", "pink", "red", "orange")) |>
ggplot(aes(height, mass, color = eye_color)) +
geom_point() +
geom_jitter(size = 6,
alpha = .5) +
scale_colour_manual(values = c("blue" = "blue",
"brown" = "brown",
"black" = "black",
"pink" = "pink",
"red" = "red",
"orange" = "orange")) +
theme_bw() +
theme(legend.position = c(0.05, 0.98),
legend.justification = c("left", "top")) +
labs(title = "Height, mass and eye color of Star Wars characters",
x = "Height",
y = "Mass",
color = "Eye color")
ggplotly(p)