发散方案
¥Diverging schemes
发散配色方案可用作连续插值器(通常与 d3.scaleSequential 一起使用)和离散方案(通常与 d3.scaleOrdinal 一起使用)。
¥Diverging color schemes are available as continuous interpolators (often used with d3.scaleSequential) and as discrete schemes (often used with d3.scaleOrdinal).
每个离散方案(例如 d3.schemeBrBG)都表示为一个由十六进制颜色字符串组成的数组。此数组的第 k 个元素包含大小为 k 的配色方案;例如,d3.schemeBrBG[9]
包含一个由九个字符串组成的数组,代表棕-蓝-绿发散配色方案的九种颜色。发散配色方案支持从 3 到 11 的 k 值。
¥Each discrete scheme, such as d3.schemeBrBG, is represented as an array of arrays of hexadecimal color strings. The kth element of this array contains the color scheme of size k; for example, d3.schemeBrBG[9]
contains an array of nine strings representing the nine colors of the brown-blue-green diverging color scheme. Diverging color schemes support a size k ranging from 3 to 11.
要使用 PiYG 配色方案创建发散连续色阶:
¥To create a diverging continuous color scale using the PiYG color scheme:
const color = d3.scaleSequential(d3.interpolatePiYG);
使用 PiYG 配色方案创建发散离散九色色阶:
¥To create a diverging discrete nine-color scale using the PiYG color scheme:
const color = d3.scaleOrdinal(d3.schemePiYG[9]);
interpolateBrBG(t)
源代码 · 给定一个 [0,1] 范围内的数字 t,返回“BrBG”发散配色方案对应的颜色,并以 RGB 字符串表示。
¥Source · Given a number t in the range [0,1], returns the corresponding color from the “BrBG” diverging color scheme represented as an RGB string.
interpolatePRGn(t)
源代码 · 给定一个 [0,1] 范围内的数字 t,返回以 RGB 字符串表示的“PRGn”发散配色方案中对应的颜色。
¥Source · Given a number t in the range [0,1], returns the corresponding color from the “PRGn” diverging color scheme represented as an RGB string.
interpolatePiYG(t)
源代码 · 给定一个 [0,1] 范围内的数字 t,返回以 RGB 字符串表示的“PiYG”发散配色方案中对应的颜色。
¥Source · Given a number t in the range [0,1], returns the corresponding color from the “PiYG” diverging color scheme represented as an RGB string.
interpolatePuOr(t)
源代码 · 给定一个 [0,1] 范围内的数字 t,返回以 RGB 字符串表示的“PuOr”发散配色方案中对应的颜色。
¥Source · Given a number t in the range [0,1], returns the corresponding color from the “PuOr” diverging color scheme represented as an RGB string.
interpolateRdBu(t)
源代码 · 给定一个 [0,1] 范围内的数字 t,返回以 RGB 字符串表示的“RdBu”发散配色方案中对应的颜色。
¥Source · Given a number t in the range [0,1], returns the corresponding color from the “RdBu” diverging color scheme represented as an RGB string.
interpolateRdGy(t)
源代码 · 给定一个 [0,1] 范围内的数字 t,返回以 RGB 字符串表示的“RdGy”发散配色方案中对应的颜色。
¥Source · Given a number t in the range [0,1], returns the corresponding color from the “RdGy” diverging color scheme represented as an RGB string.
interpolateRdYlBu(t)
源代码 · 给定一个 [0,1] 范围内的数字 t,返回以 RGB 字符串表示的“RdYlBu”发散配色方案中对应的颜色。
¥Source · Given a number t in the range [0,1], returns the corresponding color from the “RdYlBu” diverging color scheme represented as an RGB string.
interpolateRdYlGn(t)
源代码 · 给定一个 [0,1] 范围内的数字 t,返回以 RGB 字符串表示的“RdYlGn”发散配色方案中对应的颜色。
¥Source · Given a number t in the range [0,1], returns the corresponding color from the “RdYlGn” diverging color scheme represented as an RGB string.
interpolateSpectral(t)
源代码 · 给定一个 [0,1] 范围内的数字 t,返回以 RGB 字符串表示的“Spectral”发散配色方案中对应的颜色。
¥Source · Given a number t in the range [0,1], returns the corresponding color from the “Spectral” diverging color scheme represented as an RGB string.
schemeBrBG[k]
源代码 · 3-11 中大小为 k 的“BrBG”离散发散配色方案。
¥Source · The “BrBG” discrete diverging color scheme of size k in 3–11.
schemePRGn[k]
源代码 · 3-11 中大小为 k 的“PRGn”离散发散配色方案。
¥Source · The “PRGn” discrete diverging color scheme of size k in 3–11.
schemePiYG[k]
源代码 · 3-11 中大小为 k 的“PiYG”离散发散配色方案。
¥Source · The “PiYG” discrete diverging color scheme of size k in 3–11.
schemePuOr[k]
源代码 · 3-11 中大小为 k 的“PuOr”离散发散配色方案。
¥Source · The “PuOr” discrete diverging color scheme of size k in 3–11.
schemeRdBu[k]
源代码 · 3-11 版中大小为 k 的“RdBu”离散发散配色方案。
¥Source · The “RdBu” discrete diverging color scheme of size k in 3–11.
schemeRdGy[k]
源代码 · 3-11 版中大小为 k 的“RdGy”离散发散配色方案。
¥Source · The “RdGy” discrete diverging color scheme of size k in 3–11.
schemeRdYlBu[k]
源代码 · 3-11 版中大小为 k 的“RdYlBu”离散发散配色方案。
¥Source · The “RdYlBu” discrete diverging color scheme of size k in 3–11.
schemeRdYlGn[k]
源代码 · 3-11 版中大小为 k 的“RdYlGn”离散发散配色方案。
¥Source · The “RdYlGn” discrete diverging color scheme of size k in 3–11.
schemeSpectral[k]
源代码 · 3-11 中大小为 k 的“光谱”离散发散配色方案。
¥Source · The “Spectral” discrete diverging color scheme of size k in 3–11.