그래프 > 원 그래프...
Graphs > Pie chart...

Linux 사례 (MX 21)

carData 패키지에서 Prestige 데이터셋을 선택하여 활성화시키자. Prestige 데이터셋에는 요인형 변수가 type 하나이다. 원 그래프는 요인형 변수를 시각화할 때 사용하는 기법의 하나이다. <색깔 선택>에서 '색깔 팔레트에서'를 선택하고 <그림 이름표>에 내용을 이해하는데 효과적인 이름표와 제목을 입력한다.

Linux 사례 (MX 21)

with(Prestige, piechart(type, xlab="type (직업유형)", ylab="", 
main="1971년 캐나다 직업군의 유형 비율", col=palette()[2:4], scale="percent"))

Linux 사례 (MX 21)


?pie  # graphics 패키지의 pie 도움말 보기

require(grDevices)
pie(rep(1, 24), col = rainbow(24), radius = 0.9)

pie.sales <- c(0.12, 0.3, 0.26, 0.16, 0.04, 0.12)
names(pie.sales) <- c("Blueberry", "Cherry",
    "Apple", "Boston Cream", "Other", "Vanilla Cream")
pie(pie.sales) # default colours
pie(pie.sales, col = c("purple", "violetred1", "green3",
                       "cornsilk", "cyan", "white"))
pie(pie.sales, col = gray(seq(0.4, 1.0, length.out = 6)))
pie(pie.sales, density = 10, angle = 15 + 10 * 1:6)
pie(pie.sales, clockwise = TRUE, main = "pie(*, clockwise = TRUE)")
segments(0, 0, 0, 1, col = "red", lwd = 2)
text(0, 1, "init.angle = 90", col = "red")

n <- 200
pie(rep(1, n), labels = "", col = rainbow(n), border = NA,
    main = "pie(*, labels=\"\", col=rainbow(n), border=NA,..")

## Another case showing pie() is rather fun than science:
## (original by FinalBackwardsGlance on http://imgur.com/gallery/wWrpU4X)
pie(c(Sky = 78, "Sunny side of pyramid" = 17, "Shady side of pyramid" = 5),
    init.angle = 315, col = c("deepskyblue", "yellow", "yellow3"), border = FALSE)

+ Recent posts