R language Learning notes-drawing related

Source: Internet
Author: User

Plot function variable Interpretation:

1. Drawing function

plot advanced drawing function to automatically create a new drawing window

lines,points Low-level drawing functions to overlay new graphics on existing graphs.

lengend legend, low-level drawing function

The following example draws CPU1,C2 two curves:

Plot (cpu1,type= "O", pch=15,lty=1,col= "Blue") lines (c2,type= "O", pch=1,lty=1,col= "Red") Legend ("TopRight", C ("SSS", " TTT "), title=" CPU Usage ", Lty=c, Pch=c (15,1), Col=c (" Blue "," Red "))

2. Parameter Description

type Linetype

pch: Point character dot character, that is, the shape of a point, a circle, a triangle, a shape, and so on.

lty: line type lines, with solid lines, dashed lines, dots, etc.

col: Colors of color lines, red,blue,yellow, etc.

LWD: Specifies the line width. The LWD is represented by the relative size of the default value (the default value is 1). For example, lwd=2 will generate a line twice the width of the default

CeX: Specifies the size of the symbol. CeX is a numeric value that represents the zoom factor of the drawing symbol relative to the default size. The default size is 1,1.5 to 1.5 times times the default value, 0.5 for the default value of 50%, and so on.
LBL: Label label

C: Represents a Data collection

Xlim,ylim: x, y coordinate range, for example:

Ylim=c ( -40,40), Xlim=c (0,100)

main: Title

Sub: Subtitle

Xlab, Ylab: Axis labels

3. Graphics boundaries

The graphic size (width and height) of the pin in inches. Memory Method: Picture inch
mai The size of the boundary , expressed as a numeric vector, in the order of "bottom, left, top, and right", in inches. Memory method: Margin at inch.
Mar The size of the boundary as a numeric vector, in the order of "bottom, left, top, right", in English ("R language" translator note an inch of 1/12, online one inch equals 8 English points). The default value is C (5, 4, 4, 2) + 0.1. Memory method: Margin at

4. Add title

Title (main= "My Title", col.main= "Red", sub= "My Sub-Title", col.sub= "Blue", xlab= "my X label", ylab= "my Y label", col.lab= " Green ", cex.lab=0.75)

Note: Some advanced drawing functions already contain the default titles and labels. You can remove them by adding ann=false to the plot () statement or a separate par () statement.

Par (Ann=false)

5, Text Zoom Out

CeX represents a numeric value relative to the default size scale multiplier. The default size is 1,1.5 to 1.5 times times the default value, 0.5 for the default value of 50%, and so on.

Cex.axis The scale multiples of the axis scale text. Similar to CeX
Cex.lab The zoom factor of the axis label (name). Similar to CeX
cex.main The Zoom multiplier of the caption. Similar to CeX
cex.sub The zoom multiplier of the subtitle. Similar to CeX

6. Font

A font integer. Used to specify the font style used by the drawing. 1= general, 2 = bold, 3 = italic, 4 = Bold Italic, 5 = Symbol font (denoted by Adobe symbol encoding)
font.axis font style for axis scale text
Font.lab font style for axis labels (names)
font.main font style for headings
Font style for font.sub subtitle
PS Font point size (approx. 1 lbs. 1/72 in.). The final size of the text is Ps*cex
family The font family used when drawing text. Standard values are serif (liner), sans (sans serif), and mono (equal width)

7. Axis (axis)

You can use the function axis () to create a custom axis instead of using the default axis in R. The format is:
side  An integer representing the side of the drawing axis (1=, 2 = left, 3 = On, 4 = right)
AT  A numeric vector that indicates where tick marks need to be drawn
LABELS  a character-type vector that represents the text label placed next to the tick mark (if NULL, The value in at will be used directly)
POS  coordinates where the coordinate axis is plotted (that is, the value that intersects another axis)
lty  line type
COL  line and tick mark color
LAS  label is parallel to (=0) or perpendicular to (=2) axis
tck  The length of the tick mark, expressed as a fraction of the size of the drawing area (negative values are represented outside the drawing, A positive value represents the inside of the graphic, 0 disables the scale, 1 is the drawing grid line, and the default is 0.01
(...).   Additional graphics parameters

8. Tool methods

The parameter no.readonly=true can generate a list of current drawing parameters that can be modified, for example:



R language Learning notes-drawing related

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.