R
Marginal Histogram / Boxplot
이부일
2017. 10. 22. 20:02
install.packages("ggplot2")
install.packages("ggExtra")
library(ggplot2)
library(ggExtra)
# graphic layer 초기화
theme_set(theme_bw())
# 산점도 작성하기
g <- ggplot2::ggplot(data = cars, aes(x = speed, y = dist)) +
geom_count() +
geom_smooth(method = "lm", se = FALSE)
# Marginal Histogram
ggExtra::ggMarginal(g, type = "histogram", fill = "transparent")
# Marginal Boxplot
ggExtra::ggMarginal(g, type = "boxplot", fill = "transparent")