Created
January 24, 2013 13:11
-
-
Save gka/4621398 to your computer and use it in GitHub Desktop.
Playing around with CIE Lab colors in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Playing around with CIE Lab colors in R | |
# | |
# load library that provides colorRampPalette | |
library(grDevices) | |
# define function for plotting colors | |
plotColors = function(palette, n=10) { | |
colors = palette(n) | |
barplot(rep(1,n), col=colors, border=colors, space=0, yaxt='n') | |
} | |
# take a look at rgb interpolation | |
pal = colorRampPalette(c("#FF0000", "#0000FF")) | |
plotColors(pal, 5) | |
# and compare it with Lab | |
pal = colorRampPalette(c("#FF0000", "#0000FF"), space="Lab") | |
plotColors(pal, 5) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!