Use R for data visualization routines-scatter plots, graphic separators, time series

Source: Internet
Author: User

Code

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

plot (log10 (measles), xlab= "Time", ylab= "deaths; Population (log scale) ", Ylim=log10 (C (1,5000*1000)), yaxt=" n ")
Ytiks <-C (1, ten, +, +, 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,.), New=true)

Plot (window (measles, start=1840, end=1882), xlab= "Time", Ylim=c (0, 4600), yaxt= "n" ) #使用window函数进行时序序列区间数据截取
Axis (2, at= (0:4) *, Labels=paste (0:4), las=2)

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

Mtext (side=3, line=0.5, "B (1841-1881)", adj=0)



effect


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.