InfluentialPoints.com
Biology, images, analysis, design...
Use/Abuse Principles How To Related
"It has long been an axiom of mine that the little things are infinitely the most important" (Sherlock Holmes)

Search this site

 

 

Just a note

The space available below the line of frequency polygons can sometimes facilitate labelling - and, when colour-coded, several (superimposed) distributions can be overlaid for comparison. Staggered histograms are sometimes used to achieve the same result but less clearly.

Notice however that, in effect, frequency polygons are applying a linear interpolation between the bars' midpoints - which artificially smoothes the distribution. As a result, where data are discrete, or there are few intervals, or has been heavily rounded, frequency polygons can be very misleading.

The following code produces much the same sort of result using R.

 

  • br=seq(380,600,20) instructs R to create a sequence from 380 to 600 in steps of 20, then assign the result to a variable called br.

    Notice that, because these breakpoints ensure the lowermost class-interval (380 to 400) and uppermost class-interval (580 to 600) are outside the range of these data (420 to 570), they ensure these frequency polygons start and end at zero.

    This also ensures there is enough room to add a figure legend (our final instruction).

  • h=hist(wta,breaks=br,plot=FALSE) instructs R to copy the results of a histogram with specified breaks into a variable called h, but not to plot the histogram.

  • xlim=c(380,600) sets the limits of the x axis a little

  • ylim=range(ha$counts,hb$counts) ensures the y-axix will have enough space for both the frequency polygons.