원형 차트 다듬기
이전 플롯에서 만든 원형 차트도 괜찮지만, 조금 복잡해 보이네요. ggplot의 theme_void() 함수를 사용해 배경을 정리하고, ggtitle(...)로 의미 있는 제목을 붙여 깔끔하게 만들어 봅시다.
이전 연습 문제에서 만든 요약 데이터 프레임 disease_counts는 이미 불러와져 있습니다.
이 연습은 강의의 일부입니다
R로 배우는 시각화 베스트 프랙티스
연습 안내
- 배경을 정리하려면 ggplot 객체에
theme_void()를 추가하세요. - 플롯 제목을
'Proportion of diseases'로 지정하세요.
실습형 인터랙티브 연습
이 예제를 이 샘플 코드를 완성하여 풀어보세요.
ggplot(disease_counts, aes(x = 1, y = total_cases, fill = disease)) +
# Use a column geometry.
geom_col() +
# Change coordinate system to polar.
coord_polar(theta = "y") +
# Clean up the background with theme_void and give it a proper title with ggtitle.
___ +
___