데이터 시각화

R을 이용한 논문 그래프 그리기2

r-code-for-data-analysis 2023. 12. 17. 20:47

간단하게 그래프의 품질을 높이는 패키지가 있어 이걸로 논문 그래프를 그리면 좋겠다 해서 소개한다. 

 

사용법도 간단하다. 

install.packages("remotes")
remotes::install_github("HanjoStudy/quotidieR")
Scatter <- ggplot(mtcars, aes(mpg,disp,color=factor(carb))) + geom_point(size=3) + labs(title="Scatter Plot")
grid.arrange(Scatter,(Scatter +scale_colour_Publication()+ theme_Publication()),nrow=1)

 

mtcars$Index <- 1:nrow(mtcars)
dat <- melt(mtcars,id.vars = c("Index"),measure.vars = c("drat","wt"))
Line <- ggplot(dat,aes(Index,value,colour=variable))+geom_line(size=1.3) + labs(title="Line Plot") 
grid.arrange(Line,(Line +scale_colour_Publication()+ theme_Publication()),nrow=1)


P <- ggplot(data = mpg,aes(cty, hwy,color=class))+geom_point(size=3) + facet_wrap(~ manufacturer,scales="free")+
  labs(title="Plot With Facets")
P

P +scale_colour_Publication()+ theme_Publication()

728x90
반응형