pancakes | R Documentation |
This function plots two horizontal barplots back-to-back.
pancakes(
x1,
x2,
sameScale = TRUE,
xlim1 = NULL,
xlim2 = NULL,
tickLabelOffset = -0.05,
xlab1 = "x1",
xlab2 = "x2",
xlab = NULL,
xlabOffset = -0.12,
tickSize = 0.01,
labels = NULL,
labelSide = "both",
cexLab = 1,
col1 = "gray70",
col2 = "gray30",
border1 = "black",
border2 = "black",
...
)
x1 |
Numeric, vector of values for the left-hand side of the plot. Values are plotted such that the first is represented by the lowest bar, the second the next-higher bar, and so on. |
x2 |
Numeric, vector of values for the right-hand side of the plot, must be same length as |
sameScale |
Logical, if |
xlim1, xlim2 |
Two numeric values defining the x-axis limits for |
tickLabelOffset |
Numeric, offset (in y-direction) of labels for x-axis tick marks. |
xlab1, xlab2 |
Characters, names of each x-axis label. Note that by default these are used but if |
xlab |
Character, name of x-axis label. |
xlabOffset |
Numeric, offset (in y-direction) of x-axis label(s). |
tickSize |
Numeric, relative size of tick marks. Positive numbers grow them longer from the bottom of the x-axis, negative upward. |
labels |
Vector of same length as |
labelSide |
Character, either |
cexLab |
Either |
col1, col2 |
Colors of bars. |
border1, border2 |
Border colors of bars. |
... |
Arguments to pass to |
labelOffset |
Numeric, offset (from border or plot region) for positioning of labels. Positive numbers move labels outward, negative inward. |
If you want to add elements (e.g., arrows) to the plot, then note that the x-axis is scaled fromm -1 to 1 with the two sets of bar plots abutting one another at x = 0. The y-axis is scaled from 0 to 1.
None. Side-effect is to generate a plot.
barplot
x1 <- 10:1
x2 <- sample(11:20, 10)
labels <- LETTERS[10:1]
pancakes(x1, x2, labels = labels)
pancakes(x1, x2, sameScale = FALSE, labels=labels)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.