Subversion Repositories bdplot

Rev

Rev 46 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
57 pdel 1
## PD 20110923: This functionality is in bdsharex.start, bdsharex.end
2
 
46 pb 3
## PB 20101110: For plotting many plots with one x-axis.
4
## Split this into two function, e.g. plotOneXAxisBegin og plotOneXAxisEnd.
5
 
6
##------------------------------------------------------------------------
7
## The number of plots in the figure
8
n <- 
9
## Make the figure layout
10
## The first element to heights is the upper "margin", the last is the lower "margin"
11
layout(1:(n+2), heights=c(lcm(0.1), rep(1,n), lcm(1))) 
12
## Set par. Note xaxt="n" here, and in the last plot xaxt="s" 
13
par(mar=c(0,3,0,1), xaxt="n", mgp=c(2,0.7,0))         
14
## The top margin plot is empty. 
15
plot(0, type="n", xaxt="n", yaxt="n", bty="n", xlab="", ylab="")
16
## Do n plots of what you want, make xlab=""
17
plot(D$t, D$x, xlab="", ylab="x (kW)")
18
...
19
 
20
##------------------------------------------------------------------------
21
## The last plot to fill the lower "margin"
22
plot(D$t, D$y, xaxt="s", xlab="Time", ylab="y (C)")
23
## xlab text
24
mtext("Time", 1, line=2, cex=par("cex"))
25