使用R进行数据可视化套路之-散点图、图形分隔、时间序列

代码

## Panel A
par(fig=c(0, 1, .45, 1)) #图像设备分割

plot(log10(measles), xlab="时间", ylab=" Deaths; Population (log scale)", ylim=log10 (c(1,5000*1000)), yaxt="n")
ytiks <- c(1, 10, 100, 1000, 1000000, 5000000)
axis(2, at=log10(ytiks), labels=paste(ytiks), las=2) #坐标轴标记

## London population in thousands
londonpop <- ts(c(1088,1258,1504,1778,2073,2491,2921,3336,388,4563,4541,4498,4408), start=1801, end=1931, deltat=10) #创建时序数据
points(log10(londonpop*1000), pch=16, cex=.5)

mtext(side=3, line=0.5, "A (1629-1939)", adj=0)


## Panel B
par(fig=c(0, 1, 0, .45), new=TRUE)

plot(window(measles, start=1840, end=1882),xlab="时间", ylim=c(0, 4600), yaxt="n") #使用window函数进行时序序列区间数据截取
axis(2, at=(0:4)* 1000, labels=paste(0:4), las=2)

points(londonpop, pch=16, cex=.5)

mtext(
  • 0
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值