MathTop

list_plot 函数

绘制相连的数值或显式坐标点。

语法

  • list_plot([y1, y2, ...])
  • list_plot([[x1, y1], [x2, y2]])
  • list_plot(points, option = value, ...)

参数与选项

list形如 [1, 2, 3] 的列表字面量。
title图形上方显示的标题文本。
labels坐标轴或类别标签。2D 图通常为 [xLabel, yLabel];图表中在支持时用于标注分类。
legend单个数据系列的图例文本,或多个系列名称列表。
color / colour颜色名、CSS 颜色,或用于多个系列/图元的颜色列表。
style绘制风格:line 绘制连续线段,point 绘制采样点标记。
linestyle线型,例如 solid、dash、dot 或 dashdot。
thickness曲线、网格曲面和图元的线宽。
symbol点样式图中使用的点标记模式。
symbolsize采样点或显式点图元的标记半径。
axes坐标轴显示控制;使用 none/false 隐藏坐标轴。
gridlines网格线显示控制;true 显示,false 隐藏。
background图形背景颜色。
transparency透明度控制,范围 0 到 1,数值越大越透明。
view可见数值范围,例如 [xmin..xmax, ymin..ymax] 或 [xmin..xmax, ymin..ymax, zmin..zmax]。

示例

  1. 连续数值list_plot([1, 4, 2, 5])按顺序绘制并连接四个 y 值。
  2. 显式坐标点list_plot([[0, 1], [1, 4], [2, 2], [3, 5]])按顺序连接给定的 x-y 坐标点。
  3. 标题list_plot([1, 4, 2, 5], title = 'Measurements')列表图显示指定标题。
  4. 坐标轴标签list_plot([1, 4, 2, 5], labels = ['index', 'value'])坐标轴分别标记为 index 和 value。
  5. 图例list_plot([1, 4, 2, 5], legend = 'series A')连接的数据系列在图例中显示指定名称。
  6. 颜色list_plot([1, 4, 2, 5], color = green)连接线绘制为绿色。
  7. 点样式list_plot([1, 4, 2, 5], style = point, symbol = circle, symbolsize = 6)数值以点标记显示。
  8. 线型list_plot([1, 4, 2, 5], linestyle = dash)连接线使用虚线线型。
  9. 线宽list_plot([1, 4, 2, 5], thickness = 5)连接线使用更粗线宽。
  10. 坐标轴与网格list_plot([1, 4, 2, 5], axes = none, gridlines = false)隐藏坐标轴线和网格线。
  11. 背景与透明度list_plot([1, 4, 2, 5], background = '#f8fafc', transparency = 0.25)绘图使用自定义背景和半透明连接线。
  12. 显示范围list_plot([1, 4, 2, 5], view = [0..5, 0..6])固定可见的 x、y 范围。
  13. 综合选项list_plot([1, 4, 2, 5], title = 'List', labels = ['n', 'y'], legend = 'values', color = blue, linestyle = dash, thickness = 3, view = [0..5, 0..6])同时应用标题、标签、图例、颜色、线型、线宽和显示范围。