Preview colors arranged according to CIE2000 distances or manual specification.
vector of R colors
either "grid", "MDS", or "manual", see details
optional vector of labels, disabled when length(cols) > 5000
scaling factor for labels
integer vector used to order colors
number of rows used by "grid" method
number of columns used by "grid" method
border color used by "grid" method
point scaling factor used by "MDS" method
point symbol used by "MDS" method
When method = "grid" or "manual"
a vector of color order is returned. When method = "MDS"
, the output from MASS::cmdscale
.
Color sorting is based on CIE2000 distances as calculated by farver::compare_colour()
. The "grid" method arranges colors in a rectangular grid with ordering based on divisive hierarchical clustering of the pair-wise distances. Unique colors are used when cols
contains more than 5,000 colors.
The "MDS" method arranges unique colors via classical multidimensional scaling (principal coordinates) via cmdscale()
.
Colors can be manually arranged by supplying a vector of integers to col.order
and setting method='manual'
.
# example data
data(sp2)
# convert into SoilProfileCollection object
depths(sp2) <- id ~ top + bottom
previewColors(sp2$soil_color)
previewColors(sp2$soil_color, method = 'MDS', pt.cex = 3)
# create colors using HCL space
cols.hcl <- hcl(h = 0:360, c = 100, l = 50)
# grid, colors sorted by dE00
previewColors(cols.hcl)
# manual specification
previewColors(cols.hcl, method = 'manual', col.order = 1:361)
# MDS
previewColors(cols.hcl, method = 'MDS', pt.cex = 1)