几何绘图,坐标轴的作用是不可忽视的。这里,专门讲一下Mathematica对坐标轴的处理方法。
工具/原料
电脑
Mathematica
Axes
1、坐标轴可以显示,也可以隐藏,分别以Axes->True、Axes->False来控制:Graphics[SSSTriangle[3,4,5], Axes -> True]Graphics3D[Triangle[{{0,0,0},{0,1,3},{5,2,0}}], Axes ->False]
2、x轴、y轴、z轴可以分别独立操作。只显示x轴:Graphics[SSSTriangle[3,4,5],Axes ->{ True,False}]隐藏x、z轴:Graphics3D[Triangle[{{0,0,0},{0,1,3},{5,2,0}}],Axes ->{False, True,False}]
3、用AxesLabel给坐标轴加上标签:Plot[Sinc[x], {x, 0, 10},AxesLabel -> {x, Sinc[x]}]Plot3D[Sin[x] Cos[y], {x, 0, 10},{y, 0, 10},AxesLabel -> {x轴,y轴,z轴}]
4、用AxesStyle改变坐标轴的样式:Plot[Sinc[x], {x, 0, 10}, AxesStyle -> {Directive[Darker@Green, 12],Red}]Plot3D[Sin[x] Cos[y], {x, 0, 10},{y, 0, 10}, AxesStyle ->{Red,Green,Blue}, AxesLabel -> {x轴,y轴,z轴}]
5、用Ticks指定坐标轴的刻度值:Plot[Sinc[x], {x, 0, 10}, AxesStyle -> {Directive[Darker@Green荑樊综鲶, 12],Red}, Ticks -> {{0, Pi, 2 Pi, 3 Pi}, {-1, 1}}]Plot3D[Sin[x] Cos[y], {x, 0, 10},{y, 0, 10}, AxesStyle ->{Red,Green,Blue}, AxesLabel -> {x轴,y轴,z轴}, Ticks -> {{0,2,4,6,8,10},{1,3,5,7,9}, {-1, 1}}]
AxesEdge
1、AxesEdge可以把坐标轴集中到一个起点上:Plot3D[Sin[x] Cos[y], {x, 0, 10},{y, 0, 10}, AxesEdge -> {{ 0, 10},{0, 10}, {-1, -1}}, Mesh -> None, PlotStyle -> Opacity[.5], Boxed -> False]
AxesOrigin
1、AxesOrigin指定了坐标轴原点的位置。以{Pi, 0}为原点:Plot[Sinc[x], {x, 0荑樊综鲶, 10}, AxesStyle -> {Directive[Darker@Green, 12],Red}, AxesOrigin -> {Pi, 0}]以{Pi, 8,0}为原点:Plot3D[Sin[x] Cos[y], {x, 0, 10},{y, 0, 10}, AxesStyle ->{Red,Green,Blue},AxesOrigin -> {Pi, 8,0}]
PolarAxes
1、绘制极坐标函数的图像的时候,PolarAxes可以指定极坐标轴:PolarPlot[Sin[3 t], {t, 0, Pi}, PolarAxes -> Automatic, PolarTicks -> {"Degrees", Automatic}]