GithubHelp home page GithubHelp logo

Comments (7)

susielu avatar susielu commented on June 15, 2024 1

Hmm interesting okay these last two examples make more sense to me than the original one. Will think about how this should be implemented. Thanks for the feedback. Feel free to post a pull request if any of you think of a way to implement this.

from d3-legend.

syntagmatic avatar syntagmatic commented on June 15, 2024 1

Here's a simpler prototype with a function to generate a continuous color legend from a D3 color scale: http://bl.ocks.org/syntagmatic/e8ccca52559796be775553b467593a9f

var colorScale = d3.scaleSequential(d3.interpolatePlasma)
  .domain([0, 20]);

continuous("#legend", colorScale);

screen shot 2016-10-17 at 2 43 05 pm

from d3-legend.

letmaik avatar letmaik commented on June 15, 2024

+1 Example use case:

infrared

from d3-legend.

curran avatar curran commented on June 15, 2024

I have been studying this D3 Heatmap example, which also uses a continuous color scale. I was confused by the legend there because it shows discrete values for colors, but the actual scale is a continuous interpolation between two colors. A better legend representation would be exactly what you describe here - a continuously varying color ramp with tick marks.

from d3-legend.

syntagmatic avatar syntagmatic commented on June 15, 2024

Some sample D3 code for a similar color scale as the heatmap @letmaik posted:

screen shot 2016-10-17 at 1 28 39 pm

from d3-legend.

susielu avatar susielu commented on June 15, 2024

Awesome, thank you Kai!

from d3-legend.

susielu avatar susielu commented on June 15, 2024

I won't be adding this feature into d3 legend however in the latest version (2.24.0) you can use d3.scaleSequential to create a legend with steps in this scale. Here's an example: http://d3-legend.susielu.com/#color-sequential

from d3-legend.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.