1. 程式人生 > >R語言繪製基本圖形

R語言繪製基本圖形

條形圖

函式barplot()

> library(vcd)
載入需要的程輯包:grid
> counts <- table(Arthritis$Improved)
> counts

  None   Some Marked 
    42     14     28 
> barplot(counts,main = "Simple Bar Plot",xlab = "Improved",ylab = "Frequency") 
> barplot(counts,main = "Horizontal Bar Plot",xlab = "Improved",ylab = "Frequency",horiz = TRUE)