How to| 格式化数据表格
Wolfram 语言不仅可以执行非常复杂的数据分析,它也可以将结果以易于阅读的格式显示,以便在其它文档或演示中使用这些结果. 格式化数据最有用的方式之一是通过表格完成的.
data = Import["ExampleData/classification.tsv"]Grid[data]Grid[data, Alignment -> Left, Spacings -> {2, 1}]Grid[data, Alignment -> Left, Spacings -> {2, 1}, Frame -> All, ItemStyle -> "Text"]Grid[data, Alignment -> Left, Spacings -> {2, 1}, Frame -> All, ItemStyle -> "Text", Background -> {{Gray, None}, {LightGray, None}}]Grid[{
{"Sine", Plot[Sin[x], {x, -10, 10}, ImageSize -> Small]},
{"Cosine", Plot[Cos[x], {x, -10, 10}, ImageSize -> Small]},
{"Tangent", Plot[Tan[x], {x, -10, 10}, ImageSize -> Small]}}, Frame -> All]通过使用 SpanFromLeft、SpanFromAbove 或 SpanFromBoth,个别项可以贯穿多个行、多个列或多个行与列:
Grid[{
{"Plots of Common Trigonometric Functions", SpanFromLeft},
{"Sine", Plot[Sin[x], {x, -10, 10}, ImageSize -> Small]},
{"Cosine", Plot[Cos[x], {x, -10, 10}, ImageSize -> Small]},
{"Tangent", Plot[Tan[x], {x, -10, 10}, ImageSize -> Small]}}, Frame -> All]