码迷,mamicode.com
首页 > 其他好文 > 详细

第六章 简单图形

时间:2015-09-15 23:06:36      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:

6.1 条形图

6.1.1 堆砌条形图和分组条形图

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!