본문 바로가기
Programming/R

R graphics - pie chart

by 휴/Hue 2022. 7. 27.

1. pie chart[1]

table에 필요한 컬럼 넣어주기

topo.colors(): 등고선 색상

#PIE 1
tab <- with(Cars93, table(Type))
pie(tab, col=topo.colors(6))

2. pie chart[2]

names(tab)에 바꿀 레이블 이름 넣어주기 > 전부 대문자로 변경

#PIE 2
#레이블 이름바꾸기
names(tab) <- c('COMPACT', 'LARGE', 'MIDSIZE', 'SMALL', 'SPORTY', 'VAN')
pie(tab, col=topo.colors(6))

 

'Programming > R' 카테고리의 다른 글

Jupyter에서 R 사용하기  (0) 2022.10.28
R graphics - density, Q-Q, boxplot  (0) 2022.07.29
R graphics - 막대그림(barplot)  (0) 2022.07.26