In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
Today, the editor will share with you the relevant knowledge points about the basic drawing parameters of R language. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article, let's take a look at it.
Graphics are a good means for data trend observation and data display. R language basic function, plot function, belongs to the graphics package.
Available parameters for Ⅰ:
Type: a form that shows the relationship between an and b:
"p": point; "l": line, lines; "b": breakpoint is point, line connection, point line does not intersect, both; "c": line only, discontinuous; "o": point, line and intersect, overplot; "n": empty graph
Pch: symbol type, as shown in the following figure:
Lty: controls the linetype of the connection, which can be an integer (1: solid, 2: dashed, 3: dotted, 4: dotted, 5: long dashed, 6: double dashed)
Bty: controls the shape of the border of the graph. The available values are "o", "l", "7", "c", "u" and "]" (the border and the character look alike), while bty= "n" does not draw the border.
Box: add a border to the current graph
Main: main title
Sub: subtitle
Xlab,ylab: X Y axis title
Xlim,ylim:X Y axis ran
Cex: values that control the default size of symbols and text, indicating how many times the default drawing text and symbols are magnified.
Zoom multiple of the cex.axis axis scale mark
Zoom multiple of the title of the cex.lab axis
The magnification of the main title of cex.main diagram
The magnification of the subtitle of cex.sub diagram
The color of symbols (dots, lines, etc.) in the col diagram, similar to the cex parameter, as follows:
The color of the col.axis axis scale mark
The color of the col.lab axis title
The color of the main title of the col.main diagram
Color of the subtitle of the col.sub diagram
Cex.font: specifies the font style to use for the drawing. 1 = regular, 2 = bold, 3 = italic, 4 = bold italic, 5 = symbol font
Font style for font.axis axis scale text
Font style of font.lab axis label (name)
Font style for font.main headings
Font style of font.sub subheadings
Family: sets the font family of the text (serif, sans serif, equal width, symbol font, etc.); standard values are: serif, sans, mono, symbol
Ⅱ can add simple functions
Legend (): in addition to setting the coordinates of the legend with XMagi y, it is very convenient to set the position with "topleft", "center", "bottomright" and so on. Ncol sets the number of columns of the legend, and horiz sets the orientation of the legend.
Las: axis label style; take 0, 1, 2, 3, one of the four integers to represent "always parallel to the axis", "always horizontal", "always perpendicular to the axis" and "always vertical", respectively.
Segments: (x0Query y0, x1jingy1) draw line segments from (x0djiny0) to (x1jiny1)
Lend: the end style of a segment. The parameter value can be an integer or a string. A parameter value of 0 or "round" indicates that the endpoint style is fillet (the default); 1 or "butt" indicates that the endpoint is directly truncated; and 2 or "square" indicates the extended end.
Arrows: arrows: code=1 draws arrows at each point (x1Grainy1), code=2 draws arrows at each point (x0Powery0), code=3 draws arrows at both ends; angle controls the angle from the axis of the arrow to the edge of the arrow; length arrow length
Abline (hype) draws a horizontal line at the ordinate y, abline (vsigx) draws a vertical line at the Abscissa x, abline (aMagib) draws a straight line with a slope of b and intercept a, and abline (lm.obj) draws a line of regression determined by lm.obj.
Rect (x1, y1, x2jue y2): draw a rectangle, (x1, y1) is the lower left corner, (x2jue y2) is the upper right corner
Polygon (XMagne y): draw polygons that connect the points determined by the XBI y coordinates
Text () (drawing area) writes at the location of the given coordinates. Text (x, y, labels, …) Add the text specified in labels at (XBI y)
Srt: the degree of string rotation. Only the function text is supported.
Mtext (outside the drawing area) labels the four axes. Mtext (text,side=3, line=0, …) Add the text specified by text in the edge space, and use side to specify which side to add; line specifies the number of lines between the added text and the drawing area, if it is not enough, you can adjust the mar parameter
Bg: sets the background color of the drawing area
Fg: setting the foreground color
Examples of Ⅲ code are as follows:
# # plot function plot (1:16, type= "p", col= "red", col.axis= "purple", bty= "o", lty=2, pch=2, lwd=2,main= "Test", sub= "plot test", xlab= "X", ylab= "Y", xlim=c (0,25), ylim=c (0jue 19), font.main=3,las=1,col.main= "red", col.sub= "blue", col.lab= "green", cex.lab=0.75) # # add basic parameters abline (hagc (1line 5), vault 2paramel ltycategory 2coll = "grey50" Lwd=2) segments (4Power2, 16Power3, arrows = "grey50", lend=1) arrows (3ping6, 10pence13, angle= 30recolldlwdlwdlwdlwdlwdpen3) rect (5,15,7,18) polygon (xpenc (1214, 15pr 16), yqunc (910pr 16), text (15pr 6, "Test", family= "serif", col= "# 7EFFD3", cex=2,font=3,srt=45) mtext ("here", 4line zero) # is not enough You can adjust legend (20,19, c ("sin", "cos", "tan"), col = c (3,4,6), text.col = "green4", lty = c (2,-1,1), pch = c (NA, 3,4), merge = TRUE, bg = "gray90").
These are all the contents of the article "what are the basic drawing parameters of R language?" Thank you for your reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.