Description Usage Arguments Details Author(s) See Also Examples
This function displays text output in a graphics window. It is the equivalent of 'print' except that the output is displayed as a plot.
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 | replaceTabs.inner(text, width = 8)
replaceTabs(text, width = 8)
textplot(
object,
halign = "center",
valign = "center",
cex,
max.cex = 1,
cmar = 2,
rmar = 0.5,
show.rownames = TRUE,
show.colnames = TRUE,
hadj = 1,
vadj = NULL,
row.valign = "center",
heading.valign = "bottom",
mar = c(0, 0, 0, 0) + 0.1,
col.data = par("col"),
col.rownames = par("col"),
col.colnames = par("col"),
wrap = TRUE,
wrap.colnames = 10,
wrap.rownames = 10,
...
)
## Default S3 method:
textplot(
object,
halign = c("center", "left", "right"),
valign = c("center", "top", "bottom"),
cex,
max.cex,
cmar,
rmar,
show.rownames,
show.colnames,
hadj,
vadj,
row.valign,
heading.valign,
mar,
col.data,
col.rownames,
col.colnames,
wrap,
wrap.colnames,
wrap.rownames,
...
)
## S3 method for class 'data.frame'
textplot(
object,
halign = c("center", "left", "right"),
valign = c("center", "top", "bottom"),
cex,
max.cex = 1,
cmar = 2,
rmar = 0.5,
show.rownames = TRUE,
show.colnames = TRUE,
hadj = 1,
vadj = NULL,
row.valign = "center",
heading.valign = "bottom",
mar = c(0, 0, 0, 0) + 0.1,
col.data = par("col"),
col.rownames = par("col"),
col.colnames = par("col"),
wrap = TRUE,
wrap.colnames = 10,
wrap.rownames = 10,
...
)
## S3 method for class 'matrix'
textplot(
object,
halign = c("center", "left", "right"),
valign = c("center", "top", "bottom"),
cex,
max.cex = 1,
cmar = 2,
rmar = 0.5,
show.rownames = TRUE,
show.colnames = TRUE,
hadj = 1,
vadj = NULL,
row.valign = "center",
heading.valign = "bottom",
mar = c(0, 0, 0, 0) + 0.1,
col.data = par("col"),
col.rownames = par("col"),
col.colnames = par("col"),
wrap = TRUE,
wrap.colnames = 10,
wrap.rownames = 10,
...
)
## S3 method for class 'character'
textplot(
object,
halign = c("center", "left", "right"),
valign = c("center", "top", "bottom"),
cex,
max.cex = 1,
cmar = 2,
rmar = 0.5,
show.rownames = TRUE,
show.colnames = TRUE,
hadj = 1,
vadj = NULL,
row.valign = "center",
heading.valign = "bottom",
mar = c(0, 0, 3, 0) + 0.1,
col.data = par("col"),
col.rownames = par("col"),
col.colnames = par("col"),
wrap = TRUE,
wrap.colnames = 10,
wrap.rownames = 10,
fixed.width = TRUE,
cspace = 1,
lspace = 1,
tab.width = 8,
...
)
|
text |
in the function 'replaceTabs', the text string to be processed |
width |
in the function 'replaceTabs', the number of spaces to replace tabs with |
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 |
max.cex |
Sets the largest text size as a ceiling |
rmar, cmar |
Space between rows or columns, in fractions of the size of the letter 'M'. |
show.rownames, show.colnames |
Logical value 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 |
row.valign |
Sets the vertical alignment of the row as "top", "bottom", or (default) "center". |
heading.valign |
Sets the vertical alignment of the heading as "top", (default) "bottom", or "center". |
mar |
Figure margins, see the documentation for |
col.data |
Colors for data elements. If a single value is provided, all data elements will be the same color. If a matrix matching the dimensions of the data is provided, each data element will receive the specified color. |
col.rownames, col.colnames |
Colors for row names and column names, respectively. Either may be specified as a scalar or a vector of appropriate length. |
wrap |
If TRUE (default), will wrap column names and rownames |
wrap.colnames |
The number of characters after which column labels will be wrapped. Default is 10. |
wrap.rownames |
The number of characters after which row headings will be wrapped. Default is 10. |
... |
Optional arguments passed to the text plotting command or specialized object methods |
fixed.width |
default is TRUE |
cspace |
default is 1 |
lspace |
default is 1 |
tab.width |
default is 8 |
A new plot is created and the object 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 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.
textplot also uses replaceTabs, a function to replace all tabs in a string with an appropriate number of spaces. That function was also written by Gregory R. Warnes and included in the 'gplots' package.
Originally written by Gregory R. Warnes warnes@bst.rochester.edu for the package 'gplots', modified by Peter Carl
plot
,
text
,
capture.output
,
textplot
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | # Also see the examples in the original gplots textplot function
data(managers)
textplot(table.AnnualizedReturns(managers[,1:6]))
# This was really nice before Hmisc messed up 'format' from R-base
# prettify with format.df in hmisc package
# require("Hmisc")
# result = t(table.CalendarReturns(managers[,1:8]))[-1:-12,]
# textplot(Hmisc::format.df(result, na.blank=TRUE, numeric.dollar=FALSE,
# cdec=rep(1,dim(result)[2])), rmar = 0.8, cmar = 1, max.cex=.9,
# halign = "center", valign = "top", row.valign="center", wrap.rownames=20,
# wrap.colnames=10, col.rownames=c("red", rep("darkgray",5),
# rep("orange",2)), mar = c(0,0,4,0)+0.1)
#
# title(main="Calendar Returns")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.