Draw one-way contrast using block arrows
Usage
draw_oneway_contrast(
x0,
x1,
y0,
y1,
color = "peachpuff",
border = "black",
plot_type = c("base", "grid"),
label = NULL,
label_sep = "\n",
na.rm = TRUE,
label_color = "white",
label_cex = 1,
label_font = 2,
oneway_position = 0.5,
do_plot = TRUE,
verbose = FALSE,
debug = FALSE,
...
)
Arguments
- x0, x1, y0, y1
numeric
values with the start and end coordinates, for the x and y axes, respectively.- color, border
character
R colors used to define color fill and border, respectively, for each block arrow,- plot_type
character
string indicating the type of plot output:"base"
: base R graphics"grid"
: grid graphics (not yet implemented)
- label
character
vector orlist
with optional label to display atop each block arrow. For base R graphics, the label is drawn usingjamba::shadowText()
to render an outline around the text.When
label
is acharacter
vector, it is converted to alist
in two ways depending upon the number of block arrows (length(x0)
):length == 1
:label
is converted tolist
with length == 1.length > 1
:label
is converted tolist
usingas.list
, then expanded tolength(x0)
.
When
label
is passed as alist
, or afterlabel
is converted to alist
:Each block arrow label uses one concatenated string after calling
jamba::cPaste(..., sep=label_sep)
which joins values by default using newline"\n"
between each value.
- label_sep
character
string used as separator, passed tojamba::cPaste()
, so that each block arrow may contain a vector which is concatenated usinglabel_sep
between each value. By defaultlabel_sep="\n"
which prints each value on a new line.- na.rm
logical
passed tojamba::cPaste()
to define how to display NA labels:na.rm=FALSE
:"NA"
na.rm=TRUE
:""
.
- label_color
character
color used for thelabel
.- label_cex
numeric
label font expansion factor, used to adjust the font size of the text label.- label_font
numeric
indicating the font face, defined as:1 = normal font
2 = bold font
3 = italic font
4 = bold, italic font
- do_plot
logical
indicating whether to draw the block arrow.- verbose
logical
indicating whether to print verbose output.- debug
logical
indicating whether to print additional debug info.- ...
additional arguments are passed to
make_block_arrow_polygon()
, includingarrow_ex
the arrow size expansion factor, andhead_ex
the arrow head expansion factor, which is adjusted relative to the arrow stem width.
See also
Other jam experiment design:
check_sedesign()
,
contrast2comp()
,
contrast_colors_by_group()
,
contrast_names_to_sedesign()
,
contrasts_to_factors()
,
contrasts_to_venn_setlists()
,
draw_twoway_contrast()
,
filter_contrast_names()
,
groups_to_sedesign()
,
plot_sedesign()
,
sedesign_to_factors()
,
validate_sedesign()
Examples
plot(NULL, xlim=c(0, 5), ylim=c(0, 4), asp=1, xlab="", ylab="")
draw_oneway_contrast(1, 4, 1, 1, label="contrast label")
draw_oneway_contrast(1, 4, 2, 2, head_ex=2, label_cex=1, label="contrast label")
draw_oneway_contrast(1, 4, 3, 3, arrow_ex=2, label_cex=2, label="contrast label")
draw_oneway_contrast(3, 0, 4, 1, arrow_ex=2, label_cex=2, label="contrast label")