Bar Chart Construction

Bar Chart Construction
Loading the math board and drawing, please wait…
2013-08-30 01:21
In collections Charts & Graphs
This example demonstrates how to create frequency and relative frequency bar charts from categorical data. It involves core concepts like data categorization, frequency statistics, and relative frequency calculation. The construction utilizes GeoGebra commands such as Sequence, Element, RemoveUndefined, Max, Mod, CountIf, Sum, and Segment, along with objects like DataSet, FrqMax, CatC, and CatLab. It is suitable for high school statistics education and introductory data analysis learning.

GeoGebra Commands & Parameters

  1. Sequence(If[k > 79, 4, If[k > 66, 3, If[k > 28, 2, 1]]], k, 1, 100) → DtSq3
  2. Sequence(If[k > 91, 5, If[k > 69, 4, If[k > 57, 3, If[k > 51, 2, 1]]]], k, 1, 100) → DtSq2
  3. Sequence(If[k > 96, 6, If[k > 91, 5, If[k > 85, 4, If[k > 79, 3, If[k > 66, 2, 1]]]]], k, 1, 100) → DtSq1
  4. Element(DtSqSq, DataSet) → DtSq
  5. Sequence(Element[DtSq, Mod[Seed + 47 * k, 100] + 1], k, 1, Sz1) → AcDt
  6. Element(CatNoSq, DataSet) → CatNo1
  7. Sequence(CountIf[x ≟ k, AcDt], k, 1, CatNo1) → FrqSq1
  8. Sequence(If[Element[FrqSq1, k] ≟ 0, NaN, Element[FrqSq1, k]], k, 1, CatNo1) → FrqSq2
  9. RemoveUndefined(FrqSq2) → FrqSq3
  10. Max(FrqSq3) → FrqMax
  11. Max(1, floor(FrqMax / 3)) → FrqUnt
  12. Mod(Seed, 10) → Start
  13. Element(CatLabSq, DataSet) → CatLab
  14. Element(IndPrcSq, DataSet) → IndPrc
  15. Element(CatSq, DataSet) → Cat1
  16. Sequence(Sum[First[IndPrc1, k]], k, 1, 5) → CmlPrc1
  17. Sequence(Sum[First[IndPrc2, k]], k, 1, 4) → CmlPrc2
  18. Sequence(Sum[First[IndPrc3, k]], k, 1, 3) → CmlPrc3
  19. Sequence(If[Element[FrqSq2, k] ≠ 0, Element[Cat1, k]], k, 1, CatNo1) → Cat2
  20. RemoveUndefined(Cat2) → Cat3
  21. CountIf(x > 0, FrqSq1) → CatNo2
  22. Sum(FrqSq3) → Sz2
  23. Sequence(Element[FrqSq3, k] / Sz2, k, 1, CatNo2) → RFSq
  24. Sequence(Text[Element[Cat3, k], (-4, ClTp - 0.1 * k)], k, 1, CatNo2) → CatTxt
  25. Sequence(Text[Element[FrqSq3, k], (15, ClTp - 0.1 * k)], k, 1, CatNo2) → FrqTxt1
  26. Segment(UL, LL) → FrqAx
  27. Segment(LL, LR) → HrAx
  28. Segment(LR, UR) → RFAx
  29. Sequence(Segment[(GL + (k - 1) * CW, Adpt(Element[FrqSq3, k])), (GL + k * CW, Adpt(Element[FrqSq3, k]))], k, 1, CatNo2) → BrTp
  30. Segment(LL, (GL, Adpt(Element[FrqSq3, 1]))) → LftSd
  31. Segment(LR, (GR, Adpt(Element[FrqSq3, CatNo2]))) → RgtSd
  32. Sequence(Segment[(GL + k * CW, GB), (GL + k * CW, Adpt(Max[Element[FrqSq3, k], Element[FrqSq3, k + 1]]))], k, 1, CatNo2 - 1) → BrSd
  33. Sequence((GL + (k - 0.6) * CW - 0.5, GB + 0.02), k, 1, CatNo2) → LblLcSq
  34. Sequence(VerticalText[Element[Cat3, k], Element[LblLcSq, k]], k, 1, CatNo2) → BrLblSq
  35. Element(TtlSq, DataSet) → Title
  36. Sequence(Text[k, (GL - 3.5, GB + k * FrqScl - 0.02)], k, 0, AxMax, FrqUnt) → FrqLbSq
  37. Sequence(Segment[(GL - 1, Adpt(k)), (GL, Adpt(k))], k, 0, AxMax, FrqUnt) → FrqAxTc
  38. Sequence(Segment[(GR, Adpt(k)), (GR + 1, Adpt(k))], k, 0, AxMax, FrqUnt) → RFAxTc
  39. Sequence(Text[k / Sz2, (GR + 1.1, GB + k * FrqScl - 0.02)], k, 0, AxMax, FrqUnt) → RFLblSq

AI Drawing Prompt Reference

Create a bar chart to display frequency and relative frequency of categorical data. Start by generating three sequences based on the data to represent frequencies of different categories, then extract data points from these sequences to calculate frequency and relative frequency for each category. Draw bars with heights proportional to frequencies, label category names and frequency values. Add axes and a title to complete the chart.
The prompt above was compiled from the original drawing commands and is for reference only.