Learn R Programming

loon (version 1.4.1)

l_pairs: An interactive scatterplot matrix

Description

Function creates a scatterplot matrix using loon's scatterplot widgets

Usage

l_pairs(
  data,
  connectedScales = c("cross", "none"),
  linkingGroup,
  linkingKey,
  showItemLabels = TRUE,
  itemLabel,
  showHistograms = FALSE,
  histLocation = c("edge", "diag"),
  histHeightProp = 1,
  histArgs = list(),
  showSerialAxes = FALSE,
  serialAxesArgs = list(),
  parent = NULL,
  plotWidth = 100,
  plotHeight = 100,
  span = 10L,
  showProgressBar = TRUE,
  ...
)

Value

an `l_pairs` object (an `l_compound` object), being a list with named elements, each representing a separate interactive plot. The names of the plots should be self explanatory and a list of all plots can be accessed from the `l_pairs` object via `l_getPlots()`. All plots are linked by default (name taken from data set if not provided). Panning and zooming are constrained to work together within the scatterplot matrix (and histograms).

Arguments

data

a data.frame with numerical data to create the scatterplot matrix

connectedScales

Determines how the scales of the panels are to be connected.

  • "cross": only the scales in the same row and the same column are connected;

  • "none": neither "x" nor "y" scales are connected in any panels.

linkingGroup

string giving the linkingGroup for all plots. If missing, a default linkingGroup will be determined from deparsing the data.

linkingKey

a vector of strings to provide a linking identity for each row of the data data.frame. If missing, a default linkingKey will be 0:(nrows(data)-1).

showItemLabels

TRUE, logical indicating whether its itemLabel pops up over a point when the mouse hovers over it.

itemLabel

a vector of strings to be used as pop up information when the mouse hovers over a point. If missing, the default itemLabel will be the row.names(data).

showHistograms

logical (default FALSE) to show histograms of each variable or not

histLocation

one "edge" or "diag", when showHistograms = TRUE

histHeightProp

a positive number giving the height of the histograms as a proportion of the height of the scatterplots

histArgs

additional arguments to modify the `l_hist` states

showSerialAxes

logical (default FALSE) indication of whether to show a serial axes plot in the bottom left of the pairs plot (or not)

serialAxesArgs

additional arguments to modify the `l_serialaxes` states

parent

a valid Tk parent widget path. When the parent widget is specified (i.e. not NULL) then the plot widget needs to be placed using some geometry manager like tkpack or tkplace in order to be displayed. See the examples below.

plotWidth

default plot width (in pixel)

plotHeight

default plot height (in pixel)

span

How many column/row occupies for each widget

showProgressBar

Logical; show progress bar or not

...

named arguments to modify the `l_plot` states of the scatterplots

See Also

l_plot and l_getPlots

Examples

Run this code
if(interactive()){

p <- l_pairs(iris[,-5], color=iris$Species, linkingGroup = "iris")

p <- l_pairs(iris[,-5], color=iris$Species, linkingGroup = "iris",
             showHistograms = TRUE, showSerialAxes = TRUE)
# plot names
names(p)

# Each plot must be accessed to make changes not managed through
# linking.
# E.g. to change the glyph on all scatterplots to open circles
for (plot in l_getPlots(p)) {
      if (is(plot, "l_plot")) {
          plot["glyph"] <- "ocircle"}
}

}

Run the code above in your browser using DataLab