R語言基本圖形

R語言基本圖形

條形圖

> install.packages("vcd")
> library(vcd)
>  barplot(c(1, 2, 4, 2, 6, 4, 3, 5))

在這裏插入圖片描述

> barplot(c(1, 2, 4, 2, 6, 4, 3, 5), horiz = TRUE)

在這裏插入圖片描述

> states <- data.frame(state.region, state.x77)
> x <- aggregate(states$Illiteracy, by = list(state.region), FUN = mean)
> x
        Group.1        x
1     Northeast 1.000000
2         South 1.737500
3 North Central 0.700000
4          West 1.023077
> barplot(x $ x, names.arg = x $ Group.1)

在這裏插入圖片描述
餅圖

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章