[R language drawing] drawing style settings (symbol, line, color, Text property) _r

Source: Internet
Author: User

There are two ways to set an image style, one that is global and one that is valid only for one picture.

Global modifications

A<-c (1:10)

#全局修改
old_par<-par (no.readonly=true) #记录默认样式到变量old_par中
par (lty=2,pch=17)              # Set line lty=2 dashed lines, pch=17 solid triangles, set the key-value pairs

#第一幅图, are different from the default style
B<-rnorm (a)
plot (a,b,type= ' B ')

#第二幅图, As in the first picture style
B<-rnorm (plot) (
a,b,type= ' b ')

par (old_par)                   #应用默认样式

#第三幅图, default style
b< -rnorm (plot)
(a,b,type= ' B ')


Valid for a picture

A<-c (1:10)
b<-rnorm
plot (a,b,type= ' B ', lty=2,pch=17)

The following table is the key value pair that can be set

Parameter action describes the symbol for a list PCH point specifies the size of the symbol CeX the symbol used when the drawing point is specified. CeX is a numeric value that represents the drawing symbol relative to the default
The scaling multiple of the size. The default size for 1,1.5 is 1.5 times times larger than the default value,
0.5 is reduced to the default value of 50%, and so on lty line type LWD line width specifies the line width. 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 default width col the default drawing color. Some functions, such as lines and pie, can accept a
A vector that contains color values and is automatically recycled.
For example, if you set Col=c ("Red", "blue") and you need to draw three lines, you
The first line will be red, the second line is blue, and the third line will be the color of the red Col.axis axis tick text col.lab the color of the axis label (name) Col.main the title color col.sub subtitle Color FG graphic The background color CeX of the foreground color BG graphic represents a numeric value relative to the default size scaling factor.
The default size for 1,1.5 is 1.5 times times larger than the default value, and 0.5 for narrowing
Is 50% of the default value, and so on Cex.axis the scaling multiple of the axis tick text. A scaling multiplier similar to the CeX Cex.lab axis label (name). A scaling multiplier similar to the CeX Cex.main caption. A scaling multiplier similar to the CeX cex.sub subtitle. Similar to CeX font integer. Used to specify the font style used by the drawing. 1= general, 2 = bold, 3 = italic,
4= Bold Italic, 5 = Symbol font (represented in Adobe symbol encoding) font.axis axis tick text font style Font.lab axis label (name) font style font.main title font style font.sub subtitle word Body style PS Font point value (1 points is about 1/72 inches). The final size of the text is Ps*cex family The font family used when drawing the text. The standard value is serif (lining line), sans (sans serif) and mono (equal-width) pin dimensions (width and height) in inches the size of the boundary represented by the numerical vector, in the order of "down, left, top, and right", in inches, and in a numerical vector. The boundary size, the order is "bottom, left, top, right", the unit is the English cent *.
The default value is C (5, 4, 4, 2) + 0.1

Titles Title title

Axis axis

Reference line Abline

Legend legend

Text callout text (add text inside the drawing area), Mtext (add text four boundaries)


Reference: R language Combat

Reprint please indicate the source: http://blog.csdn.net/zhyoulun/article/details/46430807

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.