textplot.html 5.77 KB
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><title>R: Display text information in a graphics plot.</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../R.css">
</head><body>

<table width="100%" summary="page for textplot {gplots}"><tr><td>textplot {gplots}</td><td align="right">R Documentation</td></tr></table>
<h2>Display text information in a graphics plot.</h2>


<h3>Description</h3>

<p>
This function displays text output in a graphics window.  It is the
equivalent of 'print' except that the output is displayed as a plot.
</p>


<h3>Usage</h3>

<pre>
textplot(object, halign="center", valign="center", cex, ...)
## Default S3 method:
textplot(object, halign=c("center","left","right"),
         valign=c("center", "top", "bottom"), cex, ... )
## S3 method for class 'character':
textplot(object, halign = c("center", "left", "right"),
         valign = c("center", "top", "bottom"), cex, fixed.width=TRUE,
         cspace=1, lspace=1, mar, ...)
## S3 method for class 'data.frame':
textplot(object, halign = c("center", "left", "right"),
         valign = c("center", "top", "bottom"), cex, ...)
## S3 method for class 'matrix':
textplot(object, halign = c("center", "left", "right"),
         valign = c("center", "top", "bottom"), cex, cmar = 2,
         rmar = 0.5, show.rownames = TRUE, show.colnames = TRUE,
         hadj = 1, vadj = 1, mar, ...)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>object</code></td>
<td>
Object to be displayed.</td></tr>
<tr valign="top"><td><code>halign</code></td>
<td>
Alignment in the x direction, one of "center", "left",
or "right". </td></tr>
<tr valign="top"><td><code>valign</code></td>
<td>
Alignment in the y direction, one of "center", "top" ,
or "bottom"</td></tr>
<tr valign="top"><td><code>cex</code></td>
<td>
Character size, see <code><a href="../../graphics/html/par.html">par</a></code> for details. If
unset, the code will attempt to use the largest value which allows
the entire object to be displayed.</td></tr>
<tr valign="top"><td><code>fixed.width</code></td>
<td>
Logical value indicating whether to emulate a
fixed-width font by aligning characters in each row of text. This is
usually necessary for text-formatted tables display properly.
Defaults to 'TRUE'.</td></tr>
<tr valign="top"><td><code>cspace</code></td>
<td>
Space between characters as a
multiple of the width of the letter 'W'. This only applies when 
<code>fixed.width==TRUE</code>. </td></tr>
<tr valign="top"><td><code>lspace</code></td>
<td>
Line spacing. This only applies when
<code>fixed.width==TRUE</code>.</td></tr>
<tr valign="top"><td><code>mar</code></td>
<td>
Figure margins, see the documentation for <code>par</code>.</td></tr>
<tr valign="top"><td><code>rmar, cmar</code></td>
<td>
Space between rows or columns, in
fractions of the size of the letter 'M'.</td></tr>
<tr valign="top"><td><code>show.rownames, show.colnames</code></td>
<td>
Logical value indicating whether row or
column names will be displayed.</td></tr>
<tr valign="top"><td><code>hadj,vadj</code></td>
<td>
Vertical and horizontal location of elements within
matrix cells.  These have the same meaning as the <code>adj</code> graphics
paramter (see <code><a href="../../graphics/html/par.html">par</a></code>).</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
Optional arguments passed to the text plotting command
or specialied object methods</td></tr>
</table>

<h3>Details</h3>

<p>
A new plot is created and the object is displayed
using the largest font that will fit on in the plotting region.  The
<code>halign</code> and <code>valign</code> parameters can be used to control the
location of the string within the plotting region.
</p>
<p>
For matrixes and vectors a specialized textplot function is available,
which plots each of the cells individually, with column widths set
according to the sizes of the column elements.  If present, row and
column labels will be displayed in a bold font.
</p>


<h3>Value</h3>

<p>
The character scaling factor (<code>cex</code>) used.</p>

<h3>Author(s)</h3>

<p>
Gregory R. Warnes <a href="mailto:warnes@bst.rochester.edu">warnes@bst.rochester.edu</a>
</p>


<h3>See Also</h3>

<p>
<code><a href="../../Zelig/html/plot.zelig.html">plot</a></code>, <code><a href="../../rsbml/html/TextGlyph-class.html">text</a></code>, 
<code><a href="../../utils/html/capture.output.html">capture.output</a></code>
</p>


<h3>Examples</h3>

<pre>
## Not run: 
### simple examples
# show R version information
textplot(version)

# show the alphabet as a single string
textplot( paste(letters[1:26], collapse=" ") )

# show the alphabet as a matrix
textplot( matrix(letters[1:26], ncol=2))

### Make a nice 4 way display with two plots and two text summaries

data(iris)
par(mfrow=c(2,2))
plot( Sepal.Length ~ Species, data=iris, border="blue", col="cyan",
      main="Boxplot of Sepal Length by Species" )
plotmeans( Sepal.Length ~ Species, data=iris, barwidth=2, connect=FALSE,
           main="Means and 95% Confidence Intervals\nof Sepal Length by Species")

info &lt;- sapply( split(iris$Sepal.Length, iris$Species),
                function(x) round(c(Mean=mean(x), SD=sd(x), N=gdata::nobs(x)),2) )

textplot( info, valign="top"  )
title("Sepal Length by Species")

reg &lt;- lm( Sepal.Length ~ Species, data=iris )
textplot( capture.output(summary(reg)), valign="top")
title("Regression of Sepal Length by Species")

par(mfrow=c(1,1))

## End(Not run)
</pre>



<hr><div align="center">[Package <em>gplots</em> version 2.3.2 <a href="00Index.html">Index]</a></div>

</body></html>