Learning Scientific Programming with Python (2nd edition)

P7.5.2: BMI contours

Question P7.5.2

Extend the code in Example E7.17 to include contours of body mass index, defined by $\mathrm{BMI} = (\mathrm{mass/kg})/(\mathrm{height/m})^2$. Plot these contours to delimit the supposed categories of "under-weight'' (< 18.5), "over-weight'' (> 25) and "obese'' (> 30). Manually place the contour labels so that they are out of the way of the scatter-plotted data points and format them to one decimal place.

The necessary data file is body.dat.txt, in which the final three columns are mass (kg), height (cm) and a gender flag (female=0, male=1).