PAD Charts
All charts/Distributions

Heights of 400 adults

histogram: two bell curves together give two humps.

1 The data distribution/heights.php php
<?php

  // The heights of 400 adults in centimetres: two bell curves of men and women together,
  // from a fixed seed - so a distribution with two humps rather than one.

  mt_srand ( 7 );

  $bell = fn ( $mean, $sd ) => $mean + $sd * sqrt ( -2 * log ( max ( 1e-9, mt_rand () / mt_getrandmax () ) ) ) * cos ( 2 * M_PI * mt_rand () / mt_getrandmax () );

  $people = [];

  for ( $i = 0; $i < 400; $i++ )
    $people [] = [ 'height' => round ( $i % 2 ? $bell ( 167, 6.5 ) : $bell ( 181, 7 ), 1 ) ];

?>
2 The chart tag distribution/heights.pad pad
{chart 'histogram', data='people', value='height', bins=16, title='Heights of 400 adults, in cm', width=640, height=340}
3 The result inline SVG · no JavaScript
Heights of 400 adults, in cm 150 – 155: 6; 155 – 160: 26; 160 – 165: 60; 165 – 170: 61; 170 – 175: 71; 175 – 180: 66; 180 – 185: 59; 185 – 190: 29; 190 – 195: 18; 195 – 200: 4 0 20 40 60 80 150 – 155: 6 155 – 160: 26 160 – 165: 60 165 – 170: 61 170 – 175: 71 175 – 180: 66 180 – 185: 59 185 – 190: 29 190 – 195: 18 195 – 200: 4 150 155 160 165 170 175 180 185 190 195 200