Last active
January 21, 2025 20:20
-
-
Save mbostock/3014589 to your computer and use it in GitHub Desktop.
Revisions
-
mbostock revised this gist
Feb 9, 2016 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1 @@ license: gpl-3.0 -
mbostock revised this gist
Oct 31, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ </style> <body> <script src="//d3js.org/d3.v3.min.js"></script> <script> var spaces = [ -
mbostock revised this gist
Jun 11, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -18,7 +18,7 @@ </style> <body> <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script> <script> var spaces = [ -
mbostock revised this gist
Apr 27, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,6 @@ D3 supports [CIELAB (Lab) and CIELCH (HCL)](http://en.wikipedia.org/wiki/Lab_color_space) color spaces, which are designed for humans rather than computers. Lab and HCL color spaces are special in that the [perceived difference](http://en.wikipedia.org/wiki/Color_difference) between two colors is proportional to their Euclidean distance in color space. This special property, called *perceptual uniformity*, makes them ideal for accurate visual encoding of data. In contrast, the more familiar RGB and HSL color spaces distort data when used for visualization. You can create Lab or HCL colors in D3 directly using [d3.lab](https://github.com/mbostock/d3/wiki/Colors#d3_lab) or [d3.hcl](https://github.com/mbostock/d3/wiki/Colors#d3_hcl). For example: -
mbostock revised this gist
Apr 27, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ D3 supports [CIELAB (Lab) and CIELCH (HCL)](http://en.wikipedia.org/wiki/Lab_color_space) color spaces, which are designed for humans rather than computers. Lab and HCL color spaces are special in that the perceived difference between two colors is proportional to their Euclidean distance in color space. This special property, called *perceptual uniformity*, makes them ideal for accurate visual encoding of data. In contrast, the more familiar RGB and HSL color spaces distort data when used for visualization. -
mbostock revised this gist
Apr 27, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -46,8 +46,8 @@ .attr("class", "space") .style("width", width + "px") .style("height", height + "px") .style("left", margin + "px") .style("top", function(d, i) { return y(d.name) + "px"; }); space.append("canvas") .attr("width", width) -
mbostock revised this gist
Apr 27, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -9,7 +9,7 @@ var steelblue = d3.lab(52, -4, -32); var steelblue = d3.hcl(-97, 32, 52); ``` You can also convert from other color spaces, such as RGB or HSL. This is useful for creating brighter or darker colors with uniform changes in perception: ```javascript var lightsteelblue = d3.lab("#4682b4").brighter(); -
mbostock revised this gist
Apr 27, 2014 . 1 changed file with 6 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,12 +2,6 @@ D3 supports [CIE L\*a\*b\* (Lab)](http://en.wikipedia.org/wiki/Lab_color_space) Lab and HCL color spaces are special in that the perceived difference between two colors is proportional to their Euclidean distance in color space. This special property, called *perceptual uniformity*, makes them ideal for accurate visual encoding of data. In contrast, the more familiar RGB and HSL color spaces distort data when used for visualization. You can create Lab or HCL colors in D3 directly using [d3.lab](https://github.com/mbostock/d3/wiki/Colors#d3_lab) or [d3.hcl](https://github.com/mbostock/d3/wiki/Colors#d3_hcl). For example: ```javascript @@ -31,3 +25,9 @@ var color = d3.scale.linear() ``` By using Lab or HCL color interpolation, you can create custom color scales that are comparable in quality to [Colorbrewer](http://colorbrewer2.org/). For more on this topic: * [Subtleties of Color](http://earthobservatory.nasa.gov/blogs/elegantfigures/2013/08/05/subtleties-of-color-part-1-of-6/) by Robert Simmon * [How To Avoid Equidistant HSV Colors](http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/) by Gregor Aisch * [How The Rainbow Color Map Misleads](http://eagereyes.org/basics/rainbow-color-map) by Robert Kosara -
mbostock revised this gist
Apr 27, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ D3 supports [CIE L\*a\*b\* (Lab)](http://en.wikipedia.org/wiki/Lab_color_space) and [CIE L\*c\*h\* (HCL)](http://en.wikipedia.org/wiki/CIELUV) color spaces, which are designed for humans rather than computers. Lab and HCL color spaces are special in that the perceived difference between two colors is proportional to their Euclidean distance in color space. This special property, called *perceptual uniformity*, makes them ideal for accurate visual encoding of data. In contrast, the more familiar RGB and HSL color spaces distort data when used for visualization. -
mbostock revised this gist
Apr 27, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ D3 supports [CIE L\*a\*b\* (Lab)](http://en.wikipedia.org/wiki/Lab_color_space) and [CIE L\*c\*h\* (HCL)](http://en.wikipedia.org/wiki/CIELUV) — color spaces designed for humans rather than computers. Lab and HCL color spaces are special in that the perceived difference between two colors is proportional to their Euclidean distance in color space. This special property, called *perceptual uniformity*, makes them ideal for accurate visual encoding of data. In contrast, the more familiar RGB and HSL color spaces distort data when used for visualization. -
mbostock revised this gist
Apr 27, 2014 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ } .space { position: absolute; } .space div { @@ -30,7 +30,7 @@ var y = d3.scale.ordinal() .domain(spaces.map(function(d) { return d.name; })) .rangeRoundBands([0, 500], .09); var margin = y.range()[0], width = 960 - margin - margin, @@ -46,7 +46,7 @@ .attr("class", "space") .style("width", width + "px") .style("height", height + "px") .style("top", function(d, i) { return y(d.name) + "px"; }) .style("margin-left", margin + "px"); space.append("canvas") -
mbostock revised this gist
Apr 26, 2014 . 2 changed files with 66 additions and 46 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,14 @@ D3 supports [CIE L\*a\*b\* (Lab)](http://en.wikipedia.org/wiki/Lab_color_space) and [CIE L\*c\*\h* (HCL)](http://en.wikipedia.org/wiki/CIELUV) — color spaces designed for humans rather than computers. Lab and HCL color spaces are special in that the perceived difference between two colors is proportional to their Euclidean distance in color space. This special property, called *perceptual uniformity*, makes them ideal for accurate visual encoding of data. In contrast, the more familiar RGB and HSL color spaces distort data when used for visualization. For more information: * [Subtleties of Color](http://earthobservatory.nasa.gov/blogs/elegantfigures/2013/08/05/subtleties-of-color-part-1-of-6/) by Robert Simmon * [How To Avoid Equidistant HSV Colors](http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/) by Gregor Aisch * [How The Rainbow Color Map Misleads](http://eagereyes.org/basics/rainbow-color-map) by Robert Kosara You can create Lab or HCL colors in D3 directly using [d3.lab](https://github.com/mbostock/d3/wiki/Colors#d3_lab) or [d3.hcl](https://github.com/mbostock/d3/wiki/Colors#d3_hcl). For example: ```javascript var steelblue = d3.lab(52, -4, -32); @@ -14,12 +22,12 @@ var lightsteelblue = d3.lab("#4682b4").brighter(); var darksteelblue = d3.hcl("hsl(207, 44%, 49%)").darker(); ``` Most importantly, you can use [d3.interpolateLab](https://github.com/mbostock/d3/wiki/Transitions#d3_interpolateLab) or [d3.interpolateHcl](https://github.com/mbostock/d3/wiki/Transitions#d3_interpolateHcl) in conjunction with [quantitative scales](https://github.com/mbostock/d3/wiki/Quantitative-Scales) and [transitions](https://github.com/mbostock/d3/wiki/Transitions): ```javascript var color = d3.scale.linear() .range(["steelblue", "brown"]) .interpolate(d3.interpolateHcl); ``` By using Lab or HCL color interpolation, you can create custom color scales that are comparable in quality to [Colorbrewer](http://colorbrewer2.org/). This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,60 +6,72 @@ font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; } .space { position: relative; } .space div { position: absolute; top: 0; left: 20px; } </style> <body> <script src="http://d3js.org/d3.v3.min.js"></script> <script> var spaces = [ {name: "HSL", interpolate: d3.interpolateHsl}, {name: "HCL", interpolate: d3.interpolateHcl}, {name: "Lab", interpolate: d3.interpolateLab}, {name: "RGB", interpolate: d3.interpolateRgb} ]; var y = d3.scale.ordinal() .domain(spaces.map(function(d) { return d.name; })) .rangeRoundBands([0, 500], .1); var margin = y.range()[0], width = 960 - margin - margin, height = y.rangeBand(); var color = d3.scale.linear() .domain([0, width]) .range(["hsl(62,100%,90%)", "hsl(222,30%,20%)"]); var space = d3.select("body").selectAll(".space") .data(spaces) .enter().append("div") .attr("class", "space") .style("width", width + "px") .style("height", height + "px") .style("margin-top", margin + "px") .style("margin-left", margin + "px"); space.append("canvas") .attr("width", width) .attr("height", 1) .style("width", width + "px") .style("height", height + "px") .each(render); space.append("div") .style("line-height", height + "px") .text(function(d) { return d.name; }); function render(d) { var context = this.getContext("2d"), image = context.createImageData(width, 1); color.interpolate(d.interpolate); for (var i = 0, j = -1, c; i < width; ++i) { c = d3.rgb(color(i)); image.data[++j] = c.r; image.data[++j] = c.g; image.data[++j] = c.b; image.data[++j] = 255; } context.putImageData(image, 0, 0); } </script> -
mbostock revised this gist
Aug 23, 2013 . 2 changed files with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ D3 support for CIE [L\*a\*b\*](http://en.wikipedia.org/wiki/Lab_color_space) and [HCL](http://en.wikipedia.org/wiki/CIELUV). These perceptually-motivated color spaces are designed with humans (rather than computers) in mind. RGB and HSL interpolation can cause unintentional grouping due to parts of the color space appearing more visually similar; L\*a\*b\* and HCL, in contrast, are perceptually uniform. For more information, see Gregor Aisch’s post [How To Avoid Equidistant HSV Colors](http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/) and Drew Skau’s post [Dear NASA: No More Rainbow Color Scales, Please](http://blog.visual.ly/rainbow-color-scales/). You can create L\*a\*b\* or HCL colors directly using d3.lab or d3.hcl. For example: This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ </style> <body> <script src="http://d3js.org/d3.v3.min.js"></script> <script> var interpolators = { -
mbostock revised this gist
Oct 12, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
LoadingSorry, something went wrong. Reload?Sorry, we cannot display this file.Sorry, this file is invalid so it cannot be displayed. -
mbostock revised this gist
Aug 10, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ var steelblue = d3.lab(52, -4, -32); var steelblue = d3.hcl(-97, 32, 52); ``` You can also convert from RGB or HSL. This is useful for creating brighter or darker colors with uniform changes in perception: ```javascript var lightsteelblue = d3.lab("#4682b4").brighter(); -
mbostock revised this gist
Aug 10, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ D3 2.10 adds support for CIE [L\*a\*b\*](http://en.wikipedia.org/wiki/Lab_color_space) and [HCL](http://en.wikipedia.org/wiki/CIELUV). These perceptually-motivated color spaces are designed with humans (rather than computers) in mind. RGB and HSL interpolation can cause unintentional grouping due to parts of the color space appearing more visually similar; L\*a\*b\* and HCL, in contrast, are perceptually uniform. For more information, see Gregor Aisch’s post [How To Avoid Equidistant HSV Colors](http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/) and Drew Skau’s post [Dear NASA: No More Rainbow Color Scales, Please](http://blog.visual.ly/rainbow-color-scales/). You can create L\*a\*b\* or HCL colors directly using d3.lab or d3.hcl. For example: -
mbostock revised this gist
Aug 10, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ D3 2.10.0 adds support for CIE [L\*a\*b\*](http://en.wikipedia.org/wiki/Lab_color_space) and [HCL](http://en.wikipedia.org/wiki/CIELUV). These perceptually-motivated color spaces are designed with humans (rather than computers) in mind. RGB and HSL interpolation can cause unintentional grouping due to parts of the color space appearing more visually similar; L\*a\*b\* and HCL, in contrast, are perceptually uniform. For more information, see Gregor Aisch’s post [How To Avoid Equidistant HSV Colors](http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/) and Drew Skau’s post [Dear NASA: No More Rainbow Color Scales, Please](http://blog.visual.ly/rainbow-color-scales/). You can create L\*a\*b\* or HCL colors directly using d3.lab or d3.hcl. For example: -
mbostock revised this gist
Aug 10, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ D3 2.10.0 adds support for CIE [L\*a\*b\*](http://en.wikipedia.org/wiki/Lab_color_space) and [HCL](http://en.wikipedia.org/wiki/CIELUV). These perceptually-motiviated color spaces are designed with humans (rather than computers) in mind. RGB and HSL interpolation can cause unintentional grouping due to parts of the color space appearing more visually similar; L\*a\*b\* and HCL, in contrast, are perceptually uniform. For more information, see Gregor Aisch’s post [How To Avoid Equidistant HSV Colors](http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/) and Drew Skau’s post [Dear NASA: No More Rainbow Color Scales, Please](http://blog.visual.ly/rainbow-color-scales/). You can create L\*a\*b\* or HCL colors directly using d3.lab or d3.hcl. For example: -
mbostock revised this gist
Aug 10, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ D3 2.10.0 adds support for CIE [L\*a\*b\*](http://en.wikipedia.org/wiki/Lab_color_space) and [HCL](http://en.wikipedia.org/wiki/CIELUV). These perceptually-motiviated colors spaces are designed with humans (rather than computers) in mind. RGB and HSL interpolation can cause unintentional grouping due to parts of the color space appearing more visually similar; L\*a\*b\* and HCL, in contrast, are perceptually uniform. For more information, see Gregor Aisch’s post [How To Avoid Equidistant HSV Colors](http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/) and Drew Skau’s post [Dear NASA: No More Rainbow Color Scales, Please](http://blog.visual.ly/rainbow-color-scales/). You can create L\*a\*b\* or HCL colors directly using d3.lab or d3.hcl. For example: -
mbostock revised this gist
Aug 10, 2012 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,7 +8,7 @@ </style> <body> <script src="http://d3js.org/d3.v2.min.js?2.10.0"></script> <script> var interpolators = { @@ -62,4 +62,4 @@ .attr("dy", ".35em") .text(function(d) { return d.key; }); </script> -
mbostock revised this gist
Aug 10, 2012 . 1 changed file with 4 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,17 +1,17 @@ D3 2.10.0 adds support for CIE [L\*a\*b\*](http://en.wikipedia.org/wiki/Lab_color_space) and [HCL](http://en.wikipedia.org/wiki/CIELUV). These colors spaces are designed with perception in mind. RGB and HSL interpolation can cause unintentional grouping due to parts of the color space appearing more visually similar; L\*a\*b\* and HCL, in contrast, are perceptually uniform. For more information, see Gregor Aisch’s post [How To Avoid Equidistant HSV Colors](http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/) and Drew Skau’s post [Dear NASA: No More Rainbow Color Scales, Please](http://blog.visual.ly/rainbow-color-scales/). You can create L\*a\*b\* or HCL colors directly using d3.lab or d3.hcl. For example: ```javascript var steelblue = d3.lab(52, -4, -32); var steelblue = d3.hcl(-97, 32, 52); ``` You can also convert from RGB or HSL. This is useful for creating brighter or darker colors, again with uniform changes in perception: ```javascript var lightsteelblue = d3.lab("#4682b4").brighter(); var darksteelblue = d3.hcl("hsl(207, 44%, 49%)").darker(); ``` Best of all, you can use d3.interpolateLab or d3.interpolateHcl in conjunction with [quantitative scales](https://github.com/mbostock/d3/wiki/Quantitative-Scales) and [transitions](https://github.com/mbostock/d3/wiki/Transitions): -
mbostock revised this gist
Aug 10, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ D3 2.10.0 adds support for CIE [L\*a\*b\*](http://en.wikipedia.org/wiki/Lab_color_space) and [HCL](http://en.wikipedia.org/wiki/CIELUV). These colors spaces are designed with perception in mind. RGB and HSL interpolation can cause unintentional grouping due to parts of the color space appearing more visually similar; L\*a\*b\* and HCL, in contrast, are perceptually uniform. For more information, see Gregor Aisch’s post [How To Avoid Equidistant HSV Colors](http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/) and Drew Skau’s post [Dear NASA: No More Rainbow Color Scales, Please](http://blog.visual.ly/rainbow-color-scales/). You can create L\*a\*b\* or HCL colors using d3.lab or d3.hcl. For example: -
mbostock revised this gist
Aug 9, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ var steelblue = d3.lab("#4682b4"); var steelblue = d3.hcl("hsl(207, 44%, 49%)"); ``` Best of all, you can use d3.interpolateLab or d3.interpolateHcl in conjunction with [quantitative scales](https://github.com/mbostock/d3/wiki/Quantitative-Scales) and [transitions](https://github.com/mbostock/d3/wiki/Transitions): ```javascript var color = d3.scale.linear() -
mbostock revised this gist
Aug 9, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -14,7 +14,7 @@ var steelblue = d3.lab("#4682b4"); var steelblue = d3.hcl("hsl(207, 44%, 49%)"); ``` Best of all, you can use d3.interpolateLab or d3.interpolateHcl in conjunction with [quantitative scales](https://github.com/mbostock/d3/wiki/Quantitative-Scales) or with [transitions](https://github.com/mbostock/d3/wiki/Transitions): ```javascript var color = d3.scale.linear() -
mbostock revised this gist
Aug 9, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ D3 2.10.0 adds support for CIE [L\*a\*b\*](http://en.wikipedia.org/wiki/Lab_color_space) and [HCL](http://en.wikipedia.org/wiki/CIELUV). These colors spaces are designed with perception in mind. RGB and HSL interpolation can cause unintentional grouping due to parts of the color space appearing more visually similar; L\*a\*b\* and HCL, in contrast, are perceptually-uniform. For more information, see Gregor Aisch’s post [How To Avoid Equidistant HSV Colors](http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/) and Drew Skau’s post [Dear NASA: No More Rainbow Color Scales, Please](http://blog.visual.ly/rainbow-color-scales/). You can create L\*a\*b\* or HCL colors using d3.lab or d3.hcl. For example: -
mbostock revised this gist
Aug 9, 2012 . 1 changed file with 24 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,25 @@ D3 2.10.0 adds support for CIE [L\*a\*b\*](http://en.wikipedia.org/wiki/Lab_color_space) and [HCL](http://en.wikipedia.org/wiki/CIELUV). These colors spaces are designed with perception in mind. RGB and HSL interpolation can cause unintentional grouping due to parts of the color space appearing more visually similar. L\*a\*b\* and HCL, in contrast, are perceptually-uniform color spaces. For more information, see Gregor Aisch’s post [How To Avoid Equidistant HSV Colors](http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/) and Drew Skau’s post [Dear NASA: No More Rainbow Color Scales, Please](http://blog.visual.ly/rainbow-color-scales/). You can create L\*a\*b\* or HCL colors using d3.lab or d3.hcl. For example: ```javascript var steelblue = d3.lab(52, -4, -32); var steelblue = d3.hcl(-97, 32, 52); ``` You can also convert from RGB or HSL: ```javascript var steelblue = d3.lab("#4682b4"); var steelblue = d3.hcl("hsl(207, 44%, 49%)"); ``` Best of all, you can use d3.interpolateLab or d3.interpolateHcl in conjunction with [quantitative scales](https://github.com/mbostock/d3/wiki/Quantitative-Scales): ```javascript var color = d3.scale.linear() .range(["steelblue", "brown"]) .interpolate(d3.interpolateHcl); ``` L\*a\*b\* and HCL interpolation is a convenient way to implement color scales that are comparable in quality to [Colorbrewer](http://colorbrewer2.org/). -
mbostock revised this gist
Aug 9, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ D3 2.10.0 adds support for CIE [L\*a\*b\*](http://en.wikipedia.org/wiki/Lab_color_space) and [HCL](http://en.wikipedia.org/wiki/CIELUV). These colors spaces are designed with perception in mind: unlike RGB and HSL interpolation which can cause banding, interpolating in L\*a\*b\* or HCL results in perceptually-uniform changes. For more on color spaces, see Gregor Aisch’s post [How To Avoid Equidistant HSV Colors](http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/) and Drew Skau’s post [Dear NASA: No More Rainbow Color Scales, Please](http://blog.visual.ly/rainbow-color-scales/). Create L\*a\*b\* or HCL colors using d3.lab or d3.hcl. -
mbostock revised this gist
Aug 9, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ D3 2.10.0 adds support for CIE [L\*a\*b\*](http://en.wikipedia.org/wiki/Lab_color_space) and [HCL](http://en.wikipedia.org/wiki/CIELUV). These colors spaces are designed with perception in mind: unlike RGB and HSL, interpolating in L\*a\*b\* or HCL results in perceptually-uniform changes in color. For more on color spaces, see Gregor Aisch’s post [How To Avoid Equidistant HSV Colors](http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/) and Drew Skau’s post [Dear NASA: No More Rainbow Color Scales, Please](http://blog.visual.ly/rainbow-color-scales/). Create L\*a\*b\* or HCL colors using d3.lab or d3.hcl. -
mbostock revised this gist
Aug 9, 2012 . No changes.There are no files selected for viewing
-
mbostock revised this gist
Aug 9, 2012 . 3 changed files with 5 additions and 161 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,3 @@ D3 2.10.0 adds support for CIE [L\*a\*b\*](http://en.wikipedia.org/wiki/Lab_color_space) and [HCL](http://en.wikipedia.org/wiki/CIELUV). These colors spaces are designed with perception in mind: unlike RGB and HSL, interpolating in L\*a\*\b\* or HCL results in perceptually-uniform changes in color. For more on color spaces, see Gregor Aisch’s post [How To Avoid Equidistant HSV Colors](http://vis4.net/blog/posts/avoid-equidistant-hsv-colors/) and Drew Skau’s post [Dear NASA: No More Rainbow Color Scales, Please](http://blog.visual.ly/rainbow-color-scales/). Create L\*a\*b\* or HCL colors using d3.lab or d3.hcl. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,155 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,14 +8,13 @@ </style> <body> <script src="https://raw.github.com/mbostock/d3/2.10.0/d3.v2.min.js"></script> <script> var interpolators = { "HSL": d3.interpolateHsl, "HCL": d3.interpolateHcl, "Lab": d3.interpolateLab, "RGB": d3.interpolateRgb };
NewerOlder