2

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?

4
  • I do not fully understand what you want to do. If it is just achieving the appropriate color conversion you can use the convertColor() function already implemented in R. There is also a whole package on Cran colorspace that allows you to do this and a lot more. Commented Aug 7, 2014 at 14:42
  • I already have the correct coordinates. I just want to plot them like this ej.iop.org/images/0022-3727/45/32/325105/Full/…
    – Alex Lungu
    Commented Aug 7, 2014 at 15:01
  • 2
    Unless you provide the coordinates I suspect it will be hard to help you. There is however a little set of slides I remember that contains the code to plot chromaticity diagrams. The bare plotting code they used is provided on pp. 24-25. Commented Aug 7, 2014 at 15:21
  • See package colorscience.
    – David.
    Commented Jul 10, 2016 at 19:55

1 Answer 1

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.