rugTile: Add a rug to a tile plot

Description Usage Arguments Details Value rugTile-specific parameters Author(s) See Also Examples

Description

Initializes plots of marginal distributions along axes for tile plots.

Usage

1

Arguments

...

Any number of arguments given below. Must include exactly one dimension (x, top, y or right). All inputs should be identified by appropriate tags; i.e., use rugTile(x=myxvar), not rugTile(myxvar)

Details

This function does no plotting; instead, it creates a rugTile object, or trace of plotting data, to be drawn on one or more plots in a tiled arrangement of plots. To complete the drawing include the object as an input to tile. From tile, it is possible to set further options including plot and axis titles, axis ranges and labels, logged axes, and annotations to the plot.

rugTile creates a rug, or a plot of a marginal distribution along the axis of a two-dimensional plot, to add to a tile plot. It serves as the tile equivalent to the base graphics rug, and is primarily useful for annotating plots which also use other traces. Note that you may need multiple rug traces to complete your plot: if, for example, the x axes in different plots have different marginal distributions, each will need a separate trace containing the rug data for that plot and axis.

Also note that multiple rugs can be plotted to the same axis and plot, if different marginal distributions are to be compared.

Value

A rugTile object, used only as an input to tile.

rugTile-specific parameters

A call to rugTile must provide (only) one of the following inputs:

x

vector of data to plot to a rug along the x axis.

y

vector of data to plot to a rug along the y axis.

top

vector of data to plot to a rug along the top axis.

right

vector of data to plot to a rug along the right axis.

Users will often wish to provide the following inputs:

type

String indicating the type of rug to draw: lines for thin lines marking each datapoint; dots for a histogram made of dots for each datapoint; jitter for a strip filled with jittered dots for each datapoint; density for a smoothed histogram (experimental). Default is lines.

kernel

The smoothing kernel for density rugs; default is gaussian. See density for other options.

thickness

Scalar, the height of rugs attached to horizontal axes, or the width of rugs attached to vertical axes, in multiples of current character size (char). Default is 1.

plot

scalar or vector, the plot(s) in which this rug will be drawn; defaulting to the first plot. Plots are numbered consecutively from the top left, row-by-row. Thus in a 2 x 3 tiling, the first plot in the second row is plot number 4.

In addition to these rugTile-specific parameters, users may provide any of the generic tile parameters documented in pointsTile.

Author(s)

Christopher Adolph cadolph@u.washington.edu

See Also

tile

Examples

 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
x <- runif(100)
y <- x + rnorm(100)

trace0 <- scatter(top=x,
                  y=y,
                  col="red",
                  pch=1,
                  fit=list(method="linear"),
                  cex=0.25,
                  lwd=0.5,
                  plot = 1)

trace0a <- scatter(x=x,
                  right=y,
                  col="blue",
                  pch=5,
                  fit=list(method="mmest"),
                  cex=0.25,
                  lwd=0.5,
                  plot = 2)


rug1top <- rugTile(top=x, type="jitter",col="black", plot=1)

rug1y <- rugTile(y=y, type="lines", col="gray40", plot=1)

rug2x <- rugTile(x=x, type="dots",col="black", plot=2)

rug2right <- rugTile(right=y, type="density", col="gray40", plot=2)

tile(trace0,trace0a,rug1top,rug1y,rug2x,rug2right,
     frame=TRUE,gridlines=list(type=c("xytr")),
     xaxistitle=list(labels2="X axis label"),
     topaxistitle=list(labels1="Top axis label"),
     rightaxistitle=list(labels2="Right axis label"),
     yaxistitle=list(labels1="Y axis label"),
     plottitle=list(labels1="Plot title 1", labels2="Plot title 2")
     )
     

chrisadolph/tileForShiny documentation built on Feb. 6, 2022, 12:34 a.m.