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, ...)
## S3 method for class 'default':
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, ...)
par
for
details. If unset, the code will attempt to use the
largest value which allows the entire object to be
displayed.par
.adj
graphics paramter (see
par
).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.
plot
,
text
,
capture.output
,
textplot
# 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")
Run the code above in your browser using DataLab