Mathematica Learning - 常用Plot函数

Mathematica Learning - 常用Plot函数

本文介绍MMA中一些常用的Plot函数。

数据可视化

可用于点、线、曲面、图、网络等绘图。

Wolfram 语言与系统 参考资料中心 - 数据可视化

ListPlot - 对列表绘制点

ListPlot[{y1, y2}]
    (* 绘制点{1, y1}, {2, y2} *)

ListPlot[{ {x1, y1}, {x2, y2} }]
    (* 绘制点{x1, y1}, {x2, y2}} *)

ListPlot[{data1, data2}]
    (* 从所有datai中绘制数据 *)

ListPlot官方参考

ListLinePlot - 对列表绘制线

ListLinePlot[{y1, y2, y3}]
    (* 绘制穿过点{1,y1},{2,y2},{3,y3}的线 *)

ListLinePlot[{{x1,y1},{x2,y2}}]
    (* 绘制经过由指定的x和y确定的位置的曲线 *)

ListLinePlot[{data1, data2, data3}]
    (* 从所有datai中绘制数据 *)

散点拟合:

ListLinePlot[{{1, 4, 2, 3, 10, 8, 2}, {2, 4, 5, 7, 9, 22}}, 
 InterpolationOrder -> 2, Mesh -> Full]
     (* 插值至少为2,但是不宜过大 *)

ListLinePlot官方参考

ListPlot3D - 对列表绘制面

ListPlot3D[array]
    (* 产生一个表示高度值数组的三维曲面图 *)

ListPlot3D[{{x1,y1,z1},{x1,y1,z1}}]
    (* 产生一个曲面,在{xi,yi}的高度为zi *)

ListPlot3D[{data1,data2,data3}]
    (* 绘制对应每个datai的表面 *)

ListPlot3D官方参考

ListPointPlot3D - 对列表绘制三维散点图

ListPointPlot3D[{{x1,y1,z1},{x1,y1,z1}}]
    (* 对坐标{xi,yi,zi}的点产生一个三维散点图 *)

ListPointPlot3D[array]
    (* 用一个二维数组的高度值生成一个三维散点图 *)

ListPointPlot3D[{data1,data2,data3}]
    (* 绘制几个点集的曲线图,默认用不同颜色 *)

ListPointPlot3D官方参考

函数可视化

对函数进行二维或者三维可视化。

Wolfram 语言与系统 参考资料中心 - 函数可视化

Plot - 绘制函数二维图像

Plot[f, {x, xmin, xmax}]
    (* 绘制f的图像,自变量x范围是xmin到xmax *)

Plot[{f1, f2}, {x, xmin, xmax}]
    (* 绘制多个函数fi *)

Plot官方参考

Plot3D - 绘制函数三维图像

Plot3D[f, {x, xmin, xmax}, {y, ymin, ymax}]
    (* 产生函数f在x和y上的三维图形 *)

Plot3D[{f1, f2}, {x, xmin, xmax}, {y, ymin, ymax}]
    (* 绘制多个函数 *)

Plot3D官方参考

RegionPlot - 不等式二维区域

RegionPlot[pred, {x, xmin, xmax}, {y, ymin, ymax}]
    (* 画图显示pred为True的区域 *)

RegionPlot官方参考

RegionPlot3D - 不等式三维区域

RegionPlot3D[pred, {x, xmin, xmax}, {y, ymin, ymax}, {z, zmin, zmax}]
    (* 画图显示pred为True的区域 *)

RegionPlot3D官方参考

DiscretePlot - 绘制二维离散函数

DiscretePlot[expr, {n, nmax}]
    (* 产生expr值的图形,n从1变化到nmax *)

DiscretePlot[expr, {n, nmin, nmax}]
    (* 产生expr值的图形,n从nmin变化到nmax *)

DiscretePlot[expr, {n, nmin, nmax, dn}]
    (* 使用步长dn *)

DiscretePlot[expr, {n, {n1, n2, n3}}]
    (* 使用连续值ni *)

DiscretePlot[{expr1, expr2}, ...]
    (* 绘制所有expri的值 *)

DiscretePlot官方参考

DiscretePlot3D - 绘制三维离散函数

DiscretePlot3D[expr, {i, imin, imax}, {j, jmin, jmax}]
    (* i从imin到imax,j从jmin到jmax *)

DiscretePlot3D[expr, {i, imin, imax, di}, {j, jmin, jmax, dj}]
    (* 使用步长di和dj *)

DiscretePlot3D[expr, {i, {i1,i2,i3}}, {j, {j1, j2, j3}}]
    (* i、j分别使用连续值 *)

DiscretePlot3D官方参考

  • 3
    点赞
  • 16
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值