The adjust
function is used to nudge data. It is often necessary when using fig_interval
grouped by color
.
The graph below is erroneous.
df <- data.frame(
x = rep(letters, 3),
y = runif(78),
grp = rep(c("A", "B", "C"), each = 26)
)
g2(df, asp(x, y, color = "grp")) %>%
fig_interval()
The above is wrong as bars are overlapping.
g2(df, asp(x, y, color = "grp")) %>%
fig_interval(adjust("dodge"))
g2(df, asp(x, y, color = "grp")) %>%
fig_interval(adjust("stack"))
Note you can use multiple adjust
in the same figure.
g2(df, asp(x, y, color = "grp")) %>%
fig_interval(adjust("stack"), adjust("symmetric"))