R기초; R 기초 - ggplot2 그래픽6 - 그래프 배치 및 저장
library(ggplot2)
libray(car)
str(Salaries)
ggplot(Salaries, aes(x=rank)) +
geom_bar(fill="steelblue")
ggplot(Salaries, aes(x=salary)) +
geom_histogram(fill="maroon")
ggplot(Salaries, aes(x=yrs.since.phd, y=salary)) +
geom_point(color="orange")
ggplot(Salaries, aes(x=rank, y=salary)) +
geom_boxplot(fill="mistyrose")
install.packages("gridExtra")
library(gridExtra)
grid.arrange()
p1 <- ggplot(Salaries, aes(x=rank)) +
geom_bar(fill="steelblue")
p2 <- ggplot(Salaries, aes(x=salary)) +
geom_histogram(fill="maroon")
p3 <- ggplot(Salaries, aes(x=yrs.since.phd, y=salary)) +
geom_point(color="orange")
p4 <- ggplot(Salaries, aes(x=rank, y=salary)) +
geom_boxplot(fill="mistyrose")
grid.arrange(p1, p2, p3, p4, nrow=2, ncol=2)
myggplot <- grid.arrange(p1, p2, p3, p4, nrow=2, ncol=2)
ggsave(file="myplot.png", plot=myggplot, width=7.0, height=5.5)
??ggsave
ggplot(Salaries, aes(x=rank, y=salary)) +
geom_boxplot()
ggsave(file="myplo2.png")
'공부 > R Programming' 카테고리의 다른 글
Data Science Week 03 - 01 (0) | 2021.03.18 |
---|---|
Week 01: Basics of R (0) | 2021.03.02 |
R기초; R 기초 - ggplot2 그래픽5 - 테마 (2) | 2021.01.24 |
R 기초 - ggplot2 그래픽4 - 그래프 옵션 (0) | 2021.01.24 |
R 기초 - ggplot2 그래픽3 - 집단별 그래프 (0) | 2021.01.24 |
댓글