get_gg_label {plothelper} | R Documentation |
Checking Min, Max, Labels and Label Positions
Description
Given a numeric vector or a ggplot object, the function will check the range, labels and label positions (the same as major grid lines) that will used on the axis. The result is a length 5 list for min limit, max limit, labels, major grid-line positions, all (major and minor) grid-line positions.
Usage
get_gg_label(
a = NULL,
b = NULL,
v = NULL,
gg = NULL,
mult = 0.05,
add = 0,
axis = "y"
)
Arguments
a |
extreme values of a numeric vector. Note: only
one of |
b |
another extreme value if |
v |
a numeric vector. |
gg |
a gg object created by ggplot function.
Which value will be checked depends on |
mult |
default is 0.05 and should be of length
1 or 2. It mimics the |
add |
default is 0. It mimics the |
axis |
if |
Examples
get_gg_label(a=1, b=1000)
# The following three have the same results.
get_gg_label(a=1, b=1000, mult=0)
get_gg_label(v=c(1, 500, 1000), mult=0)
p=ggplot()+geom_point(aes(1: 3, c(1, 500, 1000)))+
scale_y_continuous(expand=expansion(mult=0))
get_gg_label(gg=p)