Alex Lungu
Alex Lungu

Reputation: 1114

Represent CIE 1931 color space

I have some XYZ coordinates that I want to represent in the CIE 1931 color space, like so:

CIE color space diagram, source https://commons.wikimedia.org/wiki/File:CIExy1931_MacAdam.png

I need the diagrams but I couldn't find any possible way to represent it online or with R. Do you know how to do it or if it's even possible?

Upvotes: 2

Views: 2147

Answers (1)

Droplet
Droplet

Reputation: 1125

You can use the package pavo. More specifically, you're looking for the cieplot() function.

It's designed to work with specific S3 objects (results of the colspace()) but since you say you already have the coordinates, we'll have to work around it:

# Generate a fake dataset
set.seed(20190320)
coldat <- as.data.frame(matrix(runif(n = 30, min = 0.15, max = 0.5), nrow = 10, ncol = 3))

# Make sure this dataset works with the cieplot() function
attr(coldat, "clrsp") <- "CIEXYZ"
colnames(coldat) <- c("x", "y", "z")

cieplot(coldat)

result of cieplot() function

Upvotes: 1

Related Questions