标签:
library(vcd) library(grid) counts<-table(Arthritis$Improved,Arthritis$Treatment) counts barplot(counts, main="Stacked Bar Plot", xlab="Treatment",ylab="Frequency", col=c("red","yellow","green"), legend=rownames(counts))#legend 提供标签
library(vcd) library(grid) counts<-table(Arthritis$Improved,Arthritis$Treatment) counts barplot(counts, main="Stacked Bar Plot", xlab="Treatment",ylab="Frequency", col=c("red","yellow","green"), legend=rownames(counts),beside = TRUE)#beside 表示矩阵中的每一列都表示一个分组,各列中的值将并列而不是堆砌
6.1.2棘状图
library(vcd) library(grid) attach(Arthritis) counts<-table(Treatment,Improved) counts spine(counts, main="Stacked Bar Plot") detach(Arthritis)
标签:
原文地址:http://www.cnblogs.com/py-Tom/p/4811549.html