R par


par() function can be used to set or query graphical parameters.

> par("lwd")
[1] 1
> par("fg")
[1] "black"

Let's use mfrow= to split the plotting device screen:

> par(mfrow=c(2,2))
> curve(cos, -2 * pi, 2 * pi, col="blue")
> curve(cospi, -2, 2, col="blue")
> curve(sin, -2 * pi, 2 * pi, col="red")
> curve(sinpi, -2, 2, col="red")


In case to reset to the original parameter settings, you may first save the default, then recover it later.

> opt <- par(no.readonly = TRUE)
> par(opt)



List of default graphic parameter values:

parameter
value
parameter
value
xlog
FALSE
ylog
TRUE
adj
0.5
ann
TRUE
ask
FALSE
bg
transparent
bty
o
cex
1
cex.axis
1
cex.lab
1
cex.main
1.2
cex.sub
1
cin
0.15 0.2
col
black
col.axis
black
col.lab
black
col.main
black
col.sub
black
cra
14 19
crt
0
csi
0.2
cxy
0.31 0.49
din
6.9 6.9
err
0
family
 
fg
black
fig
0 1 0 1
fin
6.9 6.9
font
1
font.axis
1
font.lab
1
font.main
2
font.sub
1
lab
5 5 7
las
0
lend
round
lheight
1
ljoin
round
lmitre
10
lty
solid
lwd
1
mai
1 0.82 0.82 0.42
mar
5.1 4.1 4.1 2.1
mex
1
mfcol
1 1
mfg
1 1 1 1
mfrow
1 1
mgp
3 1 0
mkh
0.001
new
FALSE
oma
0 0 0 0
omd
0 1 0 1
omi
0 0 0 0
page
TRUE
pch
1
pin
5.7 5.1
plt
0.12 0.94 0.15 0.88
ps
12
pty
m
smo
1
srt
0
tck
NA
tcl
-0.5
usr
0.56 12 -0.043 1.1
xaxp
2 12 5
xaxs
r
xaxt
s
xpd
FALSE
yaxp
1 10 3
yaxs
r
yaxt
s
ylbias
0.2





endmemo.com © 2024  | Terms of Use | Privacy | Home