plot The function is R Language is one of the most basic functions , Many parameters , It's hard to remember all the parameters in detail , Here's a summary , For easy reference .

*
x,y They are abscissa and ordinate .
x<-1:10
y<-x
plot(x,y)

*
parameter main Specify the title ( Above ),sub Specify subtitle ( Below ), xlab And ylab(lable label ) Specify separately x,y Label of shaft .
plot(x,y,main=" This is the title of the picture ",sub=" This is the subtitle ",xlab="x axis ",ylab="y axis ")

*
xlim limit x Axis range , The parameter value is a vector (x1,x2),x1,x2 They are x Upper and lower limits of , ylim In the same way .
plot(x,y,xlim=c(0,5),ylim=c(0,5))

*
type Parameter to specify the type of line , for example
plot(x,y,type="p",main = 'type="p"')

*
lty Specifies the line type
plot(x,y,lty=1)

*
pch parameter (plotting character) Specifies the shape of the scatter , have access to 0 :
25 Number 26 Logo , also 21 reach 25 Several symbols can be filled with color . In addition, we can also specify any single string , as "#","\$",“A”,"8" etc .
plot(x,y,pch=24,bg=2)
plot(1:8,rep(5,8),pch=LETTERS[c(9,12,15,22,5,20,23,4)],col=2:9)

*
col Parameter setting color ,R provide 657 Colors , You can use it colors() see . colour col=“red”
,“yellow”,“blue”,"green" etc . You can also use integer selection to represent colors .

col.main Color of main drawing
col.sub Subtitle color
col.axis Axis color
col.lab Axis label color
fg The foreground color of the graph
bg Background color of graphics
*
Font and size ,cex=1 Is the default size ,cex=2 Is the default value 2 times ,0.6 Is the default value 60%.font Is the font parameter ,font=1 Corresponds to plain text ( default ),2 Corresponding to bold ,3 Corresponding to italics ,4 Corresponds to bold italics .
cex.main Title zoom
cex.sub Subtitle zoom in and out
cex.lab Label scaling
cex.axis Axis text zooming
font.main Title font
font.sub Subtitle font
font.lab Label font
font.axis Axis text font
*
par(mfrow=c(a,b)) Used to set the layout of the image device （ Separates the current drawing device into a*b Sub equipment ), Whether the drawing order of a graph is by column or by row depends on the parameter mfrow( that 's ok ) still mfcol( column ). Here's an example .
* adj Text and title alignment can be set , Value in [0,1] between ,0 flush left ,0.5 Center ,1 Right end alignment .

* ann=FALSE, Delete text comment （annotate）
* bty Used to set the border form , The default value is "o", It means that all four borders are drawn , Other optional values include "l"（ Lower left ）,“7”（ Up right ）,“c”（ Up down left ）,“u”（ Left down right ）,"]"
（ Up down right ） and "n"（ nothing , No borders ）
* las. It can only be 0,1,2,3 One of the values in , Used to indicate the direction of the scale value .0 Represents always parallel to the axis ;1 Always horizontal ;2 Means always perpendicular to the axis ;3 Always vertical .
* xaxt For setting x Scale value type of axis , Is one character ."n" Indicates that the scale value and scale line are not drawn ;"s" Represents drawing , Default value .yaxt In the same way .
par(mfrow=c(2,3))
plot(x,y,main=" Right end alignment ",sub=" Subtitle ",ann=FALSE)# Delete Note
plot(x,y,main=" Right end alignment ",sub=" Subtitle ",ann=FALSE,las=1)#y Axis scale value level
plot(x,y,main=" Right end alignment ",sub=" Subtitle ",ann=F,bty="n",xaxt="n",yaxt="n")# Delete border , scale

Thank you for reading this article in the vast network world , I sincerely hope that your precious time has not been wasted , I look forward to your pointing out the shortcomings of this paper !

Technology
Daily Recommendation