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