Example of Creating a Histogram Using a Table

Example of Creating a Histogram Using a Table
Loading the math board and drawing, please wait…
2012-06-01 22:21
This example demonstrates how to create a histogram in GeoGebra using table data to visualize data distribution. Key mathematical concepts involved include histograms, rational numbers, power functions, conditional probability, trigonometric functions, and scalene triangles. For construction, it employs GeoGebra commands such as Textfield for text, Polygon and Segment for drawing, Sequence for generating sequences, Vector for vector operations, Sort for sorting data, Element for accessing elements, and If for conditional logic. Objects like t0, showSteps, and various table variables control the dynamic generation. It is suitable for high school or introductory college statistics courses to teach data visualization techniques.

GeoGebra Commands & Parameters

  1. Textfield(d1) → inputD1
  2. Polygon((0, 11), (If[showSteps > t0, t1, t2], 11), (If[showSteps > t0, t1, t2], 12), (0, 12)) → tableHeader, b, c, d, e
  3. Segment((0, 10), (If[showSteps > t0, t1, t2], 10)) → f
  4. Segment((0, 9), (If[showSteps > t0, t1, t2], 9)) → g
  5. Segment((0, 8), (If[showSteps > t0, t1, t2], 8)) → h
  6. Segment((0, 7), (If[showSteps > t0, t1, t2], 7)) → i
  7. Segment((0, 6), (If[showSteps > t0, t1, t2], 6)) → j
  8. Segment((0, 5), (If[showSteps > t0, t1, t2], 5)) → k
  9. Segment((0, 4), (If[showSteps > t0, t1, t2], 4)) → l
  10. Segment((0, 3), (If[showSteps > t0, t1, t2], 3)) → m
  11. Segment((t1, 0), (t1, 12)) → s
  12. Textfield(d2) → inputD2
  13. Textfield(d3) → inputD3
  14. Textfield(d4) → inputD4
  15. Textfield(d5) → inputD5
  16. Textfield(d6) → inputD6
  17. Textfield(d7) → inputD7
  18. Textfield(d8) → inputD8
  19. Segment((0, 2), (If[showSteps > t0, t1, t2], 2)) → a
  20. Textfield(d9) → inputD9
  21. Segment((3.2, 2), (3.2, 12)) → q
  22. Segment((0, 2), (0, 11)) → n
  23. Segment((If[showSteps > t0, t1, t2], 2), (If[showSteps > t0, t1, t2], 11)) → p
  24. Sequence(Segment[(i, -0.3), (i, 0)], i, 7, 18) → xAxisHashMarks
  25. Vector((10, 0), (18.8, 0)) → xAxisR
  26. Vector((10, 0), (6.2, 0)) → xAxisL
  27. Vector((7, 2), (7, -0.8)) → yAxisB
  28. Sort({d1, d2, d3, d4, d5, d6, d7, d8, d9}) → ordered
  29. Element(ordered, 9) → gr
  30. If(gr < 12, 1, If[gr < 24, 2, If[gr < 30, 3, If[gr < 60, 4, 5]]]) → ySet
  31. Sequence(Segment[(i, 0), (i, 12)], i, 8, 1000) → gridV
  32. Sequence(Segment[(7, i), (1000, i)], i, 1, 12) → gridH
  33. Vector((7, 2), (7, 12.8)) → yAxisT
  34. Sequence(Segment[(6.7, i), (7, i)], i, 1, 12) → yAxisHashMarks
  35. If(ySet ≟ 1, 1, If[ySet ≟ 2, 2, If[ySet ≟ 3, 2.5, If[ySet ≟ 4, 5, 10]]]) → scaleFactor
  36. Polygon((8, 0), (9, 0), (9, d1 / scaleFactor), (8, d1 / scaleFactor)) → hist89, t, a_1, b_1, c_1
  37. Polygon((9, 0), (10, 0), (10, d2 / scaleFactor), (9, d2 / scaleFactor)) → hist910, d_1, e_1, f_1, g_1
  38. Polygon((10, 0), (11, 0), (11, d3 / scaleFactor), (10, d3 / scaleFactor)) → hist1011, h_1, i_1, j_1, k_1
  39. Polygon((11, 0), (12, 0), (12, d4 / scaleFactor), (11, d4 / scaleFactor)) → hist1112, l_1, m_1, n_1, p_1
  40. Polygon((12, 0), (13, 0), (13, d5 / scaleFactor), (12, d5 / scaleFactor)) → hist121, q_1, r_1, s_1, t_1
  41. Polygon((13, 0), (14, 0), (14, d6 / scaleFactor), (13, d6 / scaleFactor)) → hist12, a_2, b_2, c_2, d_2
  42. Polygon((14, 0), (15, 0), (15, d7 / scaleFactor), (14, d7 / scaleFactor)) → hist23, e_2, f_2, g_2, h_2
  43. Polygon((15, 0), (16, 0), (16, d8 / scaleFactor), (15, d8 / scaleFactor)) → hist34, i_2, j_2, k_2, l_2
  44. Polygon((16, 0), (17, 0), (17, d9 / scaleFactor), (16, d9 / scaleFactor)) → hist45, m_2, n_2, p_2, q_2

AI Drawing Prompt Reference

Create a histogram to visualize data distribution. Start by drawing a coordinate system with x and y axes, with the y-axis ranging from 0 to 12 and marked with hash lines. Add vertical and horizontal grid lines across the plotting area. Create a data input section with nine text fields for entering numerical values. Sort the input data and determine a scaling factor based on the maximum value to normalize the bar heights. Draw nine adjacent rectangular bars along the x-axis from 8 to 17, each one unit wide, with heights proportional to the corresponding data values divided by the scale factor.
The prompt above was compiled from the original drawing commands and is for reference only.