Letter Frequency
✓ Published0🌍 Public
Mmbostock
Last edited Feb 9, 2016
Created on Aug 10, 2012
A bar chart shows the relative frequency of each letter in English text, from A to Z, with the tallest bar representing E. The chart uses an ordinal scale with `rangeRoundBands` to position bars, applying a 10% inner padding and a 20% outer padding. Frequencies are loaded from a tab-separated file and rendered as SVG rectangles via D3 v3, with axes drawn using `d3.svg.axis`.
AI-generated descriptionD3 2.10 adds support for optional outer padding with d3.scale.ordinal. This parameter allows you to control the outer padding (before the first bar and after the last bar) separately from the inner padding between bars. In this case, the inner padding is 10% and the outer padding is 20%.
var x = d3.scale.ordinal()
.rangeRoundBands([0, width], 0.1, 0.2);
See also this updated version with an axis title.
gpl-3.0 Licensed