Learn R Programming

condvis (version 0.5-1)

plotxc: Condition selector plot

Description

Data visualisations used to select sections for ceplot.

Usage

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

Arguments

xc

A numeric or factor vector, or a dataframe with two columns

xc.cond

Same type as xc, representing a single point in data space to highlight.

name

The variable name for xc

trim

Logical; if TRUE, long tails of continuous data are chopped off at the 5th and 95th percentiles.

select.colour

Colour to highlight xc.cond

select.lwd

Line weight to highlight xc.cond

cex.axis

Axis text scaling

cex.lab

Label text scaling

tck

Plot axis tick size

select.cex

Plot symbol size

hist2d

If TRUE, a scatterplot is visualised as a 2-D histogram. Default behaviour is to use a 2-D histogram if there are over 2,000 observations.

fullbin

A cap on the counts in a bin for the 2-D histogram, helpful with skewed data. Larger values give more detail about data density. Defaults to 25.

...

Passed to condvis:::spineplot2.

Value

Produces a plot, and returns a list containing the relevant information to update the plot at a later stage.

References

O'Connell M, Hurley CB and Domijan K (2017). ``Conditional Visualization for Statistical Models: An Introduction to the condvis Package in R.''Journal of Statistical Software, 81(5), pp. 1-20. <URL:http://dx.doi.org/10.18637/jss.v081.i05>.

See Also

ceplot, plotxs.

plotxs, ceplot, condtour

Examples

Run this code
# NOT RUN {
## 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")

## Effect of 'trim'.

x <- c(-200, runif(400), 200)
plotxc(x, 0.5, trim = FALSE, select.colour = "red")
plotxc(x, 0.5, trim = TRUE, select.colour = "red")

# }

Run the code above in your browser using DataLab