The adjust function is used to nudge data. It is often necessary when using fig_interval grouped by color.

Warning

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.

Dodge

g2(df, asp(x, y, color = "grp")) %>% 
  fig_interval(adjust("dodge"))

Stack

g2(df, asp(x, y, color = "grp")) %>% 
  fig_interval(adjust("stack"))

Symmetric

Note you can use multiple adjust in the same figure.

g2(df, asp(x, y, color = "grp")) %>% 
  fig_interval(adjust("stack"), adjust("symmetric"))

Jitter

g2(cars, asp(dist, speed)) %>% 
  fig_point(asp(shape = "circle")) %>% 
  fig_point(adjust("jitter"))