条形图
几何画板及绘图内容加载中,请稍等……
这个范例演示了条形图的绘制方法。它涉及条形图的基本概念,如分类数据、频率和相对频率。通过使用GeoGebra命令如Join、Sequence、BarChart等,可以动态地展示数据的变化。适合初中及以上学生学习数据统计与图表绘制。
GeoGebra 命令及参数
Join({{0}, Sort[First[Shuffle[Sequence[20]], catCount]]}) → positionsSequence(Element[positions, i] - Element[positions, i - 1], i, 2, catCount + 1) → countsRandomElement({"pet", "sport", "fruit", "food", "subject"}) → categoryRandomElement({"H", "V"}) → HVSequence(Polygon[(0, i - 1 / 4), (counts(i), i - 1 / 4), (counts(i), i + 1 / 4), (0, i + 1 / 4)], i, 1, catCount) → L_1If(HV ≟ "V", catCount + 1, Max[counts] + 1) → xmaxIf(HV ≟ "H", catCount + 1, Max[counts] + 1) → ymaxShuffle(First[If[category ≟ "fruit", {"apples", "oranges", "bananas", "grapes"}, If[category ≟ "pet", {"cats", "dogs", "fish", "rabbits"}, If[category ≟ "sport", {"baseball", "basketball", "football", "soccer"}, If[category ≟ "food", {"pizza", "chicken", "steak", "hot dogs"}, If[category ≟ "subject", {"math", "reading", "writing", "science"}]]]]], catCount]) → labelsIf(HV ≟ "H", (-1 / 3 * xmax), -1 / 2) → xminIf(HV ≟ "V", (-1 / 4 * ymax), -1 / 2) → yminBarChart(labels, counts, 1 / 2) → aSegment((0, 0), (xmax + 1, 0)) → xaxisSegment((0, 0), (0, ymax + 1)) → yaxisIf(HV ≟ "V", Sequence[Ray[(0, i), (1, i)], i, 1, ymax + 1], Sequence[Ray[(i, 0), (i, 1)], i, 1, xmax + 1]) → linesSum(counts) → sumTextfield(totalText) → InputBox1RandomElement(labels) → choice21RandomElement(Remove[labels, {choice21}]) → choice22If(Element[counts, IndexOf[choice21, labels]] > Element[counts, IndexOf[choice22, labels]], choice21, If[Element[counts, IndexOf[choice21, labels]] < Element[counts, IndexOf[choice22, labels]], choice22, "same"]) → answer2If(HV ≟ "H", Sequence[Point[{xmin / 1.1, i}], i, 1, catCount], Sequence[Point[{i - 1 / 3, ((-ymax)) / 10}], i, 1, catCount]) → anchorsZip(Text[AA, BB], AA, labels, BB, anchors) → L_2RandomElement(labels) → choice31RandomElement(Remove[labels, {choice31}]) → choice32RandomElement({"more", "fewer"}) → moreOrFewerIf(Element[counts, IndexOf[choice31, labels]] < Element[counts, IndexOf[choice32, labels]], {{choice31, Element[counts, IndexOf[choice31, labels]]}, {choice32, Element[counts, IndexOf[choice32, labels]]}}, {{choice32, Element[counts, IndexOf[choice32, labels]]}, {choice31, Element[counts, IndexOf[choice31, labels]]}}) → threeHelperTextfield(threeText) → InputBox3Textfield(fourText) → InputBox4Shuffle(Zip[{AA, BB}, AA, labels, BB, counts]) → fourListIf(HV ≟ "H", Sequence[Text[i, (i - xmax / 55, (ymin) / 1.5)], i, 1, xmax], Sequence[Text[i, (xmin / 1.3, i - ymax / 50)], i, 1, ymax]) → numbers
AI 绘图提示语参考
绘制一个条形图,展示不同类别的数据频率。首先,生成多个类别标签,如宠物、运动、水果等,并为每个类别随机分配数量。然后,根据数量绘制条形,条形高度与数量成正比。最后,添加坐标轴和网格线,使图表更清晰。
以上提示语为根据原始绘图命令整理而来,仅供参考。