Skip to content

Instantly share code, notes, and snippets.

@danlewer
Created June 1, 2025 19:28
Show Gist options
  • Select an option

  • Save danlewer/c5b441a6d75f36e60b830f4fd7c1a240 to your computer and use it in GitHub Desktop.

Select an option

Save danlewer/c5b441a6d75f36e60b830f4fd7c1a240 to your computer and use it in GitHub Desktop.
Simple function to show a vector of colours in a plot device
show_cols <- function (x) {
plot(1, type = 'n', xlim = c(0, length(x)), ylim = c(0, 1), axes = F, xlab = NA, ylab = NA)
rect(0:(length(x)-1), 0, 1:length(x), 1, col = x)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment