diamondCoordinates {ufs} | R Documentation |
Basic ggplot2 diamond plot layer construction functions
Description
These functions are used by diamondPlot()
to construct a diamond
plot. It's normally not necessary to call this function directly: instead,
use meansDiamondPlot()
, meanSDtoDiamondPlot()
, and
factorLoadingDiamondCIplot()
.
Usage
diamondCoordinates(
values,
otherAxisValue = 1,
direction = "horizontal",
autoSize = NULL,
fixedSize = 0.15
)
ggDiamondLayer(
data,
ciCols = 1:3,
colorCol = NULL,
generateColors = NULL,
fullColorRange = NULL,
color = "black",
lineColor = NA,
otherAxisCol = 1:nrow(data),
autoSize = NULL,
fixedSize = 0.15,
direction = "horizontal",
...
)
rawDataDiamondLayer(
dat,
items = NULL,
itemOrder = 1:length(items),
dataAlpha = 0.1,
dataColor = "#444444",
jitterWidth = 0.5,
jitterHeight = 0.4,
size = 3,
...
)
varsToDiamondPlotDf(
dat,
items = NULL,
labels = NULL,
decreasing = NULL,
conf.level = 0.95
)
Arguments
values |
A vector of 2 or more values that are used to construct the diamond coordinates. If three values are provided, the middle one becomes the diamond's center. If two, four, or more values are provided, the median becomes the diamond's center. |
otherAxisValue |
The value on the other axis to use to compute the
coordinates; this will be the Y axis value of the points of the diamond (if
|
direction |
Whether the diamonds should be constructed horizontally or vertically. |
autoSize |
Whether to make the height of each diamond conditional upon its length (the width of the confidence interval). |
fixedSize |
If not using relative heights, |
data , dat |
A dataframe (or matrix) containing lower bounds, centers
(e.g. means), and upper bounds of intervals (e.g. confidence intervals) for
|
ciCols |
The columns in the dataframe with the lower bounds, centers (e.g. means), and upper bounds (in that order). |
colorCol |
The column in the dataframe containing the colors for each diamond, or a vector with colors (with as many elements as the dataframe has rows). |
generateColors |
A vector with colors to use to generate a gradient.
These colors must be valid arguments to |
fullColorRange |
When specifying a gradient using
|
color |
When no colors are automatically generated, all diamonds will have this color. |
lineColor |
If NA, lines will have the same colors as the diamonds'
fill. If not NA, must be a valid color, which is then used as line color.
Note that e.g. |
otherAxisCol |
A vector of values, or the index of the column in the dataframe, that specifies the values for the Y axis of the diamonds. This should normally just be a vector of consecutive integers. |
... |
Any additional arguments are passed to
|
items |
The items from the dataframe to include in the diamondplot or dataframe. |
itemOrder |
Order of the items to use (if not sorting). |
dataAlpha |
This determines the alpha (transparency) of the data points. |
dataColor |
The color of the data points. |
jitterWidth |
How much to jitter the individual datapoints horizontally. |
jitterHeight |
How much to jitter the individual datapoints vertically. |
size |
The size of the data points. |
labels |
The item labels to add to the dataframe. |
decreasing |
Whether to sort the items (rows) in the dataframe decreasing (TRUE), increasing (FALSE), or not at all (NULL). |
conf.level |
The confidence of the confidence intervals. |
Value
ggDiamondLayer
returns a ggplot()
geom_polygon()
object, which can then be used in
ggplot()
plots (as diamondPlot()
does).
diamondCoordinates
returns a set of four coordinates that together
specify a diamond.
varsToDiamondPlotDf
returns a dataframe of diamondCoordinates.
rawDataDiamondLayer
returns a geom_jitter()
object.
Author(s)
Gjalt-Jorn Peters
Maintainer: Gjalt-Jorn Peters gjalt-jorn@userfriendlyscience.com
See Also
meansDiamondPlot()
, meanSDtoDiamondPlot()
,
factorLoadingDiamondCIplot()
, diamondPlot()
Examples
## Not run:
### (Don't run this example as a test, because we
### need the ggplot function which isn't part of
### this package.)
### The coordinates for a simple diamond
diamondCoordinates(values = c(1,2,3));
### Plot this diamond
ggplot() + ggDiamondLayer(data.frame(1,2,3));
## End(Not run)