Plotting of lc objects

Description

Function to plot longCat objects created by longCat.

Usage

1
2
3
4
longCatPlot(lc, xlab = "Days", ylab = NULL, cols = NULL, colScheme = "heat", 
			reverse = FALSE, lwd = 0.5, lcex = 1, llwd = 3, 
			legendBuffer = 0.12, groupBuffer = 0, groupRotation = 90, 
			gcex = 1, seg.len = 1, xlas = 0, xcex = 1, ...)

Arguments

lc

an object of class longCat created by longCat. See par.

xlab

a label for the x-axis. Default is "Days". See par.

ylab

a label for the y-axis. Default is NULL which is changed to "Each Line Represents a Participant" with the sample size appended (lc$dim[1], see longCat). See par.

cols

a numeric or character list of colors. See par. Default is NULL. To use internal color schemes, use colScheme.

colScheme

select a color scheme. See colChoose for available options.

reverse

color schemes are applied from the lowest to highest level of categorical data in lc$data or lc$data.sorted. Set reverse=TRUE to reverse this. Default is FALSE.

lwd

set the width of horizontal lines. Default is .5. lwd should be reduced proportionally to the number of rows in lc$data to avoid overlap in plotting.

lcex

character expansion factor for the legend text. Default is 1. See par.

llwd

set the width of lines in the legend. default is 3. See lwd.

legendBuffer

set proportion of the plot to retain for legends, must be in [0,1]. Note that the legend is very sensitive to the scaling of the graphics device. Users are advised to maximize their device and rerun, or call dev.new() and resize prior to running longCatPlot. Default is .12 (i.e., 12% of the vertical plot area is retained for the legend). Set to 0 if no legend is desired. See the examples for moving the legend outside of the plotting margins.

groupBuffer

similar to legendBuffer, but for group labels on the left side of the plot. Default is 0 (i.e., 0% of the horizontal plot area is retained for group labels). Can take on any value in [0,1].

groupRotation

if lc$groupLabels are long (see longCat), rotation of the labels can be used reduce the needed size of groupBuffer.

gcex

character expansion factor for group labels. Default is 1. Seepar.

seg.len

Length of lines in the upper legend. Default is 1. See legend.

xlas

see las in par. Applied to the x-axis when tLabels are provided to longCat.

xcex

see axis.cex in par and axis. Applied to the x-axis when tLabels are provided to longCat.

...

Arguments to be passed to plot (see par).

Author(s)

Stephen Tueller

References

Tueller, S. J., Van Dorn, R. A., and Bobashev, G. V. (2013). Visualization of Categorical Longitudinal and Times Series Data. Manuscript Under Review.

See Also

longCat.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Illustrate longCatPlot with the legend outside the plot
par(mfrow=c(1,1), bg='cornsilk3', mar=c(5.1, 4.1, 4.1, 8.1), xpd=TRUE)
cols <- longCatPlot(
  longCat(example3),
  legendBuffer=0,
  main='Horizontal Line Plot')
legend(7.1, 100, legend=1:5, col=cols, lty=1, lwd=2)
par(bg='transparent', mar = c(5, 4, 4, 2) + 0.1, xpd=FALSE)

## Not run: 
# for data sets with many rows, writing directly to a file 
# is much faster and unaffected by device resizing, see ?pdf
pdf('C:/mydir/mysubdir/myfile.pdf')
par(bg='cornsilk3')
longCatPlot(f3lc, main='Sorted', colScheme='heat', lwd=2)
par(mfrow=c(1,1), bg='transparent')
dev.off()
# see ?jpeg for picture file options

## End(Not run)