The R Project SVN R

Rev

Rev 9940 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 9940 Rev 10453
Line 18... Line 18...
18
  sub- or superscripts, produce fractions, etc.
18
  sub- or superscripts, produce fractions, etc.
19
 
19
 
20
  The output from \code{example(plotmath)} includes several tables which
20
  The output from \code{example(plotmath)} includes several tables which
21
  show the available features.  In these tables, the columns of grey text
21
  show the available features.  In these tables, the columns of grey text
22
  show sample \R expressions, and the columns of black text show the
22
  show sample \R expressions, and the columns of black text show the
23
  resulting output.  
23
  resulting output.
24
 
24
 
25
  The available features are also described in the tables below:
25
  The available features are also described in the tables below:
26
 
26
 
27
  \tabular{ll}{
27
  \tabular{ll}{
28
    \bold{Syntax} \tab \bold{Meaning} \cr
28
    \bold{Syntax} \tab \bold{Meaning} \cr
Line 133... Line 133...
133
        xlab = expression(paste("Phase Angle ", phi)),
133
        xlab = expression(paste("Phase Angle ", phi)),
134
        col.main = "blue")
134
        col.main = "blue")
135
axis(1, at = c(-pi, -pi/2, 0, pi/2, pi),
135
axis(1, at = c(-pi, -pi/2, 0, pi/2, pi),
136
     lab = expression(-pi, -pi/2, 0, pi/2, pi))
136
     lab = expression(-pi, -pi/2, 0, pi/2, pi))
137
 
137
 
-
 
138
 
-
 
139
## How to combine "math" and numeric variables :
-
 
140
plot(1:10, type="n", xlab="", ylab="", main = "plot math & numbers")
-
 
141
tt <- 1.23 ; mtext(substitute(hat(theta) == that, list(that= tt)))
-
 
142
for(i in 2:9)
-
 
143
    text(i,i+1, substitute(list(xi,eta) == group("(",list(x,y),")"),
-
 
144
                           list(x=i, y=i+1)))
-
 
145
 
138
plot(1:10, 1:10)
146
plot(1:10, 1:10)
139
text(4, 9, expression(hat(beta) == (X^t * X)^{-1} * X^t * y))
147
text(4, 9, expression(hat(beta) == (X^t * X)^{-1} * X^t * y))
140
text(4, 8.4, "expression(hat(beta) == (X^t * X)^{-1} * X^t * y)",
148
text(4, 8.4, "expression(hat(beta) == (X^t * X)^{-1} * X^t * y)",
141
     cex = .8)
149
     cex = .8)
142
text(4, 7, expression(bar(x) == sum(frac(x[i], n), i==1, n)))
150
text(4, 7, expression(bar(x) == sum(frac(x[i], n), i==1, n)))
Line 149... Line 157...
149
######
157
######
150
# create tables of mathematical annotation functionality
158
# create tables of mathematical annotation functionality
151
######
159
######
152
make.table <- function(nr, nc) {
160
make.table <- function(nr, nc) {
153
    savepar <- par(mar=rep(0, 4), pty="s")
161
    savepar <- par(mar=rep(0, 4), pty="s")
154
    plot(c(0, nc*2 + 1), c(0, -(nr + 1)), 
162
    plot(c(0, nc*2 + 1), c(0, -(nr + 1)),
155
         type="n", xlab="", ylab="", axes=FALSE)
163
         type="n", xlab="", ylab="", axes=FALSE)
156
    savepar
164
    savepar
157
}
165
}
158
 
166
 
159
get.r <- function(i, nr) {
167
get.r <- function(i, nr) {