[R language Drawing] drawing style settings (symbols, lines, colors, text properties)

Source: Internet
Author: User
Tags dashed line

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

Global modifications

A<-c (1:10) #全局修改old_par <-par (no.readonly=true) #记录默认样式到变量old_par中par (lty=2,pch=17)              #设置线型lty = 2 dashed line, pch= 17 Solid triangles, key-value pairs are set # The first picture is different from the default style. B<-rnorm (a,b,type= ' B ') #第二幅图, as with the first chart style b<-rnorm (A, B, Type= ' B ') par (old_par)                   #应用默认样式 # Third picture, default style B<-rnorm (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 list is a key-value pair that you can set

Parameters Role Describe List
Pch Symbol of the point Specify symbols to use when drawing points
CeX The size of the symbol Specifies the size of the symbol. CeX is a numeric value that represents the drawing symbol relative to the default
The size of the zoom multiplier. The default size is 1,1.5, which is 1.5 times times larger than the default value,
0.5 to zoom out to the default value of 50%, and so on
Lty Line type
Lwd Line width 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
Col The default drawing color. Some functions, such as lines and pie, can accept a
Vector that contains color values and is automatically recycled.
For example, if you set Col=c ("Red", "blue") and need to draw three lines,
The first line will be red, the second line is blue, and the third line will be the red one.
Col.axis Color of axis scale text
Col.lab Color of the axis label (name)
Col.main Title Color
Col.sub Subtitle Color
Fg The foreground color of the graphic
Bg Background color of the graphic
CeX Represents a numeric value relative to the default size magnification.
The default size of 1,1.5 is 1.5 times times larger than the default, and 0.5 means shrinking
50% for the default value, and so on
Cex.axis The scale multiplier 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
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)
Font.axis Font style for axis scale text
Font.lab Font style for axis labels (names)
Font.main Font style for headings
Font.sub Font style for subtitles
Ps The font point size (about 1 points is about 1/72 inches). 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)
Pin Graphic size in inches (width and height)
Mai The size of the boundary as a numeric vector, in the order of "bottom, left, top, right", in inches
Mar The size of the boundary represented by a numeric vector, in the order of "bottom, left, top, right", in English.
The default value is C (5, 4, 4, 2) + 0.1

Titles Title

Axis axis

Reference line Abline

Legend legend

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


Reference: R language Combat

Reprint Please specify source: http://blog.csdn.net/zhyoulun/article/details/46430807

[R language Drawing] drawing style settings (symbols, lines, colors, text properties)

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.