How to randomize ggplot factor color scheme, keeping same default distances on color wheel?

The scale_fill_hue() function can take a h.start= parameter to choose where you pick the first color (as described on the ?scale_fill_hue help page)

ggplot(xdf, aes(x = X1, y = freq)) + 
  geom_col(aes(fill = factor(X8)), position = 'dodge')+
  scale_fill_hue(h.start = 120)

Leave a Comment