R语言 barplot基本教程.docx

  1. 1、本文档共8页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
R语言 barplot基本教程

require(grDevices) # for colours[对色彩] tN - table(Ni - stats::rpois(100, lambda=5)) r - barplot(tN, col=rainbow(20)) #- type = h plotting *is* barplot[ - 类型=“H”图*是*barplot] lines(r, tN, type=h, col=red, lwd=2) barplot(tN, space = 1.5, axisnames=FALSE,+ sub = barplot(..., space= 1.5, axisnames = FALSE)) barplot(VADeaths, plot = FALSE)[1] 0.7 1.9 3.1 4.3 barplot(VADeaths, plot = FALSE, beside = TRUE) [,1] [,2] [,3] [,4][1,] 1.5 7.5 13.5 19.5[2,] 2.5 8.5 14.5 20.5[3,] 3.5 9.5 15.5 21.5[4,] 4.5 10.5 16.5 22.5[5,] 5.5 11.5 17.5 23.5 mp - barplot(VADeaths) # default[默认] tot - colMeans(VADeaths) mp[1] 0.7 1.9 3.1 4.3 tot Rural Male Rural Female Urban Male Urban Female 32.74 25.18 40.48 25.28 text(mp, tot + 3, format(tot), xpd = TRUE, col = blue) barplot(VADeaths, beside = TRUE,+ col = c(lightblue, mistyrose, lightcyan,+ lavender, cornsilk),+ legend = rownames(VADeaths), ylim = c(0, 100)) VADeaths Rural Male Rural Female Urban Male Urban Female50-54 11.7 8.7 15.4 8.455-59 18.1 11.7 24.3 13.660-64 26.9 20.3 37.0 19.365-69 41.0 30.9 54.6 35.170-74 66.0 54.3 71.1 50.0 title(main = Death Rates in Virginia, font.main = 4) hh - t(VADeaths)[, 5:1] mybarcol - gray20 hh 70-74 65-69 60-64 55-59 50-54Rural Male 66.0 41.0 26.9 18.1 11.7Rural Female 54.3 30.9 20.3 11.7 8.7Urban Male 71.1 54.6 37.0 24.3 15.4Urban Female 50.0 35.1 19.3 13.6 8.4 mybarcol[1] gray20 mp - barplot(hh, beside = TRUE,+ col = c(lightblue, mistyrose,+ lightcyan, lavender),+ legend = colnames(VADeaths), ylim= c(0,100),+ main = Death Rates in Virginia, font.main = 4,+ sub = Faked upper 2*sigma error bars, col.sub = mybarcol,+ cex.names = 1.5) segments(mp, hh, mp,

文档评论(0)

shuwkb + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档