close

1. Pie Charts

userName <- c("Lam Wei Wei", "Zheng Da Shi", "Lin Da You", "Fei Gu Man", "Chen Kuang", "Wong wei yun")
salary <- c(8500, 9800, 12500, 15000, 8700, 7500)
jobPosition <- c("Staff", "Manger", "BOSS", "CEO", "Staff", "Staff")
bonus <- c(2300, 1350, 3285, 1035, 3285, 1035)

result <- matrix(salary,ncol=6, byrow=TRUE)

colnames(result) <- userName
rownames(result) <- "salary"
result

pie(result, labels = userName, main="Salary bar chart")

Output result:

       Lam Wei Wei Zheng Da Shi Lin Da You Fei Gu Man Chen Kuang Wong wei yun
salary        8500         9800      12500      15000       8700         7500

下載.png

2. 3D Pie Chart

library(plotrix)

result <- matrix(salary,ncol=6, byrow=TRUE)

colnames(result) <- userName
rownames(result) <- "salary"
result

pie3D(result,  labels = userName, explode=0.1, main="Salary bar chart")

下載2.png

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 kk匡 的頭像
    kk匡

    kk匡的日記&學習筆記

    kk匡 發表在 痞客邦 留言(0) 人氣()