textplot {gregmisc}R Documentation

Display text information in a graphics plot.

Description

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

Usage

textplot(object, halign="left", valign="center", cex, ...)
textplot(object, halign="center", valign="center", cex, ...)
textplot(object, halign="center", valign="center", cex, ...)
textplot(object, halign="left", valign="top", cex,
    cmar=2, rmar=0.5, show.rownames=TRUE, show.colnames=TRUE,
    hadj=1, vadj=1, ...)

Arguments

object Object to be displayed.
halign Alignment in the x direction, one of "center", "left", or "right".
valign Alignment in the y direction, one of "center", "top" , or "bottom"
cex Character size, see par for details. If unset, the code will attempt to use the largest value which allows the entire object to be displayed.
rmar, cmar Space between rows or columns, in fractions of the size of the letter 'M'.
show.rownames, show.colnames Boolean indicating whether row or column names will be displayed.
hadj,vadj Vertical and horizontal location of elements within matrix cells. These have the same meaning as the adj graphics paramter (see par).
... Optional arguments passed to the text plotting command or specialied object methods

Details

The default textplot function uses the sprint function to store the result of calling print on the object argument. A new plot is then created and this string is displayed using the largest font that will fit on in the plotting region. The halign and valign parameters can be used to control the location of the string within the plotting region.

For matrixes and vectors a specialized textplot function is called, 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.

Value

Nothing of interest.

Author(s)

Gregory R. Warnes Gregory_R_Warnes@groton.pfizer.com

See Also

plot, text, capture

Examples


### 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 <- sapply( split(iris$Sepal.Length, iris$Species),
                function(x) round(c(Mean=mean(x), SD=sd(x), N=nobs(x)),2) )

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

reg <- lm( Sepal.Length ~ Species, data=iris )
textplot( summary(reg), valign="top" )
title("Regression of Sepal Length by Species")


[Package Contents]