StringMash.com

Histogram maker

Type the numbers or the table. The bars draw themselves, ready to download.

59 characters
HistogramUpdates as you type
Download saves the histogram as an SVG

Show the steps
  1. In order: 55, 58, 59, 62, 64, 66, 68, 70, 71, 73, 74, 76, 77, 79, 81, 82, 85, 88, 90, 93. That's 20 values, from 55 to 93.
  2. For 20 values, Sturges' rule suggests 6 classes: ⌈log₂ 20⌉ + 1 = 6. The range, 38, divided by 6 is 6.3333, rounded up to a tidy width of 10. Starting at 50, that makes 5 classes.
  3. Count the values in each class. A value on a boundary goes in the class above it, so each class holds its lower end but not its upper one. The last class holds both.
  4. Each bar's height is its frequency, the count in that class: 50 ≤ x < 60: 3; 60 ≤ x < 70: 4; 70 ≤ x < 80: 7; 80 ≤ x < 90: 4; 90 ≤ x ≤ 100: 2.
  5. Draw each bar across its whole class, so neighbouring bars touch. That's what sets a histogram apart from a bar chart.
  6. The tallest bar is 70 ≤ x < 80. That's the modal class.

Using the histogram maker

Type or paste the numbers, separated by commas, spaces or new lines. The sample is 20 test scores. With the class box left blank the maker picks the classes itself, and the working below the chart says how.

To choose them yourself, type a class width such as 5. Or type the boundaries, such as 0, 10, 20, 40. Boundaries can be uneven, and then the bars switch to frequency density so each one's area stays true to its count.

Already have a grouped frequency table? Paste it one class per line, like 10-20 5 or 10 < x ≤ 20, 5, and the maker draws it straight from the table. Download saves an SVG, a drawing that stays sharp at any size and goes into Word, Google Docs or slides as a picture.

How many classes?

There's no single right answer. Too few classes hide the shape; too many leave a comb of thin bars with gaps. The maker starts from Sturges' rule, ⌈log₂ n⌉ + 1 classes for n values, which gives 6 classes for 20 values and 11 for 1,000. It then rounds the width up to a tidy number like 2, 5 or 10, so the boundaries are easy to read.

Sturges' rule assumes the data is roughly bell-shaped. For skewed data or a big sample, try a narrower width and see what appears. Another common rule of thumb takes the square root of the number of values.

Frequency or frequency density?

When every class is the same width, the height of a bar can simply be its frequency. With unequal classes that misleads. A class twice as wide catches about twice as many values, so its bar would tower over the rest for no real reason.

The fix is frequency density: frequency divided by class width. Then the area of each bar, not its height, is the frequency. The GCSE maths content in England asks students to construct and interpret histograms with equal and unequal class intervals. For unequal ones, the height is frequency density. Bar height set to Automatic does this for you.

Histogram or bar chart?

A bar chart compares categories, like favourite fruits, and its bars stand apart. A histogram shows numbers grouped into ranges, so its bars touch: one class ends exactly where the next begins. Karl Pearson introduced the word histogram in his lectures at University College London in 1892.

In US schools histograms come up in grade 6, where the Common Core lists them beside dot plots and box plots for showing data on a number line (6.SP.B.4). A stem-and-leaf plot of the same data is a histogram turned on its side that keeps every digit.

Questions

How do I make a histogram?

Split the range of the data into classes that meet end to end. Count how many values fall in each class. Then draw a bar over each class as tall as its count, with no gaps between the bars. This maker does each step as you type and shows the counts.

Which class does a value on a boundary go in?

It depends on the convention. By default a value goes in the class above, so 10 belongs to 10 ≤ x < 20. Many exam questions write classes as 10 < x ≤ 20 instead; switch the setting and 10 goes in the class below.

What about classes like 0–9, 10–19?

Whole-number classes leave a gap between 9 and 10. The maker closes it at the class boundary, 9.5, so the bars still touch.

How do I work out frequency density?

Divide each class's frequency by its width. A class from 10 to 30 holding 12 values has a frequency density of 12 ÷ 20 = 0.6. The steps show this sum for every class.

What is the modal class?

The class with the tallest bar. With unequal classes it's the one with the highest frequency density, which the steps name.

Sources

Added and reviewed . What's new