Re: [R] CIE Diagram with wavelengths tick marks
Hy Ken, Thanks for your answer. Your assumptions are correct, i wan to plot a CIE 1931 2 deg standard. I am aware of the possibility to calculate the tick marks and its orientation by some calculation. But before that, i wanted to ask whether there is something ready out there. Ans thanks for the Code, it helped me on another problem. best Tilmann On 20.07.23 14:42, Kenneth Knoblauch wrote: Hi, I'm assuming that by CIE Diagram, you mean the 1931 2 deg standard. Tables of these (and other CIE standards) can be found at the site http://www.cvrl.org maintained by Andrew Stockman. You can find and download these classic CIE data and more modern versions from there. Since you have plotted the spectrum locus of the chromaticity diagram (I'm supposing), you ought to be able to just pick off the wavelengths that you want and add a small point or a small line as a tick mark. If you want it oriented, you'll have to do a little calculation to get the direction perpendicular to the spectrum locus at each wavelength, but that's not too complicated. I recently needed a figure for a talk and downloaded the 2 deg 1931 data from the above website and used points to indicate specific wavelengths that interested me. The code is below: d <- read.csv("ciexyz31_1.csv", header = FALSE, stringsAsFactors = TRUE) names(d) <- c("Wavelength", "X", "Y", "Z") d$x <- with(d, X/(X + Y + Z)) d$y <- with(d, Y/(X + Y + Z)) par(pty = "s") plot(y ~ x, d, type = "l", axes = 'FALSE', xlim = c(0, 1), ylim = c(0, 1)) lines(y[c(1, nrow(d))]~ x[c(1, nrow(d))], d) axis(1, seq(0, 1, 0.2)) axis(2, seq(0, 1, 0.2)) lines(c(0, 1), c(1, 0), col = "blue", lwd = 2, lty = 2) points(d[d$Wavelength == 555, ]$x, d[d$Wavelength == 555, ]$y, pch = 16, col = "green") points(d[d$Wavelength == 589, ]$x, d[d$Wavelength == 589, ]$y, pch = 16, col = "yellow") points(d[d$Wavelength == 670, ]$x, d[d$Wavelength == 670, ]$y, pch = 16, col = "red") Good luck. best, Ken # Hy, # for plotting CIE Diagrams i found Package pavo with function cieplot. # That works fine. # Now i want to have wavelength tick marks as well around the plotting area. # Is there a way to do so, also other ways/Pakages to plot are welcome. # My sample Code: # library(pavo) # coldat2 <- as.data.frame(matrix(rep(1/3, 3), nrow = 1, ncol = 3)) # # Make sure this dataset works with the cieplot() function # attr(coldat2, "clrsp") <- "CIEXYZ" # colnames(coldat2) <- c("x", "y", "z") # cieplot(coldat2, col="white", main="CIE Test Plot") # Best regards # Tilmann ___ Kenneth Knoblauch Inserm U1208 Stem-cell and Brain Research Institute 18 avenue du Doyen Lépine 69500 Bron France tel: +33 (0)4 72 91 34 77 fax: +33 (0)4 72 91 34 61 portable: +33 (0)6 84 10 64 10 https://sbri.fr/public-profile/63/single-member/ __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] CIE Diagram with wavelengths tick marks
Hi, I'm assuming that by CIE Diagram, you mean the 1931 2 deg standard. Tables of these (and other CIE standards) can be found at the site http://www.cvrl.org maintained by Andrew Stockman. You can find and download these classic CIE data and more modern versions from there. Since you have plotted the spectrum locus of the chromaticity diagram (I'm supposing), you ought to be able to just pick off the wavelengths that you want and add a small point or a small line as a tick mark. If you want it oriented, you'll have to do a little calculation to get the direction perpendicular to the spectrum locus at each wavelength, but that's not too complicated. I recently needed a figure for a talk and downloaded the 2 deg 1931 data from the above website and used points to indicate specific wavelengths that interested me. The code is below: d <- read.csv("ciexyz31_1.csv", header = FALSE, stringsAsFactors = TRUE) names(d) <- c("Wavelength", "X", "Y", "Z") d$x <- with(d, X/(X + Y + Z)) d$y <- with(d, Y/(X + Y + Z)) par(pty = "s") plot(y ~ x, d, type = "l", axes = 'FALSE', xlim = c(0, 1), ylim = c(0, 1)) lines(y[c(1, nrow(d))]~ x[c(1, nrow(d))], d) axis(1, seq(0, 1, 0.2)) axis(2, seq(0, 1, 0.2)) lines(c(0, 1), c(1, 0), col = "blue", lwd = 2, lty = 2) points(d[d$Wavelength == 555, ]$x, d[d$Wavelength == 555, ]$y, pch = 16, col = "green") points(d[d$Wavelength == 589, ]$x, d[d$Wavelength == 589, ]$y, pch = 16, col = "yellow") points(d[d$Wavelength == 670, ]$x, d[d$Wavelength == 670, ]$y, pch = 16, col = "red") Good luck. best, Ken # Hy, # for plotting CIE Diagrams i found Package pavo with function cieplot. # That works fine. # Now i want to have wavelength tick marks as well around the plotting area. # Is there a way to do so, also other ways/Pakages to plot are welcome. # My sample Code: # library(pavo) # coldat2 <- as.data.frame(matrix(rep(1/3, 3), nrow = 1, ncol = 3)) # # Make sure this dataset works with the cieplot() function # attr(coldat2, "clrsp") <- "CIEXYZ" # colnames(coldat2) <- c("x", "y", "z") # cieplot(coldat2, col="white", main="CIE Test Plot") # Best regards # Tilmann ___ Kenneth Knoblauch Inserm U1208 Stem-cell and Brain Research Institute 18 avenue du Doyen Lépine 69500 Bron France tel: +33 (0)4 72 91 34 77 fax: +33 (0)4 72 91 34 61 portable: +33 (0)6 84 10 64 10 https://sbri.fr/public-profile/63/single-member/ __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] CIE Diagram with wavelengths tick marks
Hy, for plotting CIE Diagrams i found Package pavo with function cieplot. That works fine. Now i want to have wavelength tick marks as well around the plotting area. Is there a way to do so, also other ways/Pakages to plot are welcome. My sample Code: library(pavo) coldat2 <- as.data.frame(matrix(rep(1/3, 3), nrow = 1, ncol = 3)) # Make sure this dataset works with the cieplot() function attr(coldat2, "clrsp") <- "CIEXYZ" colnames(coldat2) <- c("x", "y", "z") cieplot(coldat2, col="white", main="CIE Test Plot") Best regards Tilmann __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.