File:CIE 1931 RGB colour matching functions.svg

Summary

 
The SVG code is valid.
 
This chart was created with R.
Category:Valid SVG created with R code#CIE%201931%20RGB%20colour%20matching%20functions.svg
Description
English: This figures is a plot of the CIE 1931 RGB colour matching functions. It was generated using a self-written R script and data from the CVRL Database.
Date
Source Own work
Author J.Voss
Source code
InfoField

R code

url <- "https://www.cvrl.org/database/data/cmfs/ciexyz31_1.csv"
data <- read.csv(url, header = FALSE)
names(data) <- c("wavelength", "r", "g", "b")

r_bar <- data$r / sum(data$r)
g_bar <- data$g / sum(data$g)
b_bar <- data$b / sum(data$b)

# png("ciexyz31_1.png", width = 800, height = 600, res = 100)
svg("ciexyz31_1.svg", width = 8, height = 6)
par(mai = c(0.9, 0.1, 0.1, 0.1),
    lwd = 3)

plot(data$wavelength, r_bar,
     bty = "n", type = "l", col = "red",
     yaxt = "n", ylim = range(b_bar), ylab = "",
     xlim = c(380, 720),
     xlab = expression(paste("wavelength ", lambda, " [nm]")),
     cex.lab = 1.3)
box(lwd = 1)
abline(h = 0, lwd = 1)
axis(side = 1, at = seq(min(data$wavelength), max(data$wavelength), by = 10),
     labels = FALSE, tck = -0.015)
lines(data$wavelength, g_bar, col = "darkgreen")
lines(data$wavelength, b_bar, col = "blue")

legend("topright",
       legend = c(expression(bar(r)(lambda)),
                  expression(bar(g)(lambda)),
                  expression(bar(b)(lambda))),
       col = c("red", "darkgreen", "blue"), lty = 1,
       y.intersp = 1.5, inset = 0.09, cex = 1.3,
       bty = "n")

invisible(dev.off())

Licensing

I, the copyright holder of this work, hereby publish it under the following license:
Creative Commons CC-Zero This file is made available under the Creative Commons CC0 1.0 Universal Public Domain Dedication.
The person who associated a work with this deed has dedicated the work to the public domain by waiving all of their rights to the work worldwide under copyright law, including all related and neighboring rights, to the extent allowed by law. You can copy, modify, distribute and perform the work, even for commercial purposes, all without asking permission.

Category:CC-Zero#CIE%201931%20RGB%20colour%20matching%20functions.svg
Category:Self-published work Category:Color management
Category:CC-Zero Category:Color management Category:Self-published work Category:Valid SVG created with R code