[Use of the R language drawing]plot function

Source: Internet
Author: User

The simplest plotting function in the R language is plot. If you have used Matlab before, you will probably try to plot this command if you use R to draw. Plot (a) will generally get the picture we want. However, if you want to further set other properties, such as title, x-axis name, y-axis name, and so on, you need to do some understanding of some additional parameters. Here's a very simple example of how to use the plot function after you've seen it.

Attach (Mtcars) #获取系统自带的data. Frame type Data mtcarsclass (mtcars) Mtcarsmtcars<-mtcars[order (MTCARS$WT),] #为了更清楚展示结果, The data table is sorted by wt from small to large # simple plot plot (Mtcars$mpg) (Mtcars$wt,mtcars$mpg) #设置所有可用的参数plot (x = mtcars$wt,     y = mtcars$mpg,     type= "O", #线型     main= "title",     sub= "subtitle",     xlab= "x-axis",     ylab= "y-axis",     asp=0.1) #y/x ratio, The ratio of the y-axis numerical length to the x-axis numerical length

Another thing to add is that the type Linetype parameter has some other options.

Point "P" for points, line "L" for lines, point line "B" for both, point line graph minus point "C" for the lines part alone of "B", covered Wire "O" for both ' overplotted ', class Similar histogram "H" for ' histogram ' like (or ' high-density ') vertical lines, stair-shaped "s" for Stair steps, stair-shaped "s" for other steps, see ' Detail S ' below, does not display "n" for no plotting.

Results


[Use of the R language drawing]plot function

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.