3  Graphical representation

Graphs and diagrams play a vital role in statistics by transforming complex data into clear, visual formats that are easier to interpret and analyse. While frequency distributions in tabular form help organize raw data, graphical representations provide a more intuitive way to understand patterns, trends, and relationships within the data. By converting numbers into visual elements, graphs make it simpler to convey information effectively, making them indispensable tools in research, analysis, and communication. Depending on the nature of the data and the intended purpose, various types of graphs and diagrams can be employed to illustrate key insights. This chapter focuses on the fundamental graphs and charts used in statistics to visually represent data.

3.1 Histogram

A histogram is a graphical representation used to display the frequency distribution of continuous data. It consists of adjacent rectangles, where:

  • The base of each rectangle lies along the horizontal axis, with the width determined by the class intervals.
  • The area of each rectangle is proportional to the class frequency. For equal-width classes, frequency can be used as the height.

Unlike bar charts, histograms have no gaps between the rectangles, emphasizing the continuity of the data. The height of each rectangle represents the frequency for equal-width classes. Histograms are effective tools for visualizing data distribution, identifying patterns, and highlighting skewness or outliers.

ImportantNote

If the class intervals are of equal width, the height of each rectangle in a histogram is directly proportional to the class frequency. In such cases, the class frequencies can be used as the heights of the rectangles.

However, when class intervals have varying widths, the height of each rectangle should be proportional to the frequency density, which is calculated as:

\[ \text{Frequency Density} = \frac{\text{Class Frequency}}{\text{Class Width}} \]

In these cases, the frequency density is plotted on the y-axis to ensure that the area of each rectangle accurately represents the frequency of the class. This approach maintains the correct visual representation of the data distribution regardless of the class interval widths.

Table 3.1 displays the frequency distribution of plant heights for a sample of 50 plants. This data can be visualized effectively using a histogram, as shown in Figure 3.1.

Table 3.1: Grouped frequency table of plant heights
Plant height (cm) Frequency
130 – 140 3
140 – 150 6
150 – 160 17
160 – 170 13
170 – 180 8
180 – 190 3
Figure 3.1: Histogram

3.2 Ogive

Ogive, also known as the cumulative frequency curve, is a graphical representation that plots cumulative frequencies against class boundaries. The points are typically connected using straight lines, forming a continuous curve. This visualization effectively illustrates the accumulation of frequencies, making it useful for understanding data distribution and determining percentiles or the median.

3.2.1 Types of ogives

There are two main types of cumulative frequency curves:
1. Less than ogive
2. Greater than ogive

Less than ogive

The less than ogive, also known as the less than type cumulative frequency curve, is created by plotting the less than cumulative frequencies against the upper class boundaries. For example, consider the plant height data for 50 plants. By using the upper class limits and their cumulative frequencies, we can construct a smooth curve that provides insights into the data distribution. See Table 3.2, which is constructed from Table 3.1. The less than ogive, shown in Figure 3.2, is drawn using Table 3.2.

Table 3.2: Upper limit and LCF of plant heights
Upper limit 140 150 160 170 180 190
LCF 3 9 26 39 47 50

Note: LCF denotes less than cumulative frequency.

Figure 3.2: Less than ogive

Greater than ogive

The greater than ogive, also known as the greater than type cumulative frequency curve, is constructed by plotting the greater than cumulative frequencies against the lower class boundaries. In this case, instead of using the upper limits like in the “Less than ogive”, we use the lower class limits and their corresponding cumulative frequencies. This curve helps visualize the cumulative frequency distribution from the highest class down to the lowest, providing insights into the number of observations greater than a specific value. See Table 3.3 constructed from Table 3.1. The greater than ogive, shown in Figure 3.3, is drawn using Table 3.3.

Table 3.3: Lower limit and GCF of plant heights
Lower limit 130 140 150 160 170 180
GCF 50 47 41 24 11 3

Note: GCF denotes greater than cumulative frequency.

Figure 3.3: Greater than ogive

The horizontal coordinate of the intersection of the less than and greater than ogives estimates the median. Include the starting point at zero for the less than ogive and the ending point at zero for the greater than ogive. The estimate depends on the interpolation within classes. For Table 3.1, the median position is \(50/2=25\), giving \(150+[(25-9)/17]\times10=159.41\) cm.

3.3 Frequency polygon

A grouped frequency table can also be represented by a frequency polygon, a special type of line graph. To construct it, plot the class frequencies against the corresponding class midpoints and connect successive points with straight lines. For equal-width classes, the frequency polygon can also be obtained by joining the midpoints of the tops of the histogram rectangles. Add zero-frequency points one class width beyond the first and last midpoints to close the polygon. For unequal widths, use frequency densities when tracing the histogram heights. See Table 3.4, constructed from Table 3.1. The frequency polygon, created using Table 3.4, is shown in Figure 3.4. The relation between frequency polygon and histogram can be seen in Figure 3.5.

Table 3.4: Midpoints and frequencies
Class midpoints 135 145 155 165 175 185
Frequencies 3 6 17 13 8 3
Figure 3.4: Frequency Polygon
Figure 3.5: Frequency Polygon and Histogram

3.4 Stem and leaf plot

A stem and leaf plot is a graphical device useful for representing a relatively small set of data that takes numerical values. To construct a stem and leaf plot, we partition each measurement into two parts: the stem (the leading digits) and the leaf (the trailing digits). This method retains the exact value of each observation, unlike a frequency distribution. It also clearly shows the distribution of data within each group. A stem and leaf plot conveys similar information as a histogram, with the added benefit of retaining individual data points. It provides insights into the range, concentration of measurements, and symmetry of the data.

Consider the example:
12, 16, 21, 25, 29, 26, 30, 31, 37, 42, 45.

The stem and leaf plot for this data is shown in Figure 3.6

Figure 3.6: Stem and leaf plot

A stem-and-leaf plot is not only useful for small data sets but can also effectively represent larger sets of numerical data. For instance, consider the monthly income of 50 employees in a company:

19710, 24096, 23618, 26490, 25626, 24653, 24297, 23609, 19120, 25942, 23591, 27302, 29569, 25332, 29396, 20725, 25202, 20763, 30556, 21961, 22910, 21826, 21547, 21015, 19825, 24124, 22275, 26127, 24297, 20564, 26943, 26627, 23602, 24585, 25725, 24322, 23198, 25590, 23366, 23313, 22840, 25514, 24959, 23194, 21337, 26030, 27215, 19260, 27467, 29737.

The corresponding stem-and-leaf plot for this data, shown in Figure 3.7, lists the leaves in increasing order under their respective stems. The proper choice of stems is crucial as it organizes the data effectively, revealing patterns and distribution with clarity.

Figure 3.7: Stem and leaf plot of 5 digit data

Consider a different dataset representing the percentage of adults with a college degree in 20 cities.

48.5, 53.2, 42.1, 65.4, 70.3, 38.7, 55.9, 47.3, 59.2, 33.5, 45.6, 62.8, 50.1, 41.3, 36.2, 43.7, 39.8, 66.4, 58.1, 31.2.

The stem and leaf plot for this data is shown in Figure 3.8. Here, the tens digit serves as the stem, and the units and tenths digits form each leaf. A key such as \(4\mid8.5=48.5\) must be supplied so that the observations can be read correctly.

Figure 3.8: Stem and leaf plot of decimal data

3.5 Bar chart

A bar chart or bar graph is a diagram consisting of a series of horizontal or vertical bars of equal width. The bars represent various categories of the data. There are three types of bar charts, and these are simple bar charts, component bar charts and grouped bar charts.

Simple bar chart

In a simple bar chart, the height (or length) of each bar, plotted on the y-axis, is equal to the value of the category it represents. Table 3.5 presents hypothetical data on coconut production across five districts of Kerala for a specific year. These invented figures are only for learning to draw a bar chart; they are not official district estimates or an actual ranking of coconut production. The bar chart is shown in Figure 3.9.

Table 3.5: Hypothetical data on coconut production
District Production (million nuts)
Alappuzha 700
Kannur 800
Thrissur 980
Ernakulam 1100
Wayanad 1400

Component bar chart

In a component bar chart, the bar for each category is subdivided into component parts; hence its name. Component bar charts are therefore used to show the division of items into components. Component bar chart is also known as stacked barchart.

Figure 3.10 shows the distribution of sales of agricultural produce from a farm in 1995, 1996 and 1997 and its corresponding component barchart in Figure 3.11.

The component bar chart shows the changes of each component over the years as well as the comparison of the total sales between different years.

Grouped bar chart
Figure 3.10 can also be represented using a grouped bar chart shown in Figure 3.12. For a grouped bar chart, each category within a group is represented by a bar with a distinct shade or colour, allowing for clear comparisons of both within and across groups.

Figure 3.9: Barchart
Figure 3.10: Sales data of agricultural produce
Figure 3.11: Component bar chart
Figure 3.12: Grouped bar chart

3.6 Histogram versus bar chart

Table 3.6 highlights the key differences between histograms and bar charts, two commonly used graphical tools in data visualization. While both employ bars to represent data, they serve distinct purposes and are applied to different types of data. Understanding these differences ensures the correct choice of graph for effectively presenting and interpreting data.

Table 3.6: Comparison between histogram and bar chart
Feature Histogram Bar chart
Meaning A graphical representation using bars to display the frequency of numerical data. A pictorial representation using bars to compare different categories of data.
Purpose Depicts the distribution of quantitative data grouped into intervals. Compares categories; these may also be categories of a discrete numerical variable.
Type of data Quantitative data. Categorical data.
Bar spacing Bars are adjacent with no gaps. Bars are separated by spaces.
Grouping of elements Data is grouped into ranges or intervals (bins). Data is represented as individual categories.
Bar order Bars cannot be reordered. Bars can be reordered.
Bar width Bar widths may vary. Bar widths are uniform.

3.7 Pie chart

A pie chart is a circular graph divided into sectors, each sector representing a different value or category. The angle of each sector of a pie chart is proportional to the value of the part of the data it represents. The bar chart is more precise than the pie chart for visual comparison of categories with similar relative frequencies.

Steps for constructing a pie chart

  1. Check that the categories are non-overlapping parts of a meaningful whole and that the values are nonnegative. Find their sum, which must be positive.
  2. Calculate the angle of the sector for each category, using the following formula. Angle of the sector for category A = \(\frac{\text{value of category A}}{\text{sum of category values}} \times 360\)
  3. Construct a circle and mark the center.
  4. Use a protractor to divide the circle into sectors, using the angles obtained in step 2.
  5. Label each sector clearly.

Table 3.7 presents hypothetical production data for different commodities in an imaginary region. The pie chart based on this data is shown in Figure 3.13.

Table 3.7: Hypothetical data on the production of different commodities
Commodities Production (tonnes) Angle
Wheat 27000 (27000/81000)×360 = 120
Gram 22500 100
Maize 13500 60
Rice 6750 30
Sugar 11250 50
Total 81000 360
Figure 3.13: Pie chart

3.8 Boxplot

A boxplot, also known as a box-and-whisker plot, visually represents the five-number summary of a dataset: the minimum value, first quartile, median, third quartile, and maximum value. These key statistics provide insights into the dataset’s central tendency, spread, and potential outliers. Quartiles and the median, explained in detail in Section 5.5, are critical components of this summary.

In a boxplot, a rectangular box spans from the first quartile (Q1) to the third quartile (Q3), with a vertical line inside the box indicating the median. In a simple min–max boxplot, whiskers extend to the minimum and maximum. In the modified boxplot described below, they extend only to the most extreme observations within the 1.5 × IQR fences.

Figure 3.14 below shows the parts of a box plot.

Figure 3.14: Anatomy of box plot

The whiskers do not necessarily extend to the true minimum and maximum of the dataset. Instead, they extend to the most extreme data points that lie within 1.5 × IQR of the box, where the lower whisker limit is \(Q_{1}- 1.5\times IQR\) and the upper whisker limit is \(Q_{3}+ 1.5\times IQR\); here, \(Q_{1}\) and \(Q_{3}\) represent the first and third quartiles, and IQR stands for the interquartile range. Data points beyond these fences are plotted individually as potential outliers. They should be investigated, not deleted automatically. The whisker ends are observed values within the fences, not the numerical fence values themselves.

3.9 Choosing and presenting a graph

Choose a graph according to the question and the type of data. Use a scatter diagram for two quantitative variables, as discussed in the correlation chapter, and a line graph for measurements recorded in time order. State the variable names, units and the period or source of the data. A bar chart normally starts its value axis at zero because bar lengths represent magnitudes. If an axis is truncated, make this clear. Avoid three-dimensional effects that distort comparisons.

3.10 Advanced visualization

While this book focuses on basic plots and charts, significant advancements have been made in the field of data visualization. New types of graphs and charts have been developed to help in more effective representation and communication of data. Although a detailed discussion of these advanced graphs is beyond the scope of this book, we provide an overview of some common and recently developed types for reference. For more detailed information, you can explore resources such as The R Graph Gallery.

It is important to be aware of the wide variety of visualization tools available, as they can enhance your understanding of data and improve your ability to communicate insights clearly. From Figure 3.15 to Figure 3.26 you can see a few popular and advanced graph types widely used in modern data analysis.

Figure 3.15: Box Plot
Figure 3.16: Violin Plot
Figure 3.17: Lollipop Plot
Figure 3.18: Dendrogram
Figure 3.19: Network Graph
Figure 3.20: Heat Map
Figure 3.21: Circular Bar Plot
Figure 3.22: Sankey Diagram
Figure 3.23: Ridgeline Plot
Figure 3.24: Chord Diagram
Figure 3.25: Density Plot
Figure 3.26: Stream Graph

3.11 Chapter Summary

Fill in the blanks

Answers are given at the end of the chapter.

  1. A graph representing a continuous frequency distribution by adjoining rectangles is called a __________.

  2. For unequal class widths, histogram heights should represent frequency __________.

  3. A graph of cumulative frequencies is called an __________.

  4. The intersection of the less-than and greater-than ogives provides an estimate of the __________.

  5. A frequency polygon joins points plotted at class __________.

  6. A display that separates each observation into leading and trailing digits is called a __________ plot.

  7. A diagram used to compare frequencies of categories is called a __________ chart.

  8. A circular diagram showing category proportions is called a __________ chart.

  9. The total angle represented by a pie chart is __________ degrees.

  10. The difference between the third and first quartiles is called the __________ range.

  11. In a boxplot, the line inside the box represents the __________.

  12. Observations beyond the boxplot fences are flagged as potential __________.

Short-answer questions

  1. What is a histogram? Explain its main features.

  2. Distinguish between a histogram and a bar chart.

  3. Explain the use of frequency density in a histogram with unequal class widths.

  4. What is an ogive? Name its two types.

  5. Explain how a less than ogive is constructed.

  6. Explain how a greater than ogive is constructed.

  7. How can the median be obtained using ogives?

  8. What is a frequency polygon? How is it constructed?

  9. Explain the relationship between a frequency polygon and a histogram.

  10. What is a stem-and-leaf plot? Explain its advantages.

  11. Distinguish between the stem and leaf in a stem-and-leaf plot.

  12. What is a bar chart? Name its different types.

  13. Explain simple, component, and grouped bar charts.

  14. What is a pie chart? Explain the steps involved in constructing a pie chart.

  15. What is a boxplot? What information does it provide?

  16. Explain the five-number summary used in a boxplot.

  17. How are outliers identified in a boxplot?

  18. List some advanced graphical methods used in modern data visualization.

Numerical and conceptual questions

Answers are given at the end of the chapter.

  1. The counts of three crop varieties in a sample are 40, 35 and 25. Calculate their pie-chart angles.

  2. Two histogram classes have widths 10 and 20, with frequencies 8 and 12. Find the frequency densities and state which rectangle is taller.

  3. The classes 0–10, 10–20 and 20–30 have frequencies 2, 5 and 3. Estimate the median by grouped interpolation.

  4. A dataset has \(Q_1=12\) and \(Q_3=20\). Find the IQR and the 1.5 × IQR fences. Is 35 beyond a fence?

  5. Write the endpoints used to close the frequency polygon for classes 0–10, 10–20 and 20–30.

Important formulae

Frequency density:

\[ \text{Frequency Density}=\frac{\text{Class Frequency}}{\text{Class Width}} \]

Angle of a sector in a pie chart:

\[ \text{Sector angle}= \frac{\text{Value of category}}{\text{Sum of category values}}\times360^\circ \]

Interquartile range:

\[ IQR=Q_3-Q_1 \]

Lower limit for identifying outliers in a boxplot:

\[ Q_1-1.5\times IQR \]

Upper limit for identifying outliers in a boxplot:

\[ Q_3+1.5\times IQR \]

Quick revision

  • Histogram → continuous quantitative data; adjacent bars.
  • Bar chart → categorical data; bars separated by gaps.
  • Equal class width → height represents frequency.
  • Unequal class width → height represents frequency density.
  • Less than ogive → upper class boundaries + LCF.
  • Greater than ogive → lower class boundaries + GCF.
  • Intersection of two ogives → median.
  • Frequency polygon → class midpoints + frequencies.
  • Stem-and-leaf plot → retains individual observations.
  • Simple bar chart → one value for each category.
  • Component bar chart → shows components of each category.
  • Grouped bar chart → compares multiple values within categories.
  • Pie chart → sectors represent parts of a whole.
  • Boxplot → five-number summary and spread of data.
  • IQR → \(Q_3-Q_1\).
  • Outliers in Boxplot → observations below \(Q_1-1.5IQR\) or above \(Q_3+1.5IQR\).

Answers to fill in the blanks

1. Histogram 2. Density 3. Ogive 4. Median 5. Midpoints 6. Stem-and-leaf 7. Bar 8. Pie 9. 360 10. Interquartile 11. Median 12. Outliers

Solutions to numerical and conceptual questions

  1. The total is 100. The angles are \(40(360)/100=144^\circ\), \(126^\circ\) and \(90^\circ\); they sum to \(360^\circ\).

  2. The densities are \(8/10=0.8\) and \(12/20=0.6\). The first rectangle is taller, but the second has the greater area and frequency.

  3. There are 10 observations, so the median position is 5. The median class is 10–20, giving \(10+[(5-2)/5]\times10=16\). This is an estimate from grouped data.

  4. IQR \(=20-12=8\). The fences are \(12-1.5(8)=0\) and \(20+1.5(8)=32\). The observation 35 exceeds the upper fence and is a potential outlier.

  5. The observed-class midpoints are 5, 15 and 25. Add zero-frequency points at \((-5,0)\) and \((35,0)\) to close the polygon.

CautionHistorical Insights

“The power of data visualization: the coxcomb plot”

In 1854, a young nurse named Florence Nightingale arrived at a British military hospital in Scutari during the Crimean War and found conditions that horrified her: overcrowded wards, contaminated water, and almost no ventilation. Soldiers were dying by the thousands, and everyone assumed it was from battle wounds. Nightingale, who had been trained in mathematics and statistics from a young age, began meticulously recording the cause of every death. When she analysed her records, the pattern that emerged was staggering: for every soldier who died of wounds sustained in battle, many more died of diseases such as typhus, cholera, and dysentery, highlighting the importance of sanitary conditions.

Knowing that dense tables of numbers would never move Queen Victoria or her officials to act, Nightingale used the coxcomb diagram (a form of polar area diagram), where each wedge’s area, not just its radius, represented the number of deaths in a given month, colour-coded by cause. The diagrams made the scale of preventable deaths impossible to ignore at a glance. Her diagrams supported her campaign for military health reform. The decline in wartime mortality should not be attributed to diagrams published later. Nightingale went on to become the first female member of the Royal Statistical Society. Her work remains one of the earliest and most powerful examples of how a well-designed graph, more than any table of numbers, can drive real-world change.

TipQuotes to Inspire

“Statistics is the grammar of science”
- Karl Pearson