How to use the d3-scale-chromatic.interpolateInferno function in d3-scale-chromatic

To help you get started, we’ve selected a few d3-scale-chromatic examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github artic-network / rampart / server / colours.js View on Github external
/**
 * A list of available colours for the app.
 * All colours (references & samples) _must_ be included
 * here, else the colour picker won't work.
 * 
 * The colour picker fits 6 panels across (2 rows down)
 */
const availableColours = [
  /* ROW 1 */
  _interpolatorToArray(chromatic.interpolateYlGnBu, 10, 1, 1),
  _interpolatorToArray(chromatic.interpolateRdYlBu, 10, 0, 1),
  _interpolatorToArray(chromatic.interpolateViridis, 10, 1, 0),
  _interpolatorToArray(chromatic.interpolateCool, 10, 0, 0),
  _interpolatorToArray(chromatic.interpolateRainbow, 10, 0, 1),
  _interpolatorToArray(chromatic.interpolateInferno, 10, 3, 0),
  /* ROW 2 */
  _interpolatorToArray(chromatic.interpolateYlOrRd, 10, 0, 1),
  _interpolatorToArray(chromatic.interpolatePuBu, 10, 2, 1),
  _interpolatorToArray(chromatic.interpolatePuRd, 10, 2, 1),
  _interpolatorToArray(chromatic.interpolateBuPu, 10, 2, 1),
  _interpolatorToArray(chromatic.interpolateYlGn, 10, 2, 1),
  _interpolatorToArray(chromatic.interpolateGreys, 10, 0, 1, 0),
]


/**
 * Reference colours are picked from the availableColours by going "across" the 
 * second set of panels (i.e. the second "row" of swatches in the colour picker).
 * When we have gone across this, we repeat the progress at a higher index.
 * Loops around so that while colours will eventually repeat, they will never be undefined.
 */
github artic-network / rampart / src / utils / colours.js View on Github external
/**
 * A list of available colours for the app.
 * All colours (references & samples) _must_ be included
 * here, else the colour picker won't work.
 * 
 * The colour picker fits 6 panels across (2 rows down)
 */
export const availableColours = [
  /* ROW 1 */
  _interpolatorToArray(chromatic.interpolateYlGnBu, 10, 1, 1),
  _interpolatorToArray(chromatic.interpolateRdYlBu, 10, 0, 1),
  _interpolatorToArray(chromatic.interpolateViridis, 10, 1, 0),
  _interpolatorToArray(chromatic.interpolateCool, 10, 0, 0),
  _interpolatorToArray(chromatic.interpolateRainbow, 10, 0, 1),
  _interpolatorToArray(chromatic.interpolateInferno, 10, 3, 0),
  /* ROW 2 */
  _interpolatorToArray(chromatic.interpolateYlOrRd, 10, 0, 1),
  _interpolatorToArray(chromatic.interpolatePuBu, 10, 2, 1),
  _interpolatorToArray(chromatic.interpolatePuRd, 10, 2, 1),
  _interpolatorToArray(chromatic.interpolateBuPu, 10, 2, 1),
  _interpolatorToArray(chromatic.interpolateYlGn, 10, 2, 1),
  _interpolatorToArray(chromatic.interpolateGreys, 10, 0, 1, 0),
];


/**
 * Reference colours are picked from the availableColours by going "across" the 
 * second set of panels (i.e. the second "row" of swatches in the colour picker).
 * When we have gone across this, we repeat the progress at a higher index.
 * Loops around so that while colours will eventually repeat, they will never be undefined.
 */
github vega / vega / packages / vega-scale / src / schemes.js View on Github external
pastel2:     _.schemePastel2,
  set1:        _.schemeSet1,
  set2:        _.schemeSet2,
  set3:        _.schemeSet3,

  // additional categorical palettes
  category20:  category20,
  category20b: category20b,
  category20c: category20c,
  tableau10:   tableau10,
  tableau20:   tableau20,

  // sequential multi-hue interpolators
  viridis:     _.interpolateViridis,
  magma:       _.interpolateMagma,
  inferno:     _.interpolateInferno,
  plasma:      _.interpolatePlasma,

  // Tableau density map schemes
  density_light_orange:     density_light_orange,
  density_light_grayred:    density_light_grayred,
  density_light_blueteal:   density_light_blueteal,
  density_light_grayteal:   density_light_grayteal,
  density_light_multicolor: density_light_multicolor,
  density_dark_blue:        density_dark_blue,
  density_dark_red:         density_dark_red,
  density_dark_green:       density_dark_green,
  density_dark_gold:        density_dark_gold,
  density_dark_multicolor:  density_dark_multicolor,

  // Tableau symbol schemes
  tableau_blue:         blue,
github idekerlab / hiview / frontend / src / actions / raw-interactions-util.js View on Github external
maxScore,
    mainEdgeType,
    barCount2,
    true,
    colorMap
  )
  network.data['subEdgeScoreDist'] = subData.result
  network.data['maxFrequency'] = subData.maxFrequency
  network.data['edgeScoreRange'] = [subMin, maxScore]
  network.data['edgeColorMap'] = colorMap

  const subsetLen = subset.length
  const nodeSet = new Set()

  const colorGenerator = d3Scale
    .scaleSequential(d3ScaleChromatic.interpolateInferno)
    .domain([subMin, maxScore])

  for (let i = 0; i < subsetLen; i++) {
    const edge = subset[i]
    // Assign color
    if (parentScore) {
      assignColor(colorMap, edge, mainEdgeType)
    } else {
      const weight = edge.data[mainEdgeType]
      let newColor = colorGenerator(weight)
      if(newColor === undefined) {
        newColor = DEF_COLOR
      }
      edge.data['color'] = newColor
      edge.data['zIndex'] = calculateZindex(weight, edge, mainEdgeType)
    }
github idekerlab / hiview / frontend / src / actions / raw-interactions-util.js View on Github external
const createBuckets = (
  edges,
  min,
  max,
  scoreFieldName,
  sliceCount = 200,
  coloring = false,
  colorMap
) => {
  const colorScale = d3Scale
    .scaleSequential(d3ScaleChromatic.interpolateInferno)
    .domain([min, max])

  const range = max - min
  const delta = range / sliceCount

  let maxFrequency = 0

  let edgeCount = edges.length

  let curRange = min + delta
  let bucketCounter = 0
  const result = []
  while (edgeCount--) {
    const score = edges[edgeCount].data[scoreFieldName]
    if (score < curRange) {
      bucketCounter++