加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

R软件:R做线图的三种方法

(2014-02-06 16:44:04)
标签:

r软件

线图

分类: R软件

数据集,pressure(R自带)

一、普通做法,plot()

代码:

attach(pressure)

plot(temperature,pressure,type="l")

结果:

http://s1/small/004gttBXty6GnpR2idy70&690

二、qqplot2包做线图

又有两种等价方式

1、qplot()

代码:

library(ggplot2)
qplot(temperature,pressure,data=pressure,geom="line")

#或者,qplot(temperature,pressure,data=pressure)+geom_line()

结果:

http://s13/small/004gttBXty6GnqiVxnefc&690

2、ggplot()

代码:

library(ggplot2)
ggplot(pressure,aes(x=temperature,y=pressure))+geom_line()

结果:同上图

统计人刘得意,邮箱:yyscxz@sina.com QQ:2859228658
 


 


 

 

0

阅读 收藏 喜欢 打印举报/Report
  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有