플롯 재현

Tidyverse로 배우는 범주형 데이터

Emily Robinson

Data Scientist

Labs

ggplot(mtcars, aes(disp, mpg)) + geom_point() + 
  labs(x = "x axis label", y = "y axis label", title = "My title", 
       subtitle = "and a subtitle", caption = "even a caption!")

제목 "My title", 부제목 "and a subtitle", y축 레이블 "y axis label", x축 레이블 "x axis label", 캡션 "even a caption!"이 있는 산점도

Tidyverse로 배우는 범주형 데이터

x축 "mean mpg", y축 "carb"이 있는 막대 차트.

Tidyverse로 배우는 범주형 데이터

Geom_text

initial_plot + geom_text(aes(label = round(mean_mpg)))

각 막대 상단에 평균 mpg 값이 겹쳐 표시된 막대 차트.

Tidyverse로 배우는 범주형 데이터

텍스트 위치 조정

initial_plot + 
  geom_text(aes(label = round(mean_mpg), y = mean_mpg + 2))

각 막대 위에 텍스트가 표시된 이전과 동일한 그래프.

Tidyverse로 배우는 범주형 데이터

Theme

initial_plot + 
  geom_text(aes(label = round(mean_mpg), y = mean_mpg + 2)) + 
  theme(axis.text.x = element_blank(), axis.ticks.x = element_blank())

x축 레이블과 눈금이 제거된 이전과 동일한 그래프.

Tidyverse로 배우는 범주형 데이터

연습해 봅시다!

Tidyverse로 배우는 범주형 데이터

Preparing Video For Download...