【问题标题】:Stem and leaf plot in MathematicaMathematica 中的茎叶图
【发布时间】:2020-07-13 22:48:05
【问题描述】:

我导入了一个包含 10 个不同列的 csv 数据集。

更改中的一列。

我正在尝试使用 Mathematica 绘制茎叶图。

示例 Mathematica 代码 StemLeafPlot[{1.2, 2.5, 4.1, 1.6, 3.8, 2.6, 2.9}] 工作正常。

但是,当我尝试使用 Change 列作为 StemLeafPlot 函数中的参数时,它不起作用。

col10 = DataSet1[[All, {10}]]

StemLeafPlot[col10 ]

我收到一个错误StemLeafPlot::ndata: The argmuent at position 1 is not a list of real numbers.

非常感谢任何如何解决此错误的建议。

这是该列中数据元素的列表

{"NA", -0.7, "NA", 0.88, 
"NA", 0, -0.6, -1.4, "NA", -0.65, "NA", -0.72, "NA", -1.08, -0.7, -1, 
0.1, 0.6, -0.31, "NA", 0.4, -0.7, 1.45, "NA", 0.43, "NA", -0.3, "NA", 
-0.13, "NA", -0.82, "NA", -0.06, "NA", -0.14, -0.17, "NA", 0, 3.07, 
-2.17, 0, -0.2, "NA", -1.75, "NA", -2.4, "NA", -0.96, -0.29, "NA", 
-2.3, "NA", 0.18, -0.07, "NA", -1.52, "NA", 0.47, "NA", -1.5, "NA", 
-0.12, -0.28, "NA", 3.85, "NA", 0.04, "NA", -0.97, "NA", 0.6, "NA", 
-0.84, "NA", -1.2, "NA", 0.06, "NA", 0.6, -1.88, "NA", -0.32, -0.68, 
"NA", 0.34, 1.66, "NA", 0.71, "NA", 0.2, 1.49, "NA", -0.44, "NA", 
0.03, -0.9, "NA", -0.7, -0.28, "NA", 0, 0.56, "NA", 0.34, "NA", 0, 
-0.1, 0.9, "NA", -0.53, "NA", 0.47, "NA", 0.89, "NA", 6, "NA", -1.17, 
"NA", -0.66, "NA", 0.6, 0, -0.6}

【问题讨论】:

    标签: wolfram-mathematica


    【解决方案1】:

    StemLeafPlot 只接受实数值,因此删除“NA”字符串。

    StemLeafPlot[DeleteCases[col10, "NA"]]
    

    【讨论】:

    • 谢谢克里斯。与 Mathematica 相比,我见过更好的软件文档/帮助文件。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-16
    相关资源
    最近更新 更多