-
Notifications
You must be signed in to change notification settings - Fork 46
/
ESEUR_config.r
138 lines (113 loc) · 3.33 KB
/
ESEUR_config.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#
# ESEUR-config.r, 8 Jun 20
# Assume the current directory unless told otherwise
ESEUR_dir=Sys.getenv("ESEUR_dir")
if (ESEUR_dir == "")
ESEUR_dir=getwd()
ESEUR_dir=paste0(ESEUR_dir, "/")
library("colorspace")
# Outer Margin Area, default: par(oma=c(3, 3, 3, 3))
# Figure Margin, default: par(mar=c(5, 4, 4, 2)+0.1)
ESEUP_set_par=function(OMA=OMA_default, MAR=MAR_default)
{
# par(col="brown")
# par(col.axis="black")
par(bty="l")
par(las=1)
par(pch=point_pch)
# Length of tick marks as a fraction of the height of a line of text
par(tcl=-0.2)
par(xaxs="r")
par(yaxs="r")
# par(xpd=NA) # plotting is clipped at the device region, i.e., + not cropped
ESEUR_global_cex=0.55
par(cex=ESEUR_global_cex)
par(cex.axis=0.67/ESEUR_global_cex)
par(cex.lab=0.7/ESEUR_global_cex)
ESEUR_legend_cex=1.2
#
# Do we want plotting clipped at the figure region?
# par(xpd=TRUE)
# Margin line for the title and axis
par(mgp=c(1.5, 0.45, 0))
# Outer Margin Area, default: par(oma=c(3, 3, 3, 3))
par(oma=OMA)
# Figure Margin, default: par(mar=c(5, 4, 4, 2)+0.1)
par(mar=MAR)
}
plot_layout=function(num_down, num_across,
default_width=ESEUR_default_width, default_height=ESEUR_default_height,
max_width=ESEUR_max_width, max_height=ESEUR_max_height)
{
if (num_across > 1)
{
if (num_down == 1)
{
layout(matrix(1:num_across, nrow=1), widths=rep(max_width/num_across, num_across), heights=default_height, TRUE)
}
else
{
layout(matrix(1:(num_down*num_across), nrow=num_down), widths=rep(max_width/num_across, num_across), heights=rep(max_height/num_down, num_down), TRUE)
}
}
else if (num_down > 1)
{
if (num_across == 1)
{
layout(matrix(1:num_down, nrow=num_down), widths=default_width, heights=rep(max_height/num_down, num_down), TRUE)
}
else
{
layout(matrix(1:(num_down*num_across), nrow=num_down), widths=rep(max_width/num_across, num_across), heights=rep(max_height/num_down, num_down), TRUE)
}
}
else
par(fin=c(default_width/2.54, default_height/2.54)) # cm -> inches
ESEUP_set_par()
}
plot_wide=function(w_width=ESEUR_default_width*1.3,
w_height=ESEUR_default_height*0.8)
{
layout(matrix(1:1, nrow=1), widths=w_width, heights=w_height, TRUE)
ESEUP_set_par()
}
OMA_default=c(2, 2, 1, 1)
MAR_default=c(3, 4.2, 1, 1)+0.1
# In centemeters
ESEUR_max_width=16
ESEUR_max_height=14
ESEUR_default_width=7
ESEUR_default_height=7
set_width_height=function(
max_width=ESEUR_max_width,
max_height=ESEUR_max_height,
default_width=ESEUR_default_width,
default_height=ESEUR_default_height)
{
ESEUR_max_width <<- max_width
ESEUR_max_height <<- max_height
ESEUR_default_width <<- default_width
ESEUR_default_height <<- default_height
}
ESEUR_orig_par_values=par(no.readonly=TRUE)
point_pch=3
point_col="salmon3"
loess_col="yellow"
# Settings for slides
# ESEUR_max_width=20
# ESEUR_max_height=17
# ESEUR_default_width=10
# ESEUR_default_height=10
# point_col="tan"
# loess_col="yellow"
# In inches
# par(fin=c(4.5, 4.5))
# In inches, not cm
par(fin=c(ESEUR_default_width/2.54, ESEUR_default_height/2.54))
# Layout behaves oddly in this case:
# layout(matrix(1:1, ncol=1), widths=default_width, heights=default_height, TRUE)
# nf = layout(matrix(1), widths = lcm(5), heights = lcm(5))
# layout.show(nf)
# Printed line width, matched to book text width in courier font
options(width=75)
ESEUP_set_par()