當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


R plot.table 表對象的繪圖方法

R語言 plot.table 位於 graphics 包(package)。

說明

這是用於(意外情況)table 對象的通用 plot 函數的方法。對於二維及更多維表,繪製mosaicplot,而一維表則繪製為條形。

用法

## S3 method for class 'table'
plot(x, type = "h", ylim = c(0, max(x)), lwd = 2,
     xlab = NULL, ylab = NULL, frame.plot = is.num, ...)
## S3 method for class 'table'
points(x, y = NULL, type = "h", lwd = 2, ...)
## S3 method for class 'table'
lines(x, y = NULL, type = "h", lwd = 2, ...)

參數

x

一個table(類似)對象。

y

必須是NULL:防止錯誤調用。

type

繪圖類型。

ylim

y 軸範圍。

lwd

在 1D 情況下使用 type = "h" 時條形的線寬。

xlab, ylab

x 軸和 y 軸標簽。

frame.plot

邏輯指示是否應在一維情況下繪製框架(box)。當 x 具有 dimnames coerce-able 為數字時默認為 true。

...

更多圖形參數,請參閱 plot.defaultaxes = FALSE 被接受。

例子

## 1-d tables
(Poiss.tab <- table(N = stats::rpois(200, lambda = 5)))
plot(Poiss.tab, main = "plot(table(rpois(200, lambda = 5)))")

plot(table(state.division))

## 4-D :
plot(Titanic, main ="plot(Titanic, main= *)")

也可以看看

plot.factor ,因子的 plot 方法。

相關用法


注:本文由純淨天空篩選整理自R-devel大神的英文原創作品 Plot Methods for table Objects。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。