示例 4 步,在同一个会话中按顺序运行。每一步都在引擎上执行过,下面的输出就是它实际产生的。
data = {0.3, 0.3, 1.2, 0.8, 3.1, 1, 4, 0.1};无输出——这一步是在为下一步做准备。
newdata = MapIndexed[If[# > Mean[data], Style[
Legended[#, Row[{"bar", First[#2]}]], ColorData[63, First[#2]]], #]&, data];无输出——这一步是在为下一步做准备。
styles = Sequence@@{ImageSize -> 400, ChartStyle -> Gray, GridLinesStyle -> Directive[AbsoluteThickness[3], LightGray]};无输出——这一步是在为下一步做准备。
BarChart[newdata, ChartElementFunction -> "FadingRectangle", GridLines -> {None, {Mean[data]}}, Evaluate@styles, ChartLegends -> SwatchLegend[None, LegendMarkerSize -> 20, LegendMarkers -> "FadingRectangle", LabelStyle -> {Gray, Bold, 18}, LegendLabel -> "above mean"]]-Graphics-全部操作示例 · 函数参考 · 从 MCP 客户端使用