1 in-drawing comments
The function text () is used to add text in the drawing area.
Function: text (x, y = null, labels = seq _ along (x $ x), adj = null, pos = null, offset = 0.5, vfont = null, cex = 1, col = null, font = null, ...)
X and y: used to specify the position coordinates of the added text, which are numerical vectors. If the lengths of the x and y vectors are different, the short ones will be recycled.
Labels: specifies the content of the added text, which is a string vector.
Adjust the position of the text. Its value is between [0, 1]. When adj is 1, adjust the X-axis position of the label; When it is 2, 1 is to adjust the position of the X axis, and the second is to adjust the position of the Y axis.
Pos: Adjust the direction and position of the text. If this value is given, it will cover the value given by adj .. 1, 2, 3 and 4 correspond to the down, left, up and right coordinates respectively.
Offset: This parameter needs to be used in combination with pos. When specifying pos, the character offset is given.
Vfont: a null value means that the current font family is used by default. Or a vector font character vector of length 2. The first element of the vector is used to specify the font and the second element is used to specify the style. If the text label is given by an expression, this setting will be ignored.
Cex: set the font size. If it is NA or NULL, it is set to 1.
Col: set the color of the text.
Font: set the text font. The default value is 1, normal text, 2 for bold, 3 for italic, 4 for bold+italic, and 5 is only useful when used on ADOBE devices.
Srt: The angle at which the text is tilted.
1. 1 Specify coordinates to add text.
1.2 Specify coordinates to add multiple texts.
1.3 Add text comments for graphic elements.
1.4 Special symbols
Sometimes it is necessary to mark mathematical symbols such as sum, integral, subscript and some formulas on the diagram. The function expression (...) is needed here, and ... the expression to be input. You can use help(plotmath) to get more details and examples of expressions.
2 Notes outside drawings
The mtext () function is used to add text to one of the four boundaries of a graph.
mtext(text,side = 3,line = 0,outer = FALSE,at = NA,adj = NA,padj = NA,cex = NA,col = NA,font = NA,...)
Text: Specify the text content.
Side: Specify the margin of blank space (1= bottom, 2= left, 3= top, 4= right).
Line: Specifies the position where the text appears, and the text is parallel to the corresponding coordinate axis. Count outward from the coordinate axis, starting from 0.
At: Specifies the position of the string in user coordinates.
Adjust the reading direction. In order to make the string parallel to the coordinate axis, adj=0 means left alignment or lower alignment, and adj= 1 means right alignment or upper alignment.
Padj: adjust the vertical reading direction of each string (controlled by adj). For strings with parallel axes, padj=0 means right alignment or top alignment, and padj= 1 means left alignment or bottom alignment.
Cex: adjust the font size, and the default is 1.
Font: Adjust the text font.
Col: adjust the text color.
References:
R language practice (Chinese version), People's Posts and Telecommunications Publishing House, 20 13.
Use the text () function to add text to the drawing in R language,/article/r/2018/6381.html.
A course of R language, lecture 2: R drawing-basic-graphic parameter setting: title, legend, text, /s? _ _ biz = mzu 1 mzc 3 otiwng = = & amp; mid=224749553 1。 idx= 1。 sn = cdd 80d 4 e 950 AE 2 b 344 cf 188 c 68922 fa 8 & amp; chksm = fbef 0602 cc 988 f 14 e 93 b 7 1 BC 6 fc C2 FDA 782d 3a e9 a3 a 6760 1 a6 c 87756 F4 AE 85 BC C5 d 9 c 56d 9 b 5 1 & amp; Scene = 2 1 # wechat _ redirect