# Using default colours
yw <- ud_prep(CPIuk, weight="Weight", v1="Aug2017", v2="Aug2018",
levs=c("Sector"), sortLev=c("perc"))
y2 <- ud_plot(yw, labelvar="Sector")
y2$uadl
# Using individually chosen colours
library(ggthemes)
y2a <- ud_plot(yw, ud_control=ud_colours(colours = c("lightblue1", "grey50",
"red4", "blue", "brown")))
y2a$uad
# Using barColour and the default palette
# A random palette from colorspace is used as there are more than 8 sectors.
y2b <- ud_plot(yw, barColour="Sector")
y2b$uad
# Using barColour and a specified palette
y2c <- ud_plot(yw, levelColour="Sector", ud_control=ud_colours(
gcpal=sample(colorspace::qualitative_hcl(n = 20, l = 80))))
y2c$uad
Run the code above in your browser using DataLab