Learn R Programming

condvis (version 0.2-2)

plotxc: Plot a 1-D or 2-D data summary for choosing conditioning values

Description

Used to plot one of a histogram, barplot, boxplot or spineplot, to be used as a conditionselector in ceplot. Returns a list containing relevant parameters, for subsequent updating of the plot. Not designed to be called by the user.

Usage

plotxc(xc, xc.cond, name = NULL, select.colour = NULL, select.lwd = NULL, 
    cex.axis = NULL, cex.lab = NULL, tck = NULL, select.cex = 1, ...)

Arguments

xc
a vector or dataframe with two columns, containing numeric or factor values.
xc.cond
a single value of the same type as xc.
name
a character vector containing the names of the variables in xc.
select.colour
colour for highlighting current section in condition selector plots. Default is "black".
select.lwd
line thickness for the lines showing conditioning. Default is 2.
cex.axis
scaling parameter for axis text. Default is 0.7.
cex.lab
scaling parameter for axis labels. Default is 0.8.
tck
parameter for axis ticks. Default is -0.05.
select.cex
scaling used for plot symbols in condition selector plots
...
other arguments passed to abline() for showing conditioning.

Value

  • A list with components:
  • devicethe device number on which the function was called.
  • factorcoordsa data.frame giving the horizontal coordinates of factor levels for barplots and boxplots. NULL for other plot types.
  • marmargins used in plot call.
  • namethe name(s) of the variable(s) in xc
  • plot.typea character value; one of "histogram", "barplot", "scatterplot", "boxplot" or "spineplot".
  • screenthe screen number in which the plot was made (see split.screen).
  • select.colourcolour for the lines showing conditioning.
  • select.lwdline thickness for the lines showing conditioning
  • cex.axisscaling parameter for axis text.
  • cex.labscaling parameter for axis labels.
  • tckparameter for axis ticks.
  • sptmpan object containing the coordinates of the basic elements of the spineplot, including related factor levels. NULL if plot.type is not "spineplot".
  • usrgraphical parameter for converting between device and user coordinates.
  • xcpassed directly from inputs.
  • xc.cond.oldpassed directly from inputs, but renamed.

See Also

ceplot, plotxs.

Examples

Run this code
## histogram, highlighting the first case
data(mtcars)
obj <- plotxc(mtcars[, "mpg"], mtcars[1, "mpg"])
obj$usr

## barplot, highlighting 'cyl' = 6
plotxc(as.factor(mtcars[, "cyl"]), 6, select.colour = "blue")

## scatterplot, highlighting case 25
plotxc(mtcars[, c("qsec", "wt")], mtcars[25, c("qsec", "wt")],
       select.colour = "blue", select.lwd = 1, lty = 3)

## boxplot, where 'xc' contains one factor, and one numeric
mtcars$carb <- as.factor(mtcars$carb)
plotxc(mtcars[, c("carb", "wt")], mtcars[25, c("carb", "wt")],
       select.colour = "red", select.lwd = 3)

## spineplot, where 'xc' contains two factors
mtcars$gear <- as.factor(mtcars$gear)
mtcars$cyl <- as.factor(mtcars$cyl)
plotxc(mtcars[, c("cyl", "gear")], mtcars[25, c("cyl", "gear")],
       select.colour = "red")

Run the code above in your browser using DataLab