Drawing Based on R

Source: Internet
Author: User

1. Manage plotting

X11 (): Open a drawing window

? Device: view the list of available drawing devices

Dev. List (): Lists devices.

PDF (): Open a PDF file as a drawing device

Dev. cur (): displays the currently used device

Dev. Set (): change the current device

Dev. Off (): Disable a device.

Win. Metafile (): Open a specific drawing device in Windows

2. Image Segmentation

Split. Screen (): split into multiple parts (with vector parameters)

Screen (): select the image parts

Erase. Screen (): Delete the last drawing.

Layout (): splits the current graph window into multiple parts, and the graph is displayed in each part at a time. Its primary independent variable is an integer matrix, and the element indicates the number of the subwindow.

Layout. Show (): displays the number of subwindows.

3. Drawing Functions

Plot (x): plot with the element value of X as the ordinate and serial number as the abscissa

Plot (x, y): binary plot of X and Y

Sunflowerplot (x, y): Same as above

Pie (x): Pie Chart

Boxplot (x): box chart

Stripchart (x): draws the value of X on a line segment. A smaller sample size can be used as an alternative to a box chart.

Coplot (x ~ Y | z): Draw a binary graph between x and y for each value (or value range) of Z.

Interaction. plot (F1, F2, Y): If F1 and F2 are factors, the mean graph of Y uses different F1 values as the X axis, while F2 values correspond to different curves, other statistics of Y may be specified through fun.

Matplot (x, y): A Binary Graph. The first column of X corresponds to the first column of Y, and the second column of X corresponds to the second column of Y.

Dotchart (x): If X is a data frame, it is used as a Cleveland dot chart (column-by-column enumeration chart)

Fourfoldplot (x): displays 2x2 join tables with four 1/4 circles (X must be an array or matrix of dim = C (2, 2, K)

Assocplot (x): Cohen-friendly diagram, showing the degree of deviation between the row and column variables in a two-dimensional join table from independence

Mosaicplot (x): mosaic of the logarithm Linear Regression residual of the join table

Pairs (x): If X is a matrix or data frame, it is used as a binary graph between columns of X.

Plot. Ts (x): If X is an object of the "ts" type, X can be a time series curve of X, but the sequence must have the same frequency and time.

TS. Plot (x): Same as above, but if X is multivariate, the sequence can have different times but must have the same frequency.

Hist (x): frequency histogram of X

Barplot (x): bar chart of the value of X

Qqnorm (x): normal quantile-quantile chart

Qqplot (x, y): quantile of Y to X-quantile chart

Contour (x, y, z): Contour Map. x and y must be vectors and Z must be matrices, so that dim (z) = C (length (x, z, length (y ))

Filled. contour (x, y, z): Same as above. The area between contour lines is colored.

Image (x, y, z): Same as above, but the actual data size is represented in different colors

Persp (x, y, z): Same as above, but is a perspective

Starts (x): If it is a matrix or data frame, draw it with a star or line segment

Symbols (X, Y,...): draws a symbol at the given coordinates of X and Y. The type, size, and color of the symbol are specified by other variables.

Termplot (mod. OBJ): (partial) Influence Diagram of the regression model (mod. OBJ)

4. Low-Level Drawing command

Points (x, y): Add a vertex

Lines (x, y): add a line

Text (X, Y, labels,...): Add labes text to (x, y)

Mtext (text, side = 3, line = 0 ,...)

Segments (x0, y0, X1, Y1): draw a line segment from each point (x0, y0) to (x1, Y1)

Arrows (x0, y0, X1, Y1, angle = 30, code = 2): Same as above, but add an arrow. If code = 1, 2, 3, draw an arrow at which end

Abline (A, B): draw a straight line with the slope of B and the intercept of

Abline (H = y): Draw a horizontal line at y

Abline (V = X): Draw a vertical line at x

Abline (LM. OBJ): draws a regression line determined by LM. obj.

Rect (x1, x2, Y1, Y2)

Polygon (x, y): Draw a polygon that connects the points of X and Y coordinates.

Legend (X, Y, lengend): Add a legend at (x, y), indicating that the content is given by lengend.

Title (): Add a title or subtitle

Axis (side, vect): draws the coordinate axis

Box (): Add a border to the current Graph

Rug (x): Draw the position of X Data with a short line on the X axis

Locator (n, type = "N ",...): After you click n times on the graph with the mouse, the coordinates (x, y) of N clicks are returned. You can also draw a symbol (type = "p") at the click) or line (type = "1"). No symbols or lines are drawn by default.

Text (X, Y, expression (...): You can draw mathematical formulas.

As. expression (substitute (): You can enter a value in the formula.

5. drawing parameters

PAR (): permanently changing drawing parameters

Xlab, ylab: Axis label

Xlim, ylim: coordinate axis range

PCH, Col, BG: vertex shape, contour color, and background color

Lty: Connection Type

LAS: coordinate axis scale numeric Orientation

Cex, cex. axis, cex. Lab, cex. Main, cex. Sub: controls the size of symbols and text in the default state.

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.