File: latexDotchart.Rd

package info (click to toggle)
hmisc 4.2-0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 3,332 kB
  • sloc: asm: 27,116; fortran: 606; ansic: 411; xml: 160; makefile: 2
file content (105 lines) | stat: -rw-r--r-- 4,290 bytes parent folder | download | duplicates (3)
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
\name{latexDotchart}
\alias{latexDotchart}
\title{Enhanced Dot Chart for LaTeX Picture Environment with epic}
\description{
\code{latexDotchart}  is a translation of the \code{dotchart3} function
for producing a vector of character strings containing LaTeX picture
environment markup that mimics \code{dotchart3} output.  The LaTeX
\code{epic} and \code{color} packages are required.  The \code{add} and
\code{horizontal=FALSE} options are not available for
\code{latexDotchart}, however. 
}
\usage{
latexDotchart(data, labels, groups=NULL, gdata=NA, 
  xlab='', auxdata, auxgdata=NULL, auxtitle,
  w=4, h=4, margin,      
  lines=TRUE, dotsize = .075, size='small', size.labels='small',
  size.group.labels='normalsize', ttlabels=FALSE, sort.=TRUE,
  xaxis=TRUE, lcolor='gray', ...)
}
\arguments{
  \item{data}{a numeric vector whose values are shown on the x-axis}
  \item{labels}{a vector of labels for each point, corresponding to
	\code{x}.  If omitted, \code{names(data)} are used, and if there are
	no \code{names}, integers prefixed by \code{"#"} are used.}
  \item{groups}{an optional categorical variable indicating how
	\code{data} values are grouped}
  \item{gdata}{data values for groups, typically summaries such as group
	medians}
  \item{xlab}{x-axis title}
  \item{auxdata}{
	a vector of auxiliary data, of the same length
	as the first (\code{data}) argument.  If present, this
	vector of values will be printed outside the right margin of the dot
	chart.  Usually \code{auxdata} represents cell sizes.
  }
  \item{auxgdata}{
	similar to \code{auxdata} but corresponding to the \code{gdata}
	argument.  These usually represent overall sample sizes for each
	group of lines.}
  \item{auxtitle}{
	if \code{auxdata} is given, \code{auxtitle} specifies a column
	heading for the extra printed data in the chart, e.g., \code{"N"}}
  \item{w}{width of picture in inches}
  \item{h}{height of picture in inches}
  \item{margin}{a 4-vector representing, in inches, the margin to the
	left of the x-axis, below the y-axis, to the right of the x-axis,
	and above the y-axis.  By default these are computed making educated
	cases about how to accommodate \code{auxdata} etc.}
  \item{lines}{set to \code{FALSE} to suppress drawing of reference
	lines}
  \item{dotsize}{diameter of filled circles, in inches, for drawing dots}
  \item{size}{size of text in picture.  This and the next two arguments
	are LaTeX font commands without the opening backslash, e.g.,
	\code{'normalsize'}, \code{'small'}, \code{'large'}, \code{smaller[2]}.}
  \item{size.labels}{size of labels}
  \item{size.group.labels}{size of labels corresponding to \code{groups}}
  \item{ttlabels}{set to \code{TRUE} to use typewriter monospaced font
	for labels}
  \item{sort.}{
	set to \code{FALSE} to keep \code{latexDotchart} from sorting the input
	data, i.e., it will assume that the data are already properly
	arranged.  This is especially useful when you are using \code{gdata}
	and \code{groups} and you want to control the
	order that groups appear on the chart (from top to bottom).}
  \item{xaxis}{set to \code{FALSE} to suppress drawing x-axis}
  \item{lcolor}{
	color for horizontal reference lines.  Default is \code{"gray"}}
  \item{...}{ignored}
}
\author{
Frank Harrell
\cr
Department of Biostatistics
\cr
Vanderbilt University
\cr
\email{f.harrell@vanderbilt.edu}
}
\seealso{
\code{\link[Hmisc]{dotchart3}}
}
\examples{
\dontrun{
z <- latexDotchart(c(.1,.2), c('a','bbAAb'), xlab='This Label',
                   auxdata=c(.1,.2), auxtitle='Zcriteria')
f <- '/tmp/t.tex'
cat('\\documentclass{article}\n\\usepackage{epic,color}\n\\begin{document}\n', file=f)
cat(z, sep='\n', file=f, append=TRUE)
cat('\\end{document}\n', file=f, append=TRUE)

set.seed(135)
maj <- factor(c(rep('North',13),rep('South',13)))
g <- paste('Category',rep(letters[1:13],2))
n <- sample(1:15000, 26, replace=TRUE)
y1 <- runif(26)
y2 <- pmax(0, y1 - runif(26, 0, .1))
z <- latexDotchart(y1, g, groups=maj, auxdata=n, auxtitle='n', xlab='Y',
                   size.group.labels='large', ttlabels=TRUE)
f <- '/tmp/t2.tex'
cat('\\documentclass{article}\n\\usepackage{epic,color}\n\\begin{document}\n\\framebox{', file=f)
cat(z, sep='\n', file=f, append=TRUE)
cat('}\\end{document}\n', file=f, append=TRUE)
}
}
\keyword{hplot}