How to use the d3-scale-chromatic.interpolateReds 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 DefinitelyTyped / DefinitelyTyped / types / d3-scale-chromatic / d3-scale-chromatic-tests.ts View on Github external
let PuOr: string = d3ScaleChromatic.interpolatePuOr(0); // rgb(127, 59, 8)
let RdBu: string = d3ScaleChromatic.interpolateRdBu(0); // rgb(103, 0, 31)
let RdGy: string = d3ScaleChromatic.interpolateRdGy(0); // rgb(103, 0, 31)
let RdYlBu: string = d3ScaleChromatic.interpolateRdYlBu(0); // rgb(103, 0, 31)
let RdYlGn: string = d3ScaleChromatic.interpolateRdYlGn(0); // rgb(103, 0, 31)
let Spectral: string = d3ScaleChromatic.interpolateSpectral(0); // rgb(158, 1, 66)

// -----------------------------------------------------------------------
// Sequential
// -----------------------------------------------------------------------
let Blue: string = d3ScaleChromatic.interpolateBlues(1); // rgb(8, 48, 107)
let Green: string = d3ScaleChromatic.interpolateGreens(1); // rgb(0, 68, 27)
let Grey: string = d3ScaleChromatic.interpolateGreys(1); // rgb(0, 0, 0)
let Orange: string = d3ScaleChromatic.interpolateOranges(1); // rgb(127, 39, 4)
let Purple: string = d3ScaleChromatic.interpolatePurples(1); // rgb(63, 0, 125)
let Red: string = d3ScaleChromatic.interpolateReds(1); // rgb(103, 0, 13)

// -----------------------------------------------------------------------
// Sequential(Multi-Hue)
// -----------------------------------------------------------------------
let BuGn: string = d3ScaleChromatic.interpolateBuGn(1); // rgb(0, 68, 27)
let BuPu: string = d3ScaleChromatic.interpolateBuPu(1); // rgb(77, 0, 75)
let GnBu: string = d3ScaleChromatic.interpolateGnBu(1); // rgb(8, 64, 129)
let OrRd: string = d3ScaleChromatic.interpolateOrRd(1); // rgb(127, 0, 0)
let PuBuGn: string = d3ScaleChromatic.interpolatePuBuGn(1); // rgb(1, 70, 54)
let PuBu: string = d3ScaleChromatic.interpolatePuBu(1); // rgb(2, 56, 88)
let PuRd: string = d3ScaleChromatic.interpolatePuRd(1); // rgb(103, 0, 31)
let RdPu: string = d3ScaleChromatic.interpolateRdPu(1); // rgb(73, 0, 106)
let YlGnBu: string = d3ScaleChromatic.interpolateYlGnBu(1); // rgb(8, 29, 88)
let YlGn: string = d3ScaleChromatic.interpolateYlGn(1); // rgb(0, 69, 41)
let YlOrBr: string = d3ScaleChromatic.interpolateYlOrBr(1); // rgb(102, 37, 6)
let YlOrRd: string = d3ScaleChromatic.interpolateYlOrRd(1); // rgb(128, 0, 38)
github Caleydo / lineage / src / mapView.ts View on Github external
.attr('stop-color',interpolateRdBu(0.5))
              for(let i = 1;i<5;i++){
                colorGradient.append('stop')
                             .attr('offset',(mid_percent+0.25*i*(end_percent-mid_percent))+'%')
                             .attr('stop-color',interpolateRdBu(0.5-0.125*i))
              }
             }
             else{
               const interval_range = self.mapManager.tableManager.getAQRange(attributeName)
               const begin_percent = 100-(yLineScale(interval_range[0])-startingHeight)/height*100
               const end_percent = 100-(yLineScale(interval_range[1])-startingHeight)/height*100

               for (let i =0; i < 6; i++){
                 colorGradient.append('stop')
                              .attr('offset',(begin_percent+0.2*i*(end_percent-begin_percent))+'%')
                              .attr('stop-color',interpolateReds(0.2*i))
               }

              }
             graph.select('#color_ramp_'+current_index).attr('fill','url(#linear_gradient_'+current_index+')')
      }


        // graph.selectAll('.place_holder')
        //       .data(singleData)
        //       .enter()
        //       .append('polyline')
        //       .attr('points',(d,i)=>{
        //         let x1,x2,y1,y2,x3,y3;
        //         if (i==0){
        //           x1 = xLineScale(0)
        //           x2 = xLineScale(0.5)
github tensorflow / tfjs-models / universal-sentence-encoder / demo / index.js View on Github external
labelXDom.style.left = (i * cellSize + cellSize / 2) + 'px';
    labelYDom.style.top = (i * cellSize + cellSize / 2) + 'px';

    xLabelsContainer.appendChild(labelXDom);
    yLabelsContainer.appendChild(labelYDom);

    for (let j = i; j < sentences.length; j++) {
      const sentenceI = embeddings.slice([i, 0], [1]);
      const sentenceJ = embeddings.slice([j, 0], [1]);
      const sentenceITranspose = false;
      const sentenceJTransepose = true;
      const score =
          sentenceI.matMul(sentenceJ, sentenceITranspose, sentenceJTransepose)
              .dataSync();

      ctx.fillStyle = interpolateReds(score);
      ctx.fillRect(j * cellSize, i * cellSize, cellSize, cellSize);
      ctx.fillRect(i * cellSize, j * cellSize, cellSize, cellSize);
    }
  }
};