全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
13760 31
2012-03-14
悬赏 500 个论坛币 已解决
我有数据,见附件:
x1.zip
大小:(459 Bytes)

 马上下载

本附件包括:

  • x1.csv


想用R生成下面这样的时间序列图(不是一个图一个图单作,而是像下图一样包含在一张图中!):
ChinaIncome_001_big.png
请问该如何做?

最佳答案

kk22boy 查看完整内容

rm(list=ls()) par(mfrow=c(3,2),mar=c(0,4,0,2), oma = c(3, 0, 2, 0)) data=read.csv("x1.csv",header=T) attach(data) plot(year,y1,xaxt="n", xlab = "", type = "l") plot(year,y2,xaxt="n", xlab = "", type = "l") plot(year,y3,xaxt="n", xlab = "", type = "l") plot(year,y4,xaxt="n", xlab = "", type = "l") plot(year,y5, xlab = "", type = "l") plot(year,y7, xlab = "", type = "l") 另外距离近一 ...
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2012-3-14 10:46:46
耕耘使者 发表于 2012-3-14 19:54
太好了,但能否让y1等离纵轴近一些?或者让他们大一些?
因为看不清楚是哪个模型的了
rm(list=ls())
par(mfrow=c(3,2),mar=c(0,4,0,2), oma = c(3, 0, 2, 0))
data=read.csv("x1.csv",header=T)
attach(data)
plot(year,y1,xaxt="n", xlab = "", type = "l")
plot(year,y2,xaxt="n", xlab = "", type = "l")
plot(year,y3,xaxt="n", xlab = "", type = "l")
plot(year,y4,xaxt="n", xlab = "", type = "l")
plot(year,y5, xlab = "", type = "l")
plot(year,y7, xlab = "", type = "l")

Rplot.jpeg
另外距离近一点的话还是问版主吧,呵呵
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-3-14 11:07:33
看不大清楚图的坐标值。给你个参考,可以对应着y1~y7做你想要的图。
我习惯读txt格式数据,所以把csv转化成txt.
R code:
da=read.table("x1.txt",header=T)
plot(da$year,da$y1,type="l",ylab="agriculture",xlab="time")

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-3-14 11:19:54
universe110 发表于 2012-3-14 11:07
看不大清楚图的坐标值。给你个参考,可以对应着y1~y7做你想要的图。
我习惯读txt格式数据,所以把csv转化成 ...
不是这样的,是如附图那样,同时做所有的变量图,最后显示在一张图上
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-3-14 11:28:43
x1 <- rnorm(30)
x2 <- rnorm(30)
x3 <- rnorm(30)
x4 <- rnorm(30)
x5 <- rnorm(30)

x <- cbind(c(1,2,3), c(4,5,6))
layout(x, c(1,1), c(3,2,3))
layout.show(5)

par(mar=c(0,5,5,2), oma = c(0, 0, 3, 0))
plot(x1, xaxt = "n", xlab = "", type = "l")
par(mar=c(0,5,0,2))
plot(x2, xaxt = "n", xlab = "", type = "l")
par(mar=c(5,5,0,2))
plot(x3, xlab = "Time", type = "l")
par(mar=c(0,5,5,2))
plot(x4, xaxt = "n", xlab = "", type = "l")
par(mar=c(0,5,0,2))
plot(x5, xlab = "Time", type = "l")
mtext("Time", side = 1, cex = 0.75, line = 3)
mtext("Big Title", outer = TRUE, cex = 1)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2012-3-14 11:41:50
qoiqpwqr 发表于 2012-3-14 11:28
x1
版主,我现在急着要用,一行一行学已经来不急了,你能否按附件中的数据文件把代码写出来?是六个变量。
呵呵,我太笨了
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群