expand_range | R Documentation |
Expand numeric range
expand_range(x, expand_fraction = 0.1, minimum_range = 0.01, ...)
x |
|
expand_fraction |
|
minimum_range |
|
... |
additional arguments are ignored. |
This function takes a numeric
range (or numeric vector
and calculates its range) and expands this range by
a fraction given by expand_fraction
.
When the input range is zero, the minimum absolute range
can be given by minimum_range
.
The input may be a list
that contains numeric
vectors,
in which case the list
will be iterated to produce an
expanded range for each numeric
vector. Each numeric
vector is expanded independently.
This function is intended to be a simple technique to expand x-axis and y-axis ranges of a graphical plot.
numeric
vector, or when input x
is list
the
output will also be a list
of numeric
vectors.
The numeric vector will contain the range after
expansion.
Other venndir utility:
curate_venn_labels()
,
make_color_contrast()
,
make_venn_combn_df()
,
make_venn_test()
,
match_list()
,
nudge_venndir_label()
,
print_color_df()
,
shrink_df()
,
three_point_angle()
,
venndir_legender()
,
venndir_to_df()
x <- c(0, 10);
# expand the total range by 0.1
expand_range(x, 0.1);
# the original range is 10 units
diff(x);
# the expanded range is 11 units
diff(expand_range(x, 0.1));
# expand one side but not the other
expand_range(x, c(0.1, 0));
# this new range is 11 units
diff(expand_range(x, c(0.1, 0)))
# input with no range is extended to some minimum value
expand_range(1, minimum_range=1)
expand_range(1, minimum_range=c(1, 0))
# list input is iterated, for example xlim, ylim
xlim <- c(1, 10)
ylim <- c(1, 100)
expand_range(list(xlim=xlim, ylim=ylim))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.