본문 바로가기

R

R(생물정보학특론)-2(데이터의 시각화)

ggplot2: grammar of graphics plot2

 

library(tidyverse)

 

 

ggplot2는 그래픽의 문법에 기반한 시각화를 위한 시스템이다. 데이터를 제공하고, 변수를 시각적 요소에 매핑하는 방법과 어떤 그래픽 요소를 사용할지를 지정하면, ggplot2가 작업을 수행해 그래프를 처리해준다.

 

 

library(tidyverse)
ggplot2, purr, tibble, dplyr, tidyr, stringr, reader, forcats
위 패키지가 한꺼번에 로딩됨

ggplot 그리는 기본 골격

ggplot(data =<data>) + <GEOM_FUNCTION>(mapping = aes(<MAPPINGS>)

 

<data> = ggplot을 그릴 dataframe

<GEOM_FUNCTION> ggplot 그래프 형태

<MAPPINGS> =aesthetic 심미성(데이터의 어떤 부분 사용할지)

반응형