#set document(title: "8.2 Visualizing Data", author: "OpenStax / XYZ Homework") #set page(width: 8.5in, height: auto, margin: 1in) #import "@preview/cetz:0.5.2" #set text(font: ("STIX Two Text", "Libertinus Serif", "New Computer Modern"), size: 10.5pt, lang: "en") #show math.equation: set text(font: ("STIX Two Math", "New Computer Modern Math")) #set par(justify: true, leading: 0.62em, spacing: 0.9em) #set enum(spacing: 1.1em) // room between list items so tall inline fractions don't collide #set list(spacing: 1.1em) #set table(stroke: 0.5pt + rgb("#c7ccd3")) #let BLUE = rgb("#183B6F") // brand navy — section bars + example/solution labels (white on navy 11.09:1) #let ORANGE = rgb("#A94509") // brand primary-700 — AA-safe deep orange for TEXT (5.93:1 on white; raw brand #F37021 is 2.94:1 and must never carry text) #let RED = rgb("#DC2626") // brand error-600 #let GREEN = rgb("#059669") // brand success-600 (decoration only; small green text uses green-text #007942) #show heading.where(level: 1): it => block(width: 100%, above: 0pt, below: 16pt, fill: gradient.linear(BLUE, rgb("#2C5AA0")), inset: (x: 14pt, y: 12pt), radius: 3pt, text(fill: white, weight: "bold", size: 19pt, it.body)) #show heading.where(level: 2): it => block(width: 100%, above: 18pt, below: 10pt, fill: BLUE, inset: (x: 10pt, y: 6pt), radius: 2pt, text(fill: white, weight: "bold", size: 12pt, it.body)) #show heading.where(level: 3): it => text(fill: ORANGE, weight: "bold", size: 12.5pt, it.body) #show heading.where(level: 4): it => text(fill: BLUE, weight: "bold", size: 10.5pt, it.body) #let examplebox(label, title, body) = block(width: 100%, breakable: true, fill: rgb("#EFF1F5"), stroke: 0.5pt + rgb("#CFDDF0"), radius: 4pt, inset: 10pt, above: 12pt, below: 12pt)[ #block(below: 6pt)[#box(fill: BLUE, inset: (x: 6pt, y: 2pt), radius: 2pt, text(fill: white, weight: "bold", size: 8.5pt, label)) #h(0.4em) #strong[#title]] #body] // rail = decorative left rule (raw brand token); labelcolor = AA-safe label text shade #let notebox(label, rail, labelcolor, tint, body) = block(width: 100%, breakable: true, fill: tint, stroke: (left: 3pt + rail), inset: (left: 10pt, rest: 8pt), radius: (right: 4pt), above: 11pt, below: 11pt)[ #text(fill: labelcolor, weight: "bold", size: 7.5pt, tracking: 0.5pt)[#upper(label)] #linebreak() #body] #let solutionbox(body) = block(above: 4pt, below: 8pt)[ #text(fill: BLUE, weight: "bold", size: 8.5pt)[Solution] #linebreak() #body] #let figph(msg) = block(width: 100%, height: 60pt, fill: rgb("#f6f7f9"), stroke: (paint: rgb("#c7ccd3"), dash: "dashed"), radius: 4pt, inset: 10pt)[ #align(center + horizon, text(fill: rgb("#889"), style: "italic", size: 9pt, msg))] // Standardize inlined figure sizes: measure the natural CeTZ canvas, then scale to a // consistent envelope (aspect-aware; see build_typst.py FIG_* constants). Unlike the // print preamble, dimensions are FLOORED: in an editor a user can trim a figure to a // degenerate 1-D shape (a bare line), and w/h or tw/w would then divide by zero. #let _STD_W = 3.5 #let _WIDE_W = 5.6 #let _MAX_H = 3.4 #let _ASPECT_WIDE = 2.2 #let _UPSCALE_MAX = 1.15 #let stdfig(body) = context { let m = measure(body) let w = calc.max(m.width / 1in, 0.01) let h = calc.max(m.height / 1in, 0.01) let tw = if w / h > _ASPECT_WIDE { _WIDE_W } else { _STD_W } let s = calc.min(tw / w, _MAX_H / h, _UPSCALE_MAX) align(center, box(scale(x: s * 100%, y: s * 100%, reflow: true, body))) } #show figure: set block(breakable: false) #set figure(gap: 8pt) #show figure.caption: set text(size: 8.5pt, fill: rgb("#555")) == 8.2#h(0.6em)Visualizing Data #figure(figph[A group of people are at a table, with their hands shown holding pens. They're all pointing to data on a piece of paper.], alt: "A group of people are at a table, with their hands shown holding pens. They're all pointing to data on a piece of paper.", caption: [Data visualizations can help people quickly understand important features of a dataset.]) === Learning Objectives After completing this section, you should be able to: + Create charts and graphs to appropriately represent data. + Interpret visual representations of data. + Determine misleading components in data displayed visually. Summarizing raw data is the first step we must take when we want to communicate the results of a study or experiment to a broad audience. However, even organized data can be difficult to read; for example, if a frequency table is large, it can be tough to compare the first row to the last row. As the old saying goes: a picture is worth a thousand words (or, in this case, summary statistics)! Just as our techniques for organizing data depended on the type of data we were looking at, the methods we’ll use for creating visualizations will vary. Let’s start by considering categorical data. === Visualizing Categorical Data If the data we’re visualizing is categorical, then we want a quick way to represent graphically the relative numbers of units that fall in each category. When we created the frequency distributions in the last section, all we did was count the number of units in each category and record that number (this was the #emph[frequency] of that category). Frequencies are nice when we’re organizing and summarizing data; they’re easy to compute, and they’re always whole numbers. But they can be difficult to understand for an outsider who’s being introduced to your data. Let’s consider a quick example. Suppose you surveyed some people and asked for their favorite color. You communicated your results using a frequency distribution. Jerry is interested in data on favorite colors, so he reads your frequency distribution. The first row shows that twelve people indicated green was their favorite color. However, Jerry has no way of knowing if that’s a lot of people without knowing how many people total took your survey. Twelve is a pretty significant number if only twenty-five people took the survey, but it’s next to nothing if you recorded a thousand responses. For that reason, we will often summarize categorical data not with frequencies, but with #strong[proportions]. The proportion of data that fall into a particular category is computed by dividing the frequency for that category by the total number of units in the data. #math.equation(block: true, alt: "Proportion of a category equals the fraction Category frequency over Total number of data units")[$"Proportion of a category" = frac("Category frequency", "Total number of data units")$] Proportions can be expressed as fractions, decimals, or percentages. #examplebox("Example 1")[Finding Proportions][ Recall Example 2 in Section 8.1, in which a teacher recorded the responses on the first question of a multiple choice quiz, with five possible responses (A, B, C, D, and E). The raw data was as follows: #figure(table( columns: 14, align: left, inset: 6pt, table.header([A], [A], [C], [A], [B], [B], [A], [E], [A], [C], [A], [A], [A], [C]), [E], [A], [B], [A], [A], [C], [A], [B], [E], [E], [A], [A], [C], [C], )) We computed a frequency distribution that looked like this: #figure(table( columns: 2, align: left, inset: 6pt, table.header([Response to First Question], [Frequency]), [A], [14], [B], [4], [C], [6], [D], [0], [E], [4], )) #math.equation(block: true, alt: "Proportion of a category equals Category frequency / Total number of data units")[$"Proportion of a category" = "Category frequency" / "Total number of data units"$] Now, let's compute the proportions for each category. #solutionbox[ #strong[Step 1:] In order to compute a proportion, we need the frequency (which we have in the table above) and the total number of units that are represented in our data. We can find that by adding up the frequencies from all the categories: #math.equation(block: false, alt: "14 plus 4 plus 6 plus 0 plus 4 equals 28")[$14 + 4 + 6 + 0 + 4 = 28$]. #strong[Step 2:] To find the proportions, we divide the frequency by the total. For the first category (“A”), the proportion is #math.equation(block: false, alt: "the fraction 14 over 28 equals the fraction 1 over 2 equals 0.5 equals 50 % .")[$frac(14, 28) = frac(1, 2) = 0.5 = 50 % .$] We can compute the other proportions similarly, filling in the rest of the table: #figure(table( columns: 3, align: left, inset: 6pt, table.header([Response to First Question], [Frequency], [Proportion]), [A], [14], [#math.equation(block: false, alt: "the fraction 14 over 28 equals 50 %")[$frac(14, 28) = 50 %$]], [B], [4], [#math.equation(block: false, alt: "the fraction 4 over 28 equals 14.3 %")[$frac(4, 28) = 14.3 %$]], [C], [6], [#math.equation(block: false, alt: "the fraction 6 over 28 equals 21.4 %")[$frac(6, 28) = 21.4 %$]], [D], [0], [#math.equation(block: false, alt: "the fraction 0 over 28 equals 0 %")[$frac(0, 28) = 0 %$]], [E], [4], [#math.equation(block: false, alt: "the fraction 4 over 28 equals 14.3 %")[$frac(4, 28) = 14.3 %$]], )) #strong[Step 3:] Check your work: If you add up your proportions, you should get 1 (if you’re using fractions or decimals) or 100% (if you’re using percentages). In this case, #math.equation(block: false, alt: "50 % plus 14.3 % plus 21.4 % plus 0 % plus 14.3 % equals 100 % .")[$50 % + 14.3 % + 21.4 % + 0 % + 14.3 % = 100 % .$] ] #notebox("Checkpoint", rgb("#059669"), rgb("#007942"), rgb("#EAF3EC"))[ #emph[If you need to round off the results of the computations to get your percentages or decimals, then the sum might not be exactly equal to 1 or 100% in the end due to that rounding error.] ] ] Now that we can compute proportions, let’s turn to visualizations. There are two primary visualizations that we’ll use for categorical data: bar charts and pie charts. Both of these data representations work on the same principle: If proportions are represented as areas, then it’s easy to compare two proportions by assessing the corresponding areas. Let’s look at bar charts first. ==== Bar Charts A #strong[bar chart] is a visualization of categorical data that consists of a series of rectangles arranged side-by-side (but not touching). Each rectangle corresponds to one of the categories. All of the rectangles have the same width. The height of each rectangle corresponds to either the number of units in the corresponding category or the proportion of the total units that fall into the category. #examplebox("Example 2")[Building a Bar Chart][ In Example 1, we computed the following proportions: #figure(table( columns: 3, align: left, inset: 6pt, table.header([Response to First Question], [Frequency], [Proportion]), [A], [14], [50%], [B], [4], [14.3%], [C], [6], [21.4%], [D], [0], [0%], [E], [4], [14.3%], )) Draw a bar chart to visualize this frequency distribution. #solutionbox[ #strong[Step 1:] To start, we’ll draw axes with the origin (the point where the axes meet) at the bottom left: #figure(figph[A blank bar chart with horizontal and vertical axes.], alt: "A blank bar chart with horizontal and vertical axes.", caption: none) #strong[Step 2:] Next, we’ll place our categories evenly spaced along the bottom of the horizontal axis. The order doesn’t really matter, but if the categories have some sort of natural order (like in this case, where the responses are labeled A to E), it’s best to maintain that order. We'll also label the horizontal axis: #figure(figph[A bar chart. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis is blank.], alt: "A bar chart. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis is blank.", caption: none) #strong[Step 3:] Now, we have a decision to make: Will we use frequencies to define the height of our rectangles, or will we use proportions? Let’s try it both ways. First, let’s use frequencies. Notice that our frequencies run from zero to 14; this will correspond to the scale we put on the vertical axis. If we put a tick mark for every whole number between 0 and 14, the result will be pretty crowded; let’s instead put a mark on the multiples of 3 or 5: #figure(figph[A bar chart. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis representing frequency ranges from 3 to 15, in increments of 3.], alt: "A bar chart. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis representing frequency ranges from 3 to 15, in increments of 3.", caption: none) #strong[Step 4:] Now, let’s draw in the first rectangle. The frequency associated with “A” is 14. So we’ll go to 14 on the vertical axis, and place a mark at that height above the “A” label: #figure( stdfig([#cetz.canvas({ import cetz.draw: * rect((6.40pt, 0pt), (25.60pt, 128.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (32.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -4pt), anchor: "north", text(size: 8pt)[A]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[3]) line((-3.00pt, 35.00pt), (0.00pt, 35.00pt), stroke: 0.5pt + black) content((-5.00pt, 35.00pt), anchor: "east", text(size: 8pt)[6]) line((-3.00pt, 70.00pt), (0.00pt, 70.00pt), stroke: 0.5pt + black) content((-5.00pt, 70.00pt), anchor: "east", text(size: 8pt)[9]) line((-3.00pt, 105.00pt), (0.00pt, 105.00pt), stroke: 0.5pt + black) content((-5.00pt, 105.00pt), anchor: "east", text(size: 8pt)[12]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[15]) content((16.00pt, -22.00pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[response on question 1]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[frequency]) })]), alt: "A bar chart plots a horizontal dashed line. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis representing frequency ranges from 3 to 15, in increments of 3. The bar chart infers the following data. A: 14.", caption: none, ) #strong[Step 5:] Then, draw vertical lines straight down from the edges of your mark to make a rectangle: #figure( stdfig([#cetz.canvas({ import cetz.draw: * rect((6.40pt, 0pt), (25.60pt, 128.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (32.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -4pt), anchor: "north", text(size: 8pt)[A]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[3]) line((-3.00pt, 35.00pt), (0.00pt, 35.00pt), stroke: 0.5pt + black) content((-5.00pt, 35.00pt), anchor: "east", text(size: 8pt)[6]) line((-3.00pt, 70.00pt), (0.00pt, 70.00pt), stroke: 0.5pt + black) content((-5.00pt, 70.00pt), anchor: "east", text(size: 8pt)[9]) line((-3.00pt, 105.00pt), (0.00pt, 105.00pt), stroke: 0.5pt + black) content((-5.00pt, 105.00pt), anchor: "east", text(size: 8pt)[12]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[15]) content((16.00pt, -22.00pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[response on question 1]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[frequency]) })]), alt: "A bar chart shows a vertical bar. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis representing frequency ranges from 3 to 15, in increments of 3. The bar chart infers the following data. A: 14.", caption: none, ) #strong[Step 6:] Finally, we can build the rest of the rectangles, making sure that the bases all have the same length of the base = width of the rectangle, and the rectangles don’t touch. Notice that, since the frequency for “D” is zero, that category has no rectangle (but we’ll leave a space there so the reader can see that there is a category with frequency zero). Here’s the result: #figure( stdfig([#cetz.canvas({ import cetz.draw: * rect((6.40pt, 0pt), (25.60pt, 128.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 11.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 35.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((134.40pt, 0pt), (153.60pt, 11.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (160.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -4pt), anchor: "north", text(size: 8pt)[A]) content((48.00pt, -4pt), anchor: "north", text(size: 8pt)[B]) content((80.00pt, -4pt), anchor: "north", text(size: 8pt)[C]) content((112.00pt, -4pt), anchor: "north", text(size: 8pt)[D]) content((144.00pt, -4pt), anchor: "north", text(size: 8pt)[E]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[3]) line((-3.00pt, 35.00pt), (0.00pt, 35.00pt), stroke: 0.5pt + black) content((-5.00pt, 35.00pt), anchor: "east", text(size: 8pt)[6]) line((-3.00pt, 70.00pt), (0.00pt, 70.00pt), stroke: 0.5pt + black) content((-5.00pt, 70.00pt), anchor: "east", text(size: 8pt)[9]) line((-3.00pt, 105.00pt), (0.00pt, 105.00pt), stroke: 0.5pt + black) content((-5.00pt, 105.00pt), anchor: "east", text(size: 8pt)[12]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[15]) content((80.00pt, -22.00pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[response on question 1]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[frequency]) })]), alt: "A bar chart plots frequency versus responses. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis representing frequency ranges from 3 to 15, in increments of 3. The bar graph infers the following data. A: 14; B: 4; C: 6; E: 4.", caption: none, ) #strong[Step 7:] That’s it! Now, let’s use proportions instead of frequencies. We'll label the vertical axis with evenly spaced numbers that run the full range of the percentages in our table: 0% to 50%. We can divide that into five equal parts (so that each has width 10%), and use that to label our vertical axis: #figure(figph[A bar chart. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis representing percent ranges from 10 percent to 50 percent, in increments of 10.], alt: "A bar chart. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis representing percent ranges from 10 percent to 50 percent, in increments of 10.", caption: none) #strong[Step 8:] Then, we can fill in the rectangles just as we did before. The height of the “A” rectangle is 50%, the “B” rectangle goes up to 14.3%, “C” goes to 21.4%, there is no rectangle for “D” (since its proportion is 0%), and the “E” rectangle also goes up to 14.3%: #figure( stdfig([#cetz.canvas({ import cetz.draw: * rect((6.40pt, 0pt), (25.60pt, 140.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 15.05pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 39.90pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((102.40pt, 0pt), (121.60pt, 15.05pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (128.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -4pt), anchor: "north", text(size: 8pt)[A]) content((48.00pt, -4pt), anchor: "north", text(size: 8pt)[B]) content((80.00pt, -4pt), anchor: "north", text(size: 8pt)[C]) content((112.00pt, -4pt), anchor: "north", text(size: 8pt)[E]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[10]) line((-3.00pt, 35.00pt), (0.00pt, 35.00pt), stroke: 0.5pt + black) content((-5.00pt, 35.00pt), anchor: "east", text(size: 8pt)[20]) line((-3.00pt, 70.00pt), (0.00pt, 70.00pt), stroke: 0.5pt + black) content((-5.00pt, 70.00pt), anchor: "east", text(size: 8pt)[30]) line((-3.00pt, 105.00pt), (0.00pt, 105.00pt), stroke: 0.5pt + black) content((-5.00pt, 105.00pt), anchor: "east", text(size: 8pt)[40]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[50]) content((64.00pt, -22.00pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[response on question 1]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[percent]) })]), alt: "A bar chart plots percent versus responses on question 1. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis representing percent ranges from 10 percent to 50 percent, in increments of 10. The graph infers the following data. A: 50; B: 14.3; C: 21.4; E: 14.3. Note: all values are approximate.", caption: none, ) #strong[Step 9:] Notice that the rectangles are basically identical in our two final bar charts. That’s no coincidence! Bar charts that use proportions and those that use frequencies will always look identical (which is why it doesn’t really matter much which option you choose). Here’s why: look at the bars for “B” and “C”. The frequencies for these are 4 and 6 respectively. Notice that 6 is 50% bigger than 4 (since #math.equation(block: false, alt: "6 equals 1.5 times 4")[$6 = 1.5 × 4$]), which means that the “C” bar will be 50% higher than the “B” bar. Now look at the same bars using proportions: since #math.equation(block: false, alt: "21.4 % equals 1.5 times 14.3 %")[$21.4 % = 1.5 × 14.3 %$], the bar for “C” will be 50% higher than the bar for “B.” The same relationships hold for the other bars, too. #figure( stdfig([#cetz.canvas({ import cetz.draw: * rect((6.40pt, 0pt), (25.60pt, 128.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 11.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 35.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((134.40pt, 0pt), (153.60pt, 11.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (160.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -4pt), anchor: "north", text(size: 8pt)[A]) content((48.00pt, -4pt), anchor: "north", text(size: 8pt)[B]) content((80.00pt, -4pt), anchor: "north", text(size: 8pt)[C]) content((112.00pt, -4pt), anchor: "north", text(size: 8pt)[D]) content((144.00pt, -4pt), anchor: "north", text(size: 8pt)[E]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[3]) line((-3.00pt, 35.00pt), (0.00pt, 35.00pt), stroke: 0.5pt + black) content((-5.00pt, 35.00pt), anchor: "east", text(size: 8pt)[6]) line((-3.00pt, 70.00pt), (0.00pt, 70.00pt), stroke: 0.5pt + black) content((-5.00pt, 70.00pt), anchor: "east", text(size: 8pt)[9]) line((-3.00pt, 105.00pt), (0.00pt, 105.00pt), stroke: 0.5pt + black) content((-5.00pt, 105.00pt), anchor: "east", text(size: 8pt)[12]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[15]) content((80.00pt, -22.00pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[response on question 1]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[frequency]) })]), alt: "A bar chart plots frequency and percent versus responses on question 1. The horizontal axis representing response on question 1 ranges from A to E. The vertical axis on the left representing frequency ranges from 3 to 15, in increments of 3. The vertical axis on the right representing percent ranges from 10 percent to 50 percent, in increments of 10. The graph infers the following data. A: 14, 50 percent; B: 4, 14.3 percent; C: 6, 21.4 percent; E: 4, 14.3 percent. Note: all values are approximate.", caption: none, ) ] ] In practice, most graphs are now made with computers. You can use #link("https://openstax.org/r/spreadsheet")[Google Sheets], which is available for free from any web browser. #notebox("Video", rgb("#DC2626"), rgb("#DC2626"), rgb("#f7f8fa"))[ #link("https://openstax.org/r/Google_Sheet")[Make a Simple Bar Graph in Google Sheets] ] Now that we’ve explored how bar graphs are made, let’s get some practice reading bar graphs. #examplebox("Example 3")[Reading Bar Graphs][ The bar graph shown gives data on 2020 model year cars available in the United States. Analyze the graph to answer the following questions. #figure( stdfig([#cetz.canvas({ import cetz.draw: * content((96.00pt, 162.00pt), box(width: 192.00pt)[#align(center)[#text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 11pt)[2020 model year cars available in the US]]]) rect((6.40pt, 0pt), (25.60pt, 11.20pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 16.80pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 95.20pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((102.40pt, 0pt), (121.60pt, 28.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((134.40pt, 0pt), (153.60pt, 123.20pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((166.40pt, 0pt), (185.60pt, 11.20pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (192.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[Hatchback]) content((48.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[Minivan]) content((80.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[Sedan]) content((112.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[Sports]) content((144.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[SUV]) content((176.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[Wagon]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[0]) line((-3.00pt, 14.00pt), (0.00pt, 14.00pt), stroke: 0.5pt + black) content((-5.00pt, 14.00pt), anchor: "east", text(size: 8pt)[5]) line((-3.00pt, 28.00pt), (0.00pt, 28.00pt), stroke: 0.5pt + black) content((-5.00pt, 28.00pt), anchor: "east", text(size: 8pt)[10]) line((-3.00pt, 42.00pt), (0.00pt, 42.00pt), stroke: 0.5pt + black) content((-5.00pt, 42.00pt), anchor: "east", text(size: 8pt)[15]) line((-3.00pt, 56.00pt), (0.00pt, 56.00pt), stroke: 0.5pt + black) content((-5.00pt, 56.00pt), anchor: "east", text(size: 8pt)[20]) line((-3.00pt, 70.00pt), (0.00pt, 70.00pt), stroke: 0.5pt + black) content((-5.00pt, 70.00pt), anchor: "east", text(size: 8pt)[25]) line((-3.00pt, 84.00pt), (0.00pt, 84.00pt), stroke: 0.5pt + black) content((-5.00pt, 84.00pt), anchor: "east", text(size: 8pt)[30]) line((-3.00pt, 98.00pt), (0.00pt, 98.00pt), stroke: 0.5pt + black) content((-5.00pt, 98.00pt), anchor: "east", text(size: 8pt)[35]) line((-3.00pt, 112.00pt), (0.00pt, 112.00pt), stroke: 0.5pt + black) content((-5.00pt, 112.00pt), anchor: "east", text(size: 8pt)[40]) line((-3.00pt, 126.00pt), (0.00pt, 126.00pt), stroke: 0.5pt + black) content((-5.00pt, 126.00pt), anchor: "east", text(size: 8pt)[45]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[50]) content((96.00pt, -40.47pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[cars]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[percent]) })]), alt: "A bar graph titled, 2020 model year cars available in the US. The horizontal axis represents cars. The vertical axis representing percent ranges from 0 to 50, in increments of 5. The graph infers the following data. Hatchback: 4; Minivan: 6; Sedan: 34; Sports: 10; SUV: 44; Wagon: 4. Note: all values are approximate.", caption: [(data source: consumerreports.org/cars)], ) + What proportion of available cars were sports cars? + What proportion of available cars were sedans? + Which categories of cars each made up less than 5% of the models available? #solutionbox[ + The bar for sports cars goes up to 10%, so the proportion of models that are considered sports cars is 10%. + The bar corresponding to sedan goes up past 30% but not quite to 35%. It looks like the proportion we want is between 33% and 34%. + We’re looking for the bars that don’t make it all the way to the 5% line. Those categories are hatchback and wagon. ] ] #notebox("Work It Out", rgb("#059669"), rgb("#007942"), rgb("#EAF3EC"))[ #emph[Candy Color: Frequency and Distribution] M&Ms, Skittles, and Reese’s Pieces are all candies that have pieces that are uniformly shaped, but which have different colors. Do the colors in each bag appear with the same frequency? Get a bag of one of these candies and make a bar chart to visualize the color distribution. ] ==== Pie Charts A #strong[pie chart] consists of a circle divided into wedges, with each wedge corresponding to a category. The proportion of the area of the entire circle that each wedge represents corresponds to the proportion of the data in that category. Pie charts are difficult to make without technology because they require careful measurements of angles and precise circles, both of which are tasks better left to computers. #notebox("Video", rgb("#DC2626"), rgb("#DC2626"), rgb("#f7f8fa"))[ #link("https://openstax.org/r/Creating_Pie_Chart")[Create Pie Charts Using Google Sheets] ] Pie charts are sometimes embellished with features like labels in the slices (which might be the categories, the frequencies in each category, or the proportions in each category) or a legend that explains which colors correspond to which categories. When making your own pie chart, you can decide which of those to include. The only rule is that there has to be some way to connect the slices to the categories (either through labels or a legend). #examplebox("Example 4")[Making Pie Charts][ Use the data that follows to generate a pie chart. #figure(table( columns: 4, align: left, inset: 6pt, table.header([Type], [Percent], [Type], [Percent]), [SUV], [43.6%], [Minivan], [5.5%], [Sedan], [33.6%], [Hatchback], [3.6%], [Sports], [10.0%], [Wagon], [3.6%], )) #solutionbox[ First, enter the chart above into a new sheet in Google Sheets. Next, click and drag to select the full table (including the header row). Click on the “Insert” menu, then select “Chart.” The result may be a pie chart by default; if it isn’t, you can change it to a pie chart using the “Chart type” drop-down menu in the Chart Editor. #figure( stdfig([#cetz.canvas({ import cetz.draw: * content((100.00pt, 214.00pt), text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 11pt)[2020 Model Year Cars Available in the US]) arc((100.00pt, 100.00pt), start: 0.00deg, stop: 156.96deg, radius: 80.00pt, anchor: "origin", mode: "PIE", fill: rgb("#d3e1f5"), stroke: 0.7pt + black) content((109.59pt, 147.03pt), text(size: 9pt)[43.6 percent]) arc((100.00pt, 100.00pt), start: 156.96deg, stop: 250.56deg, radius: 80.00pt, anchor: "origin", mode: "PIE", fill: rgb("#e5e7eb"), stroke: 0.7pt + black) content((56.07pt, 80.66pt), text(size: 9pt)[33.6 percent]) arc((100.00pt, 100.00pt), start: 250.56deg, stop: 283.68deg, radius: 80.00pt, anchor: "origin", mode: "PIE", fill: rgb("#fce4c8"), stroke: 0.7pt + black) content((97.59pt, 52.06pt), text(size: 9pt)[10.0 percent]) arc((100.00pt, 100.00pt), start: 283.68deg, stop: 298.80deg, radius: 80.00pt, anchor: "origin", mode: "PIE", fill: rgb("#f5c8c9"), stroke: 0.7pt + black) content((117.39pt, 55.26pt), text(size: 9pt)[5.5 percent]) arc((100.00pt, 100.00pt), start: 298.80deg, stop: 309.36deg, radius: 80.00pt, anchor: "origin", mode: "PIE", fill: none, stroke: 0.7pt + black) content((126.90pt, 60.24pt), text(size: 9pt)[3.6 percent]) arc((100.00pt, 100.00pt), start: 309.36deg, stop: 320.00deg, radius: 80.00pt, anchor: "origin", mode: "PIE", fill: none, stroke: 0.7pt + black) content((133.75pt, 65.87pt), text(size: 9pt)[3.6 percent]) })]), alt: "A pie chart titled, 2020 model year cars available in the US. The circle graph infers the following data. SUV: 43.6 percentage; Sedan: 33.6 percentage; Sports: 10.0 percentage; Minivan: 5.5 percentage; Hatchback: 3.6 percentage; Wagon: 3.6 percentage.", caption: [(data source: consumerreports.org/cars)], ) You can choose to use a legend to identify the categories, as well as label the slices with the relevant percentages. ] ] #notebox("People in Mathematics", rgb("#183B6F"), rgb("#183B6F"), rgb("#EFF1F5"))[ #emph[Florence Nightingale] Florence Nightingale (1820–1910) is best remembered today for her contributions in the medical field; after witnessing the horrors of field hospitals that tended to the wounded during the Crimean War, she championed reforms that encouraged sanitary conditions in hospitals. For those efforts, she is today considered the founder of modern nursing. #figure(figph[A portrait of Florence Nightingale.], alt: "A portrait of Florence Nightingale.", caption: [Florence Nightingale's significant contribution to the field of statistical graphics cannot be understated.]) Nightingale is also remembered for her contributions in statistics, especially in the ways we visualize data. She developed a version of the pie chart that is today known as a #emph[polar area diagram], which she used to visualize the causes of death among the soldiers in the war, highlighting the number of preventable deaths the British Army suffered in that conflict. In 1859, the Royal Statistical Society honored her for her contributions to the discipline by electing her to join the organization. She was the first woman to be so honored. She was later named an honorary member of the American Statistical Association. Nightingale's status as a revered pioneer in both nursing and statistics is a complex one, because some of her writings and opinions demonstrate a colonialist mindset and disregard for those who lost their lives and lands at the hands of the British. Her core statistical writings indicated that she felt superior to the Indigenous people she was treating. Members of both fields continue to debate her near-iconic role. ] === Visualizing Quantitative Data There are several good ways to visualize quantitative data. In this section, we’ll talk about two types: stem-and-leaf plots and histograms. ==== Stem-and-Leaf Plots #strong[Stem-and-leaf plots] are visualization tools that fall somewhere between a list of all the raw data and a graph. A stem-and-leaf plot consists of a list of stems on the left and the corresponding leaves on the right, separated by a line. The stems are the numbers that make up the data only up to the next-to-last digit, and the leaves are the final digits. There is one leaf for every data value (which means that leaves may be repeated), and the leaves should be evenly spaced across all stems. These plots are really nothing more than a fancy way of listing out all the raw data; as a result, they shouldn’t be used to visualize large datasets. This concept can be difficult to understand without referencing an example, so let’s first look at how to read a stem-and-leaf plot. #examplebox("Example 5")[Reading a Stem-and-Leaf Plot][ A collector of trading cards records the sale prices (in dollars) of a particular card on an online auction site, and puts the results in a stem-and-leaf plot: #figure(table( columns: 2, align: left, inset: 6pt, table.header([0], [5 8 9]), [1], [0 0 0 3 4 4 5 5 5 5 6 9 9], [2], [0 0 0 0 5 5 9 9], [3], [0 0 0 5 5], [4], [0 0 5], [5], [], [6], [0], )) Answer the following questions about the data: + How many prices are represented? + What prices represent the five most expensive cards? The five least expensive? + What is the full set of data? #solutionbox[ + Each leaf (the numbers on the right side of the bar) represents one data value. So, on the first row (which looks like 0 | 5 8 9), there are three data values (one for each leaf: 5, 8, and 9). The next row has thirteen leaves, then eight, five, three, zero, and one. Adding those up, we get #math.equation(block: false, alt: "3 plus 13 plus 8 plus 5 plus 3 plus 0 plus 1 equals 33")[$3 + 13 + 8 + 5 + 3 + 0 + 1 = 33$] data points or prices. + The most expensive card is the last one listed. Its stem is 6 and its leaf is 0, so the price is \$60. There are no leaves associated with the 5 stem, so there were no cards sold for \$50 to \$59. The next most expensive cards are then on the 4 stem: \$45, \$40, and \$40 (remember, repeated leaves mean repeated values in the dataset). So, we have our four most expensive cards. The fifth would be on the next stem up. The biggest leaf on the 3 stem is a 5, so the fifth-most expensive card sold for \$35. #linebreak() As for the five least-expensive cards, the smallest stem is 0, with leaves 5, 8, and 9. So, the three least expensive cards sold for \$5, \$8, and \$9 (notice that we don’t write down that leading 0 from the stem in the tens place). The next two least-expensive cards will be the two smallest leaves on the next stem: \$10 and \$10. + The full list of data is: 5, 8, 9, 10, 10, 10, 13, 14, 14, 15, 15, 15, 15, 16, 19, 19, 20, 20, 20, 24, 25, 25, 29, 29, 30, 30, 30, 35, 35, 40, 40, 45, 60. ] ] Stem-and-leaf plots are useful in that they give us a sense of the shape of the data. Are the data evenly spread out over the stems, or are some stems “heavier” with leaves? Are the heavy stems on the low side, the high side, or somewhere in the middle? These are questions about the #strong[distribution] of the data, or how the data are spread out over the range of possible values. Some words we use to describe distributions are #emph[uniform] (data are equally distributed across the range), #emph[symmetric] (data are bunched up in the middle, then taper off in the same way above and below the middle), #emph[left-skewed] (data are bunched up at the high end or larger values, and taper off toward the low end or smaller values), and #emph[right-skewed] (data are bunched up at the low end, and taper off toward the high end). See below figures. #figure( stdfig([#grid(columns: 4, gutter: 1.5em, [#cetz.canvas({ import cetz.draw: * content((80.00pt, 162.00pt), box(width: 160.00pt)[#align(center)[#text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 11pt)[Uniform]]]) rect((6.40pt, 0pt), (25.60pt, 88.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 81.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 119.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((102.40pt, 0pt), (121.60pt, 91.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((134.40pt, 0pt), (153.60pt, 86.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (160.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -4pt), anchor: "north", text(size: 8pt)[0-1]) content((48.00pt, -4pt), anchor: "north", text(size: 8pt)[1-2]) content((80.00pt, -4pt), anchor: "north", text(size: 8pt)[2-3]) content((112.00pt, -4pt), anchor: "north", text(size: 8pt)[3-4]) content((144.00pt, -4pt), anchor: "north", text(size: 8pt)[4-5]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[0]) line((-3.00pt, 23.33pt), (0.00pt, 23.33pt), stroke: 0.5pt + black) content((-5.00pt, 23.33pt), anchor: "east", text(size: 8pt)[10]) line((-3.00pt, 46.67pt), (0.00pt, 46.67pt), stroke: 0.5pt + black) content((-5.00pt, 46.67pt), anchor: "east", text(size: 8pt)[20]) line((-3.00pt, 70.00pt), (0.00pt, 70.00pt), stroke: 0.5pt + black) content((-5.00pt, 70.00pt), anchor: "east", text(size: 8pt)[30]) line((-3.00pt, 93.33pt), (0.00pt, 93.33pt), stroke: 0.5pt + black) content((-5.00pt, 93.33pt), anchor: "east", text(size: 8pt)[40]) line((-3.00pt, 116.67pt), (0.00pt, 116.67pt), stroke: 0.5pt + black) content((-5.00pt, 116.67pt), anchor: "east", text(size: 8pt)[50]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[60]) content((80.00pt, -22.00pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[horizontal axis ranges from 0 to 5, in increments of 1]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[vertical axis ranges from 0 to 60, in increments of 10]) })], [#cetz.canvas({ import cetz.draw: * content((160.00pt, 162.00pt), box(width: 320.00pt)[#align(center)[#text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 11pt)[Right-skewed]]]) rect((6.40pt, 0pt), (25.60pt, 50.40pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 112.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 123.20pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((102.40pt, 0pt), (121.60pt, 103.60pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((134.40pt, 0pt), (153.60pt, 81.20pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((166.40pt, 0pt), (185.60pt, 39.20pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((198.40pt, 0pt), (217.60pt, 22.40pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((230.40pt, 0pt), (249.60pt, 14.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((262.40pt, 0pt), (281.60pt, 8.40pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((294.40pt, 0pt), (313.60pt, 5.60pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (320.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -4pt), anchor: "north", text(size: 8pt)[1-3]) content((48.00pt, -4pt), anchor: "north", text(size: 8pt)[3-5]) content((80.00pt, -4pt), anchor: "north", text(size: 8pt)[5-7]) content((112.00pt, -4pt), anchor: "north", text(size: 8pt)[7-9]) content((144.00pt, -4pt), anchor: "north", text(size: 8pt)[9-11]) content((176.00pt, -4pt), anchor: "north", text(size: 8pt)[11-13]) content((208.00pt, -4pt), anchor: "north", text(size: 8pt)[13-15]) content((240.00pt, -4pt), anchor: "north", text(size: 8pt)[15-17]) content((272.00pt, -4pt), anchor: "north", text(size: 8pt)[17-19]) content((304.00pt, -4pt), anchor: "north", text(size: 8pt)[19-21]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[0]) line((-3.00pt, 28.00pt), (0.00pt, 28.00pt), stroke: 0.5pt + black) content((-5.00pt, 28.00pt), anchor: "east", text(size: 8pt)[10]) line((-3.00pt, 56.00pt), (0.00pt, 56.00pt), stroke: 0.5pt + black) content((-5.00pt, 56.00pt), anchor: "east", text(size: 8pt)[20]) line((-3.00pt, 84.00pt), (0.00pt, 84.00pt), stroke: 0.5pt + black) content((-5.00pt, 84.00pt), anchor: "east", text(size: 8pt)[30]) line((-3.00pt, 112.00pt), (0.00pt, 112.00pt), stroke: 0.5pt + black) content((-5.00pt, 112.00pt), anchor: "east", text(size: 8pt)[40]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[50]) content((160.00pt, -22.00pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[horizontal axis ranges from 1 to 21, in increments of 2]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[vertical axis ranges from 0 to 50, in increments of 10]) })], [#cetz.canvas({ import cetz.draw: * content((160.00pt, 162.00pt), box(width: 320.00pt)[#align(center)[#text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 11pt)[Left-skewed]]]) rect((6.40pt, 0pt), (25.60pt, 7.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 2.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 14.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((102.40pt, 0pt), (121.60pt, 25.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((134.40pt, 0pt), (153.60pt, 30.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((166.40pt, 0pt), (185.60pt, 72.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((198.40pt, 0pt), (217.60pt, 91.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((230.40pt, 0pt), (249.60pt, 121.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((262.40pt, 0pt), (281.60pt, 81.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((294.40pt, 0pt), (313.60pt, 18.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (320.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -4pt), anchor: "north", text(size: 8pt)[30-32]) content((48.00pt, -4pt), anchor: "north", text(size: 8pt)[32-34]) content((80.00pt, -4pt), anchor: "north", text(size: 8pt)[34-36]) content((112.00pt, -4pt), anchor: "north", text(size: 8pt)[36-38]) content((144.00pt, -4pt), anchor: "north", text(size: 8pt)[38-40]) content((176.00pt, -4pt), anchor: "north", text(size: 8pt)[40-42]) content((208.00pt, -4pt), anchor: "north", text(size: 8pt)[42-44]) content((240.00pt, -4pt), anchor: "north", text(size: 8pt)[44-46]) content((272.00pt, -4pt), anchor: "north", text(size: 8pt)[46-48]) content((304.00pt, -4pt), anchor: "north", text(size: 8pt)[48-50]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[0]) line((-3.00pt, 23.33pt), (0.00pt, 23.33pt), stroke: 0.5pt + black) content((-5.00pt, 23.33pt), anchor: "east", text(size: 8pt)[10]) line((-3.00pt, 46.67pt), (0.00pt, 46.67pt), stroke: 0.5pt + black) content((-5.00pt, 46.67pt), anchor: "east", text(size: 8pt)[20]) line((-3.00pt, 70.00pt), (0.00pt, 70.00pt), stroke: 0.5pt + black) content((-5.00pt, 70.00pt), anchor: "east", text(size: 8pt)[30]) line((-3.00pt, 93.33pt), (0.00pt, 93.33pt), stroke: 0.5pt + black) content((-5.00pt, 93.33pt), anchor: "east", text(size: 8pt)[40]) line((-3.00pt, 116.67pt), (0.00pt, 116.67pt), stroke: 0.5pt + black) content((-5.00pt, 116.67pt), anchor: "east", text(size: 8pt)[50]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[60]) content((160.00pt, -22.00pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[horizontal axis ranges from 30 to 50, in increments of 2]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[vertical axis ranges from 0 to 60, in increments of 10]) })], [#cetz.canvas({ import cetz.draw: * content((160.00pt, 162.00pt), box(width: 320.00pt)[#align(center)[#text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 11pt)[Symmetric]]]) rect((6.40pt, 0pt), (25.60pt, 3.50pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 12.25pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 35.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((102.40pt, 0pt), (121.60pt, 54.25pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((134.40pt, 0pt), (153.60pt, 122.50pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((166.40pt, 0pt), (185.60pt, 52.50pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((198.40pt, 0pt), (217.60pt, 50.75pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((230.40pt, 0pt), (249.60pt, 17.50pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((262.40pt, 0pt), (281.60pt, 3.50pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((294.40pt, 0pt), (313.60pt, 1.75pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (320.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -4pt), anchor: "north", text(size: 8pt)[30-45]) content((48.00pt, -4pt), anchor: "north", text(size: 8pt)[45-60]) content((80.00pt, -4pt), anchor: "north", text(size: 8pt)[60-75]) content((112.00pt, -4pt), anchor: "north", text(size: 8pt)[75-90]) content((144.00pt, -4pt), anchor: "north", text(size: 8pt)[90-105]) content((176.00pt, -4pt), anchor: "north", text(size: 8pt)[105-120]) content((208.00pt, -4pt), anchor: "north", text(size: 8pt)[120-135]) content((240.00pt, -4pt), anchor: "north", text(size: 8pt)[135-150]) content((272.00pt, -4pt), anchor: "north", text(size: 8pt)[150-165]) content((304.00pt, -4pt), anchor: "north", text(size: 8pt)[165-180]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[0]) line((-3.00pt, 17.50pt), (0.00pt, 17.50pt), stroke: 0.5pt + black) content((-5.00pt, 17.50pt), anchor: "east", text(size: 8pt)[10]) line((-3.00pt, 35.00pt), (0.00pt, 35.00pt), stroke: 0.5pt + black) content((-5.00pt, 35.00pt), anchor: "east", text(size: 8pt)[20]) line((-3.00pt, 52.50pt), (0.00pt, 52.50pt), stroke: 0.5pt + black) content((-5.00pt, 52.50pt), anchor: "east", text(size: 8pt)[30]) line((-3.00pt, 70.00pt), (0.00pt, 70.00pt), stroke: 0.5pt + black) content((-5.00pt, 70.00pt), anchor: "east", text(size: 8pt)[40]) line((-3.00pt, 87.50pt), (0.00pt, 87.50pt), stroke: 0.5pt + black) content((-5.00pt, 87.50pt), anchor: "east", text(size: 8pt)[50]) line((-3.00pt, 105.00pt), (0.00pt, 105.00pt), stroke: 0.5pt + black) content((-5.00pt, 105.00pt), anchor: "east", text(size: 8pt)[60]) line((-3.00pt, 122.50pt), (0.00pt, 122.50pt), stroke: 0.5pt + black) content((-5.00pt, 122.50pt), anchor: "east", text(size: 8pt)[70]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[80]) content((160.00pt, -22.00pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[horizontal axis ranges from 30 to 180, in increments of 15]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[vertical axis ranges from 0 to 80, in increments of 10]) })] )]), alt: "Four histograms. The first histogram is titled, Uniform. The horizontal axis ranges from 0 to 5, in increments of 1. The vertical axis ranges from 0 to 60, in increments of 10. The histogram infers the following data. 0 to 1: 38. 1 to 2: 35. 2 to 3: 51. 3 to 4: 39. 4 to 5: 37. The second histogram is titled, Right-skewed. The horizontal axis ranges from 1 to 21, in increments of 2. The vertical axis ranges from 0 to 50, in increments of 10. The histogram infers the following data. 1 to 3: 18. 3 to 5: 40. 5 to 7: 44. 7 to 9: 37. 9 to 11: 29. 11 to 13: 14. 13 to 15: 8. 15 to 17: 5. 17 to 19: 3. 19 to 21: 2. The third histogram is titled, Left-skewed. The horizontal axis ranges from 30 to 50, in increments of 2. The vertical axis ranges from 0 to 60, in increments of 10. The histogram infers the following data. 30 to 32: 3. 32 to 34: 1. 34 to 36: 6. 36 to 38: 11. 38 to 40: 13. 40 to 42: 31. 42 to 44: 39. 44 to 46: 52. 46 to 48: 35. 48 to 50: 8. The fourth histogram is titled, Symmetric. The horizontal axis ranges from 30 to 180, in increments of 15. The vertical axis ranges from 0 to 80, in increments of 10. The histogram infers the following data. 30 to 45: 2. 45 to 60: 7. 60 to 75: 20. 75 to 90: 31. 90 to 105: 70. 105 to 120: 30. 120 to 135: 29. 135 to 150: 10. 150 to 165: 2. 165 to 180: 1. Note: all values are approximate.", caption: none, ) Looking back at the stem-and-leaf plot in the previous example, we can see that the data are bunched up at the low end and taper off toward the high end; that set of data is right-skewed. Knowing the distribution of a set of data gives us useful information about the property that the data are measuring. Now that we have a better idea of how to read a stem-and-leaf plot, we’re ready to create our own. #examplebox("Example 6")[Constructing a Stem-and-Leaf Plot][ An entomologist studying crickets recorded the number of times different crickets (of differing species, genders, etc.) chirped in a one-minute span. The raw data are as follows: #figure(table( columns: 10, align: left, inset: 6pt, table.header([89], [97], [82], [102], [84], [99], [93], [103], [120], [91]), [115], [105], [89], [109], [107], [89], [104], [82], [106], [92], [101], [109], [116], [103], [100], [91], [85], [104], [104], [106], )) Construct a stem-and-leaf plot to visualize these results. #solutionbox[ #strong[Step 1]: Before we can create the plot, we need to sort the data in order from smallest to largest: #figure(table( columns: 10, align: left, inset: 6pt, table.header([82], [82], [84], [85], [89], [89], [89], [91], [91], [92]), [93], [97], [99], [100], [101], [102], [103], [103], [104], [104], [104], [105], [106], [106], [107], [109], [109], [115], [116], [120], )) #strong[Step 2:] Next, we identify the stems. To do that, we cut off the final digit of each number, which leaves us with stems of 8, 9, 10, 11, and 12. Arrange the stems vertically, and add the bar to separate these from the leaves: #figure(table( columns: 1, align: left, inset: 6pt, [8], [9], [10], [11], [12], )) #strong[Step 3:] Write down the leaves on the right side of the bar, giving just the final digit (that we cut off to make the stems) of each data value. List these in order, and make sure they line up vertically: #figure(table( columns: 2, align: left, inset: 6pt, table.header([8], [2 2 4 5 9 9 9]), [9], [1 1 2 3 7 9], [10], [0 1 3 3 4 4 4 5 6 6 7 9 9], [11], [5 6], [12], [0], )) ] ] As we mentioned above, stem-and-leaf plots aren’t always going to be useful. For example, if all the data in your dataset are between 20 and 29, then you’ll just have one stem, which isn’t terribly useful. (Although there are methods like #emph[stem splitting] for addressing that particular problem, we won’t go into those at this time.) On the other end of the spectrum, the data may be so spread out that every stem has only one leaf. (This problem can sometimes be addressed by rounding off the data values to the tens, hundreds, or some other place value, then using that place for the leaves.) Finally, if you have dozens or hundreds (or more) of data values, then a stem-and-leaf plot becomes too unwieldy to be useful. Fortunately, we have other tools we can use. ==== Histograms #strong[Histograms] are visualizations that can be used for any set of quantitative data, no matter how big or spread out. They differ from a categorical bar chart in that the horizontal axis is labeled with numbers (not ranges of numbers), and the bars are drawn so that they touch each other. The heights of the bars reflect the frequencies in each bin. Unlike with stem-and-leaf plots, we cannot recreate the original dataset from a histogram. However, histograms are easy to make with technology and are great for identifying the distribution of our data. Let’s first create one histogram without technology to help us better understand how histograms work. #examplebox("Example 7")[Constructing a Histogram][ In Example 6, we built a stem-and-leaf plot for the number of chirps made by crickets in one minute. Here are the raw data that we used then: #figure(table( columns: 6, align: left, inset: 6pt, table.header([89], [97], [82], [102], [84], [99]), [115], [105], [89], [109], [107], [89], [101], [109], [116], [103], [100], [91], [93], [103], [120], [91], [85], [104], [104], [82], [106], [92], [104], [106], )) Construct a histogram to visualize these results. #solutionbox[ #strong[Step 1:] Add data to bins. Histograms are built on binned frequency distributions, so we’ll make that first. Luckily, the stem-and-leaf plot we made earlier can help us do this much more quickly: #figure(table( columns: 2, align: left, inset: 6pt, table.header([8], [2 2 4 5 9 9 9]), [9], [1 1 2 3 7 9], [10], [0 1 2 3 3 4 4 4 5 6 6 7 9 9], [11], [5 6], [12], [0], )) If we’re using bins of width 10, we can compute the frequencies by counting the numbers of leaves associated with the corresponding stem: #figure(table( columns: 2, align: left, inset: 6pt, table.header([Bin], [Frequency]), [80-89], [7], [90-99], [6], [100-109], [14], [110-119], [2], [120-129], [1], )) (Note that, when we made binned frequency diagrams in the last module, we noted that if the biggest data value was right on the border between two bins, it was OK to lump it in with the lower bin. That’s not recommended when building histograms, so the data value 120 is all alone in the 120-129 bin.) #strong[Step 2:] Create the axes. On the horizontal axis, start labeling with the lower end of the first bin (in this case, 80), and go up to the higher end of the last bin (120). Mark off the other bin boundaries, making sure they’re all evenly spaced. On the vertical axis, start with zero and go up at least to the greatest frequency you see in your bins (14 in this example), making sure that the labels you make are evenly spaced and that the difference between those numbers is the same. Let’s count off our vertical axis by threes: #figure(figph[A histogram. The horizontal axis ranges from 80 to 130, in increments of 10. The vertical axis ranges from 0 to 15, in increments of 3.], alt: "A histogram. The horizontal axis ranges from 80 to 130, in increments of 10. The vertical axis ranges from 0 to 15, in increments of 3.", caption: none) #strong[Step 3:] Draw in the bars. Remember that the bars of a histogram touch, and that the heights are determined by the frequency. So, the first bar will cover 80 to 90 on the horizontal axis, and have a height of 7: #figure( stdfig([#cetz.canvas({ import cetz.draw: * rect((6.40pt, 0pt), (25.60pt, 65.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (32.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -4pt), anchor: "north", text(size: 8pt)[80-90]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[0]) line((-3.00pt, 28.00pt), (0.00pt, 28.00pt), stroke: 0.5pt + black) content((-5.00pt, 28.00pt), anchor: "east", text(size: 8pt)[3]) line((-3.00pt, 56.00pt), (0.00pt, 56.00pt), stroke: 0.5pt + black) content((-5.00pt, 56.00pt), anchor: "east", text(size: 8pt)[6]) line((-3.00pt, 84.00pt), (0.00pt, 84.00pt), stroke: 0.5pt + black) content((-5.00pt, 84.00pt), anchor: "east", text(size: 8pt)[9]) line((-3.00pt, 112.00pt), (0.00pt, 112.00pt), stroke: 0.5pt + black) content((-5.00pt, 112.00pt), anchor: "east", text(size: 8pt)[12]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[15]) content((16.00pt, -22.00pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[horizontal axis representing values from 80 to 130 in increments of 10]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[vertical axis representing frequency]) })]), alt: "A histogram shows a vertical bar. The horizontal axis ranges from 80 to 130, in increments of 10. The vertical axis ranges from 0 to 15, in increments of 3.The histogram infers the following data. 80 to 90: 7.", caption: none, ) Now, we can fill in the others: #figure( stdfig([#cetz.canvas({ import cetz.draw: * rect((6.40pt, 0pt), (25.60pt, 65.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 56.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 130.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((102.40pt, 0pt), (121.60pt, 18.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((134.40pt, 0pt), (153.60pt, 9.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (160.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -4pt), anchor: "north", text(size: 8pt)[80-90]) content((48.00pt, -4pt), anchor: "north", text(size: 8pt)[90-100]) content((80.00pt, -4pt), anchor: "north", text(size: 8pt)[100-110]) content((112.00pt, -4pt), anchor: "north", text(size: 8pt)[110-120]) content((144.00pt, -4pt), anchor: "north", text(size: 8pt)[120-130]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[0]) line((-3.00pt, 28.00pt), (0.00pt, 28.00pt), stroke: 0.5pt + black) content((-5.00pt, 28.00pt), anchor: "east", text(size: 8pt)[3]) line((-3.00pt, 56.00pt), (0.00pt, 56.00pt), stroke: 0.5pt + black) content((-5.00pt, 56.00pt), anchor: "east", text(size: 8pt)[6]) line((-3.00pt, 84.00pt), (0.00pt, 84.00pt), stroke: 0.5pt + black) content((-5.00pt, 84.00pt), anchor: "east", text(size: 8pt)[9]) line((-3.00pt, 112.00pt), (0.00pt, 112.00pt), stroke: 0.5pt + black) content((-5.00pt, 112.00pt), anchor: "east", text(size: 8pt)[12]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[15]) content((80.00pt, -22.00pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[number of chirps]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[frequency]) })]), alt: "A bar chart plots frequency versus number of chirps. The horizontal axis ranges from 80 to 130, in increments of 10. The vertical axis ranges from 0 to 15, in increments of 3.The histogram infers the following data. 80 to 90: 7. 90 to 100: 6. 100 to 110: 14. 110 to 120: 2. 120 to 130: 1.", caption: none, ) #strong[Step 4:] Let’s compare the histogram we just created to the stem-and-leaf plot we made earlier: #figure( stdfig([#cetz.canvas({ import cetz.draw: * rect((6.40pt, 0pt), (25.60pt, 65.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 56.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 130.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((102.40pt, 0pt), (121.60pt, 18.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((134.40pt, 0pt), (153.60pt, 9.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (160.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -4pt), anchor: "north", text(size: 8pt)[80-90]) content((48.00pt, -4pt), anchor: "north", text(size: 8pt)[90-100]) content((80.00pt, -4pt), anchor: "north", text(size: 8pt)[100-110]) content((112.00pt, -4pt), anchor: "north", text(size: 8pt)[110-120]) content((144.00pt, -4pt), anchor: "north", text(size: 8pt)[120-130]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[0]) line((-3.00pt, 28.00pt), (0.00pt, 28.00pt), stroke: 0.5pt + black) content((-5.00pt, 28.00pt), anchor: "east", text(size: 8pt)[3]) line((-3.00pt, 56.00pt), (0.00pt, 56.00pt), stroke: 0.5pt + black) content((-5.00pt, 56.00pt), anchor: "east", text(size: 8pt)[6]) line((-3.00pt, 84.00pt), (0.00pt, 84.00pt), stroke: 0.5pt + black) content((-5.00pt, 84.00pt), anchor: "east", text(size: 8pt)[9]) line((-3.00pt, 112.00pt), (0.00pt, 112.00pt), stroke: 0.5pt + black) content((-5.00pt, 112.00pt), anchor: "east", text(size: 8pt)[12]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[15]) content((80.00pt, -22.00pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[horizontal axis representing values from 80 to 130 in increments of 10]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[vertical axis representing frequency]) })]), alt: "A bar chart and a stem-and-leaf plot. The stem-and-leaf plot infers the following data. 8: 2, 2, 4, 5, 9, 9, 9. 9: 1, 1, 2, 3, 7, 9. 10: 0, 1, 1, 3, 3, 4, 4, 4, 5, 6, 6, 7, 9, 9. 11: 5, 6. 12: 0. The horizontal axis of the histogram ranges from 80 to 130, in increments of 10. The vertical axis ranges from 0 to 15, in increments of 3.The histogram infers the following data. 80 to 90: 7. 90 to 100: 6. 100 to 110: 14. 110 to 120: 2. 120 to 130: 1.", caption: none, ) Notice that the leaves on the rotated stem-and-leaf plot match the bars on our histogram! We can view stem-and-leaf plots as sideways histograms. But, as we’ll see soon, we can do much more with histograms. ] ] Now that we’ve seen the connection between stem-and-leaf plots and histograms, we are ready to look at how we can use Google Sheets to build histograms. #notebox("Video", rgb("#DC2626"), rgb("#DC2626"), rgb("#f7f8fa"))[ #link("https://openstax.org/r/CreatingHistograms")[Make a Histogram Using Google Sheets] ] Let’s use Google Sheets to create a histogram for a large dataset. #examplebox("Example 8")[Creating a Histogram in Google Sheets][ The data in #link("https://openstax.org/r/Chapter8_Data-Sets")[“AvgSAT”] contains the average SAT score for students attending every institution of higher learning in the US for which data is available. Create a histogram in Google Sheets of the average SAT scores. Use bins of width 50. Are the data uniformly distributed, symmetric, left-skewed, or right-skewed? #solutionbox[ Using the procedure described in the video above, we get this: #figure( stdfig([#cetz.canvas({ import cetz.draw: * content((272.00pt, 162.00pt), box(width: 544.00pt)[#align(center)[#text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 11pt)[average SAT scores at US institutions]]]) rect((6.40pt, 0pt), (25.60pt, 1.87pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 2.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 7.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((102.40pt, 0pt), (121.60pt, 11.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((134.40pt, 0pt), (153.60pt, 39.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((166.40pt, 0pt), (185.60pt, 79.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((198.40pt, 0pt), (217.60pt, 107.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((230.40pt, 0pt), (249.60pt, 128.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((262.40pt, 0pt), (281.60pt, 128.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((294.40pt, 0pt), (313.60pt, 51.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((326.40pt, 0pt), (345.60pt, 32.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((358.40pt, 0pt), (377.60pt, 23.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((390.40pt, 0pt), (409.60pt, 18.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((422.40pt, 0pt), (441.60pt, 18.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((454.40pt, 0pt), (473.60pt, 9.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((486.40pt, 0pt), (505.60pt, 9.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((518.40pt, 0pt), (537.60pt, 2.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (544.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[750-800]) content((48.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[800-850]) content((80.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[850-900]) content((112.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[900-950]) content((144.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[950-1000]) content((176.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[1000-1050]) content((208.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[1050-1100]) content((240.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[1100-1150]) content((272.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[1150-1200]) content((304.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[1200-1250]) content((336.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[1250-1300]) content((368.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[1300-1350]) content((400.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[1350-1400]) content((432.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[1400-1450]) content((464.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[1450-1500]) content((496.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[1500-1550]) content((528.00pt, -5pt), angle: 45deg, anchor: "east", text(size: 8pt)[1550-1600]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[0]) line((-3.00pt, 46.67pt), (0.00pt, 46.67pt), stroke: 0.5pt + black) content((-5.00pt, 46.67pt), anchor: "east", text(size: 8pt)[100]) line((-3.00pt, 93.33pt), (0.00pt, 93.33pt), stroke: 0.5pt + black) content((-5.00pt, 93.33pt), anchor: "east", text(size: 8pt)[200]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[300]) content((272.00pt, -40.47pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[average SAT]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[frequency]) })]), alt: "A histogram titled, average SAT scores at US institutions. The horizontal axis representing average SAT ranges from 750 to 1600, in increments of 50. The vertical axis representing frequency ranges from 0 to 300, in increments of 100. The histogram infers the following data. 750 to 800: 4. 800 to 850: 5. 850 to 900: 15. 900to 950: 25. 950 to 1000: 85. 1000 to 1050: 170. 1050 to 1100: 230. 1100 to 1150: 275. 1150 to 1200: 275. 1200 to 1250: 110. 1250 to 1300: 70. 1300 to 1350: 50. 1350 to 1400: 40. 1400 to 1450: 40. 1450 to 1500: 20. 1500 to 1550: 20. 1550 to 1600: 5. Note: all values are approximate.", caption: [(data source: https://data.ed.gov)], ) The data are fairly symmetric, but slightly right-skewed. ] ] ==== Bar Charts for Labeled Data Sometimes we have quantitative data where each value is labeled according to the source of the data. For example, in a set of in-state tuition data, each value is associated with a school; the schools are the labels. In YOUR TURN 8.11, you found a histogram of the wins of every Major League Baseball team in 2019. Each of those win totals had a label: the team. If we’re interested in visualizing differences among the different teams, or schools, or whatever the labels are, we create a different version of the bar graph known as a #strong[bar chart for labeled data]. These graphs are made in Google Sheets in exactly the same way as regular bar graphs. The only change is that the vertical axis will be labeled with the units for your quantitative data instead of just “Frequency.” #examplebox("Example 9")[Building a Bar Chart for Labeled Data][ The following table shows the gross domestic product (GDP) for the United States for the years 2010 to 2019: #figure(table( columns: 4, align: left, inset: 6pt, table.header([Year], [GDP (in \$ trillions)], [Year], [GDP (in \$ trillions)]), [2010], [14.992], [2015], [18.225], [2011], [15.543], [2016], [18.715], [2012], [16.197], [2017], [19.519], [2013], [16.785], [2018], [20.580], [2014], [17.527], [2019], [21.433], )) Construct a histogram that represents these data. #solutionbox[ In this case, the years are the labels, and the data we are interested in are the GDP numbers. Once you have the table above (including the labels) entered into a spreadsheet, click and drag to select the full table. Then, in the “Insert” menu, click “Chart.” The result may not be a bar chart; if it’s not, select “Column chart” in the drop-down menu “Chart type” in the Chart Editor. If you want, you can edit things like the chart title in the “Customize” tab in the Chart Editor. #figure( stdfig([#cetz.canvas({ import cetz.draw: * content((160.00pt, 162.00pt), box(width: 320.00pt)[#align(center)[#text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 11pt)[Unites States GDP, 2010 to 2019]]]) rect((6.40pt, 0pt), (25.60pt, 95.45pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 98.64pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 101.82pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((102.40pt, 0pt), (121.60pt, 108.18pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((134.40pt, 0pt), (153.60pt, 111.36pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((166.40pt, 0pt), (185.60pt, 114.55pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((198.40pt, 0pt), (217.60pt, 120.91pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((230.40pt, 0pt), (249.60pt, 124.09pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((262.40pt, 0pt), (281.60pt, 130.45pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((294.40pt, 0pt), (313.60pt, 133.64pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (320.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -4pt), anchor: "north", text(size: 8pt)[2010]) content((48.00pt, -4pt), anchor: "north", text(size: 8pt)[2011]) content((80.00pt, -4pt), anchor: "north", text(size: 8pt)[2012]) content((112.00pt, -4pt), anchor: "north", text(size: 8pt)[2013]) content((144.00pt, -4pt), anchor: "north", text(size: 8pt)[2014]) content((176.00pt, -4pt), anchor: "north", text(size: 8pt)[2015]) content((208.00pt, -4pt), anchor: "north", text(size: 8pt)[2016]) content((240.00pt, -4pt), anchor: "north", text(size: 8pt)[2017]) content((272.00pt, -4pt), anchor: "north", text(size: 8pt)[2018]) content((304.00pt, -4pt), anchor: "north", text(size: 8pt)[2019]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[0]) line((-3.00pt, 19.09pt), (0.00pt, 19.09pt), stroke: 0.5pt + black) content((-5.00pt, 19.09pt), anchor: "east", text(size: 8pt)[3]) line((-3.00pt, 38.18pt), (0.00pt, 38.18pt), stroke: 0.5pt + black) content((-5.00pt, 38.18pt), anchor: "east", text(size: 8pt)[6]) line((-3.00pt, 57.27pt), (0.00pt, 57.27pt), stroke: 0.5pt + black) content((-5.00pt, 57.27pt), anchor: "east", text(size: 8pt)[9]) line((-3.00pt, 76.36pt), (0.00pt, 76.36pt), stroke: 0.5pt + black) content((-5.00pt, 76.36pt), anchor: "east", text(size: 8pt)[12]) line((-3.00pt, 95.45pt), (0.00pt, 95.45pt), stroke: 0.5pt + black) content((-5.00pt, 95.45pt), anchor: "east", text(size: 8pt)[15]) line((-3.00pt, 114.55pt), (0.00pt, 114.55pt), stroke: 0.5pt + black) content((-5.00pt, 114.55pt), anchor: "east", text(size: 8pt)[18]) line((-3.00pt, 133.64pt), (0.00pt, 133.64pt), stroke: 0.5pt + black) content((-5.00pt, 133.64pt), anchor: "east", text(size: 8pt)[21]) content((160.00pt, -22.00pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[Year]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[GDP in trillion dollars]) })]), alt: "A bar graph titled, Unites States GDP, 2010 to 2019. The horizontal axis representing the year ranges from 2010 to 2019, in increments of 1. The vertical axis represents GDP in trillion dollars. The bar graph infers the following data. 2010: 15. 2011: 15.5. 2012: 16. 2013: 17. 2014: 17.5. 2015: 18. 2016: 19. 2017: 19.5. 2018: 20.5. 2019: 21. Note: all values are approximate.", caption: [(data source: https://data.worldbank.org)], ) ] ] === Misleading Graphs Graphical representations of data can be manipulated in ways that intentionally mislead the reader. There are two primary ways this can be done: by manipulating the scales on the axes and by manipulating or misrepresenting areas of bars. Let’s look at some examples of these. #examplebox("Example 10")[Misleading Graphs][ The table below shows the teams, and their payrolls, in the English Premier League, the top soccer organization in the United Kingdom. #figure(table( columns: 4, align: left, inset: 6pt, table.header([Team], [Salary (£1,000,000s)], [Team], [Salary (£1,000,000s)]), [Manchester United F.C.], [175.7], [Newcastle United F.C.], [56.9], [Manchester City F.C.], [136.5], [Aston Villa F.C.], [52.3], [Chelsea F.C.], [132.8], [Fulham F.C.], [52.1], [Arsenal F.C.], [130.7], [Southampton F.C.], [49.6], [Tottenham Hotspur F.C.], [129.2], [Wolverhampton Wanderers F.C.], [49.5], [Liverpool F.C.], [118.6], [Brighton & Hove Albion], [43.7], [Crystal Palace], [85.0], [Burnley F.C.], [35.5], [Everton F.C.], [82.5], [West Bromwich Albion F.C.], [23.8], [Leicester City], [73.7], [Leeds United F.C.], [22.5], [West Ham United F.C.], [69.2], [Sheffield United F.C.], [19.7], )) How might someone present this data in a misleading way? #solutionbox[ #strong[Step 1:] Let’s focus on the top five teams. Here’s a bar chart of their payrolls: #figure( stdfig([#cetz.canvas({ import cetz.draw: * content((80.00pt, 162.00pt), box(width: 160.00pt)[#align(center)[#text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 11pt)[Top Five EPL Teams by Payroll (1,000,000 pounds), January 2020]]]) rect((6.40pt, 0pt), (25.60pt, 91.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 91.70pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 93.10pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((102.40pt, 0pt), (121.60pt, 95.90pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((134.40pt, 0pt), (153.60pt, 123.20pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (160.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -5pt), angle: 90deg, anchor: "east", text(size: 8pt)[Tottenham Hotspur]) content((48.00pt, -5pt), angle: 90deg, anchor: "east", text(size: 8pt)[Arsenal F.C.]) content((80.00pt, -5pt), angle: 90deg, anchor: "east", text(size: 8pt)[Chelsea F.C.]) content((112.00pt, -5pt), angle: 90deg, anchor: "east", text(size: 8pt)[Manchester City]) content((144.00pt, -5pt), angle: 90deg, anchor: "east", text(size: 8pt)[Manchester United]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[0]) line((-3.00pt, 35.00pt), (0.00pt, 35.00pt), stroke: 0.5pt + black) content((-5.00pt, 35.00pt), anchor: "east", text(size: 8pt)[50]) line((-3.00pt, 70.00pt), (0.00pt, 70.00pt), stroke: 0.5pt + black) content((-5.00pt, 70.00pt), anchor: "east", text(size: 8pt)[100]) line((-3.00pt, 105.00pt), (0.00pt, 105.00pt), stroke: 0.5pt + black) content((-5.00pt, 105.00pt), anchor: "east", text(size: 8pt)[150]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[200]) content((80.00pt, -84.72pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[Teams]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[Payroll (1,000,000 pounds)]) })]), alt: "A bar chart titled, top five EPL teams by payroll (1,000,000 pounds), January 2020. The horizontal axis represents teams. The vertical axis representing payroll (1,000,000 pounds) ranges from 0 to 200, in increments of 50. The bar graph infers the following data. Tottenham Hotspur: 130. Arsenal F.C.: 131. Chelsea F.C.: 133. Manchester City: 137. Manchester United: 176. Note: all values are approximate.", caption: [(data source: www.spotrac.com)], ) #strong[Step 2:] Now, here’s another bar chart visualizing exactly the same data: #figure( stdfig([#cetz.canvas({ import cetz.draw: * content((80.00pt, 162.00pt), box(width: 160.00pt)[#align(center)[#text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 11pt)[Top Five EPL Teams by Payroll (1,000,000 pounds), January 2020]]]) rect((6.40pt, 0pt), (25.60pt, 23.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 25.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 30.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((102.40pt, 0pt), (121.60pt, 39.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((134.40pt, 0pt), (153.60pt, 130.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (160.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -5pt), angle: 90deg, anchor: "east", text(size: 8pt)[Tottenham Hotspur]) content((48.00pt, -5pt), angle: 90deg, anchor: "east", text(size: 8pt)[Arsenal F.C.]) content((80.00pt, -5pt), angle: 90deg, anchor: "east", text(size: 8pt)[Chelsea F.C.]) content((112.00pt, -5pt), angle: 90deg, anchor: "east", text(size: 8pt)[Manchester City]) content((144.00pt, -5pt), angle: 90deg, anchor: "east", text(size: 8pt)[Manchester United]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[120]) line((-3.00pt, 46.67pt), (0.00pt, 46.67pt), stroke: 0.5pt + black) content((-5.00pt, 46.67pt), anchor: "east", text(size: 8pt)[140]) line((-3.00pt, 93.33pt), (0.00pt, 93.33pt), stroke: 0.5pt + black) content((-5.00pt, 93.33pt), anchor: "east", text(size: 8pt)[160]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[180]) content((80.00pt, -84.72pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[Teams]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[Payroll (1,000,000 pounds)]) })]), alt: "A bar graph titled, top five EPL teams by payroll (1,000,000 pounds), January 2020. The horizontal axis represents teams. The vertical axis representing payroll (1,000,000 pounds) ranges from 120 to 180, in increments of 20. The bar graph infers the following data. Tottenham Hotspur: 130. Arsenal F.C.: 131. Chelsea F.C.: 133. Manchester City: 137. Manchester United: 176. Note: all values are approximate.", caption: [(data source: www.spotrac.com)], ) #strong[Step 3:] You should notice that despite using the same data, these two graphs look strikingly different. In the second graph, the gap between Manchester United and the other four teams looks significantly larger than in the first graph. The scale on the vertical axis has been manipulated here. The first graph's axis starts at zero, while the lowest value on the second graph's axis is 120. This trick has a strong impact on the viewer’s perception of the data. #notebox("Checkpoint", rgb("#059669"), rgb("#007942"), rgb("#EAF3EC"))[ #emph[Beware of vertical axes that don’t start at zero! They overemphasize differences in heights.] ] #strong[Step 4:] To further emphasize the difference this creates in our perception, let's look at that data again, but this time using graphics instead of colored areas on our bar graph. #figure( stdfig([#cetz.canvas({ import cetz.draw: * content((80.00pt, 162.00pt), box(width: 160.00pt)[#align(center)[#text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 11pt)[Top Five EPL Teams by Payroll (1,000,000 pounds), January 2020]]]) rect((6.40pt, 0pt), (25.60pt, 23.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 25.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 30.33pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((102.40pt, 0pt), (121.60pt, 39.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((134.40pt, 0pt), (153.60pt, 130.67pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (160.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -5pt), angle: 90deg, anchor: "east", text(size: 8pt)[Tottenham Hotspur]) content((48.00pt, -5pt), angle: 90deg, anchor: "east", text(size: 8pt)[Arsenal F.C.]) content((80.00pt, -5pt), angle: 90deg, anchor: "east", text(size: 8pt)[Chelsea F.C.]) content((112.00pt, -5pt), angle: 90deg, anchor: "east", text(size: 8pt)[Manchester City]) content((144.00pt, -5pt), angle: 90deg, anchor: "east", text(size: 8pt)[Manchester United]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[120]) line((-3.00pt, 46.67pt), (0.00pt, 46.67pt), stroke: 0.5pt + black) content((-5.00pt, 46.67pt), anchor: "east", text(size: 8pt)[140]) line((-3.00pt, 93.33pt), (0.00pt, 93.33pt), stroke: 0.5pt + black) content((-5.00pt, 93.33pt), anchor: "east", text(size: 8pt)[160]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[180]) content((80.00pt, -84.72pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[Teams]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[Payroll (1,000,000 pounds)]) })]), alt: "A bar graph titled, top five EPL teams by payroll (1,000,000 pounds), January 2020. Each vertical bar is represented by a 10 dollar bill. The horizontal axis represents teams. The vertical axis representing payroll (1,000,000 pounds) ranges from 120 to 180, in increments of 20. The bar graph infers the following data. Tottenham Hotspur: 130. Arsenal F.C.: 131. Chelsea F.C.: 133. Manchester City: 137. Manchester United: 176. Note: all values are approximate.", caption: [(data source: www.spotrac.com)], ) This graph uses an image of a £10 banknote in place of the bars. Using an image that evokes the context of the data in place of a standard, “boring” bar is a common tool that people use when creating #emph[infographics]. However, this is generally not a good practice because it distorts the data. Notice that our “bars” (the banknotes) are just as tall here as they were in the previous figure. But, to maintain the right proportions, the #emph[widths] had to be adjusted as well, which changes the area (height × width) of each bar. A key point is that when looking at rectangles, the human eye tends to process areas more easily than heights. #notebox("Checkpoint", rgb("#059669"), rgb("#007942"), rgb("#EAF3EC"))[ #emph[Beware of infographics! Areas overemphasize a difference that should be measured with a height!] ] #strong[Step 5:] Now, let’s look at all 20 teams. This histogram indicates that the data are right-skewed, with the highest number of teams having a payroll between £40 million and £80 million: #figure( stdfig([#cetz.canvas({ import cetz.draw: * content((80.00pt, 162.00pt), box(width: 160.00pt)[#align(center)[#text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 11pt)[Total Payrolls Teams in the EPL (1,000,000 pounds), January 2020]]]) rect((6.40pt, 0pt), (25.60pt, 70.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 140.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 52.50pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((102.40pt, 0pt), (121.60pt, 70.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((134.40pt, 0pt), (153.60pt, 17.50pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (160.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -4pt), anchor: "north", text(size: 8pt)[0-40]) content((48.00pt, -4pt), anchor: "north", text(size: 8pt)[40-80]) content((80.00pt, -4pt), anchor: "north", text(size: 8pt)[80-120]) content((112.00pt, -4pt), anchor: "north", text(size: 8pt)[120-160]) content((144.00pt, -4pt), anchor: "north", text(size: 8pt)[160-200]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[0]) line((-3.00pt, 35.00pt), (0.00pt, 35.00pt), stroke: 0.5pt + black) content((-5.00pt, 35.00pt), anchor: "east", text(size: 8pt)[2]) line((-3.00pt, 70.00pt), (0.00pt, 70.00pt), stroke: 0.5pt + black) content((-5.00pt, 70.00pt), anchor: "east", text(size: 8pt)[4]) line((-3.00pt, 105.00pt), (0.00pt, 105.00pt), stroke: 0.5pt + black) content((-5.00pt, 105.00pt), anchor: "east", text(size: 8pt)[6]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[8]) content((80.00pt, -22.00pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[Payroll (1,000,000 pounds)]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[Frequency]) })]), alt: "A histogram titled, total payrolls teams in the EPL (1,000,000 pounds), January 2020. The horizontal axis representing payroll (1,000,000 pounds) ranges from 0 to 200, in increments of 40. The vertical axis representing frequency ranges from 0 to 8, in increments of 2. The histogram infers the following data. 0 to 40: 4. 40 to 80: 8. 8 to 120: 3. 120 to 160: 4. 160 to 200: 1.", caption: [(data source: www.spotrac.com)], ) #strong[Step 6:] Now let's view this same data in another chart: #figure( stdfig([#cetz.canvas({ import cetz.draw: * content((48.00pt, 162.00pt), box(width: 120.00pt)[#align(center)[#text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 11pt)[frequency versus payrolls (1,000,000 pounds)]]]) rect((6.40pt, 0pt), (25.60pt, 70.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((38.40pt, 0pt), (57.60pt, 140.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) rect((70.40pt, 0pt), (89.60pt, 140.00pt), fill: rgb("#e0e0e0"), stroke: 0.6pt + black) line((0.00pt, 0pt), (96.00pt, 0pt), stroke: 0.7pt + black) line((0.00pt, 0pt), (0.00pt, 140.00pt), stroke: 0.7pt + black) content((16.00pt, -4pt), anchor: "north", text(size: 8pt)[0-40]) content((48.00pt, -4pt), anchor: "north", text(size: 8pt)[40-80]) content((80.00pt, -4pt), anchor: "north", text(size: 8pt)[Over 80]) line((-3.00pt, 0.00pt), (0.00pt, 0.00pt), stroke: 0.5pt + black) content((-5.00pt, 0.00pt), anchor: "east", text(size: 8pt)[0]) line((-3.00pt, 35.00pt), (0.00pt, 35.00pt), stroke: 0.5pt + black) content((-5.00pt, 35.00pt), anchor: "east", text(size: 8pt)[2]) line((-3.00pt, 70.00pt), (0.00pt, 70.00pt), stroke: 0.5pt + black) content((-5.00pt, 70.00pt), anchor: "east", text(size: 8pt)[4]) line((-3.00pt, 105.00pt), (0.00pt, 105.00pt), stroke: 0.5pt + black) content((-5.00pt, 105.00pt), anchor: "east", text(size: 8pt)[6]) line((-3.00pt, 140.00pt), (0.00pt, 140.00pt), stroke: 0.5pt + black) content((-5.00pt, 140.00pt), anchor: "east", text(size: 8pt)[8]) content((48.00pt, -22.00pt), anchor: "north", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[payroll (1,000,000 pounds)]) content((-32.00pt, 70.00pt), angle: 90deg, anchor: "south", text(font: sys.inputs.at("title-font", default: "STIX Two Text"), size: 9pt)[frequency]) })]), alt: "A histogram titled frequency versus payrolls (1,000,000 pounds). The horizontal axis represents payroll (1,000,000 pounds) ranges from 0 to 80, in increments of 40. The vertical axis representing frequency ranges from 0 to 8, in increments of 2. The histogram infers the following data. 0 to 40: 4. 40 to 80: 8. Over 80: 8.", caption: [(data source: www.spotrac.com)], ) #strong[Step 7:] Even though this chart uses the same data, the skew seems to be reversed. Why? Well, even though this graph #emph[looks] like a histogram, it isn’t. Look closely at the labels on the horizontal axis; they don't correspond to spots on the axis, but instead provide a range, meaning this is a bar graph based on a binned frequency distribution. #linebreak() When we review these ranges, we can see that the last range is misleading as it consists of all data “over 80.” If the bins all had the same width, that last bin would run from 80 to 120. However, we can see from the histogram that the maximum value for this data is between 160 and 200. If the last bin in this bar graph were labeled honestly, it would read “80–200,” which would drive home the fact that the width of that bar is misleading. ] ] #notebox("Checkpoint", rgb("#059669"), rgb("#007942"), rgb("#EAF3EC"))[ #emph[Always check the horizontal axis on histograms! The widths of all the bars should be equal.] ] #notebox("Video", rgb("#DC2626"), rgb("#DC2626"), rgb("#f7f8fa"))[ #link("https://openstax.org/r/MisleadingGraphs")[How to Spot a Misleading Graph] ] #notebox("Who Knew?", rgb("#183B6F"), rgb("#183B6F"), rgb("#EFF1F5"))[ #emph[Napoleon's Failed Invasion] One of the most famous data visualizations ever created is the cartographic depiction by Charles Joseph Minard of Napoleon’s disastrous attempted invasion of Russia. #figure(figph[A portrait of Minard’s Napoleon Map.], alt: "A portrait of Minard’s Napoleon Map.", caption: [Minard’s Napoleon Map]) Minard’s chart is remarkable in that it shows not just how the size of Napoleon’s army shrank drastically over time, but also the location on the map, the direction the army was traveling at the time, and the temperature during the retreat. ] === Key Terms - proportion - bar chart - pie chart - stem-and-leaf plot - distribution (of quantitative data) - histogram - bar chart for labeled data === Key Concepts - Categorical data can be visualized using pie charts or bar charts; quantitative data can be visualized using stem-and-leaf plots or histograms. - Areas in pie charts and bar charts represent proportions of the data falling into a particular category, while areas in histograms represent proportions of the data that fall into a given range of data values (or “bins”). Stem-and-leaf plots are visual representations of entire datasets. - By manipulating the axes, changing widths of bars, or making bad choices for bins, we can create data visualizations that misrepresent the distribution of data. === Videos - #link("https://openstax.org/r/Bar-Graphs")[Make a Simple Bar Graph in Google Sheets] - #link("https://openstax.org/r/Pie-Charts")[Create Pie Charts Using Google Sheets] - #link("https://openstax.org/r/Histograms")[Make a Histogram Using Google Sheets] - #link("https://openstax.org/r/Misleading-Graphs")[How to Spot a Misleading Graph]