此为 Mathematica 4 文档,内容基于更早版本的 Wolfram 语言
查看最新文档(版本11.1)

Graphics

Usage

Graphics[primitives, options] 表示一个二维图形.


Notes

Graphics 通过 Show显示.
• 可以使用下列图形指令:
"\!\(\*StyleBox[\"\\\"Circle[\\\"\", \"MR\"]\)"{"\!\(\*StyleBox[\"\\\"x\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) \!\(\*StyleBox[\"\\\"y\\\"\", \"TI\"]\)"}"\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) \!\(\*StyleBox[\"\\\"r\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "
"\!\(\*StyleBox[\"\\\"Disk[\\\"\", \"MR\"]\)"{"\!\(\*StyleBox[\"\\\"x\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) \!\(\*StyleBox[\"\\\"y\\\"\", \"TI\"]\)"}"\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) \!\(\*StyleBox[\"\\\"r\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "填充圆盘
"\!\(\*StyleBox[\"\\\"Line[\\\"\", \"MR\"]\)"{{"\!\(\*StyleBox[\"\\\"x\\\"\", \"TI\"]\)"1"\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"y\\\"\", \"TI\"]\)"1}"\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) ... "}"\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "线
"\!\(\*StyleBox[\"\\\"Point[\\\"\", \"MR\"]\)"{"\!\(\*StyleBox[\"\\\"x\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) \!\(\*StyleBox[\"\\\"y\\\"\", \"TI\"]\)"}"\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "
"\!\(\*StyleBox[\"\\\"Polygon[\\\"\", \"MR\"]\)"{{"\!\(\*StyleBox[\"\\\"x\\\"\", \"TI\"]\)"1"\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"y\\\"\", \"TI\"]\)"1}"\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) ... "}"\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "填充多边形
"\!\(\*StyleBox[\"\\\"PostScript[\\\\\\\"\\\"\", \"MR\"]\)\!\(\*StyleBox[\"\\\"string\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\"\\\\\\\"]\\\"\", \"MR\"]\) "逐字包含的PostScript码
"\!\(\*StyleBox[\"\\\"Raster[\\\"\", \"MR\"]\)\!\(\*StyleBox[\"\\\"array\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "灰度层阵列
"\!\(\*StyleBox[\"\\\"RasterArray[\\\"\", \"MR\"]\)\!\(\*StyleBox[\"\\\"garray\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "有色单元阵列
"\!\(\*StyleBox[\"\\\"Rectangle[\\\"\", \"MR\"]\)"{"\!\(\*StyleBox[\"\\\"xmin\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) \!\(\*StyleBox[\"\\\"ymin\\\"\", \"TI\"]\)"}"\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) "{"\!\(\*StyleBox[\"\\\"xmax\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) \!\(\*StyleBox[\"\\\"ymax\\\"\", \"TI\"]\)"}"\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "填充矩形
"\!\(\*StyleBox[\"\\\"Text[\\\"\", \"MR\"]\)\!\(\*StyleBox[\"\\\"expr\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) "{"\!\(\*StyleBox[\"\\\"x\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) \!\(\*StyleBox[\"\\\"y\\\"\", \"TI\"]\)"}"\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "文本
• 也可以包含声音指令SampledSoundListSampledSoundFunction.
• 可以使用下列图形指令:
"\!\(\*StyleBox[\"\\\"AbsoluteDashing[\\\"\", \"MR\"]\)"{"\!\(\*StyleBox[\"\\\"w\\\"\", \"TI\"]\)"1"\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) ... "}"\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "绝对线型指定
"\!\(\*StyleBox[\"\\\"AbsolutePointSize[\\\"\", \"MR\"]\)\!\(\*StyleBox[\"\\\"d\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "绝对点尺寸指定
"\!\(\*StyleBox[\"\\\"AbsoluteThickness[\\\"\", \"MR\"]\)\!\(\*StyleBox[\"\\\"w\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "绝对线宽指定
"\!\(\*StyleBox[\"\\\"CMYKColor[\\\"\", \"MR\"]\)\!\(\*StyleBox[\"\\\"c\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) \!\(\*StyleBox[\"\\\"m\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) \!\(\*StyleBox[\"\\\"y\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) \!\(\*StyleBox[\"\\\"k\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "颜色指定
"\!\(\*StyleBox[\"\\\"Dashing[\\\"\", \"MR\"]\)"{"\!\(\*StyleBox[\"\\\"w\\\"\", \"TI\"]\)"1"\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) ... "}"\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "线型指定
"\!\(\*StyleBox[\"\\\"GrayLevel[\\\"\", \"MR\"]\)\!\(\*StyleBox[\"\\\"i\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "灰度指定
"\!\(\*StyleBox[\"\\\"Hue[\\\"\", \"MR\"]\)\!\(\*StyleBox[\"\\\"h\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) "色调指定
"\!\(\*StyleBox[\"\\\"PointSize[\\\"\", \"MR\"]\)\!\(\*StyleBox[\"\\\"d\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) """点尺寸指定
"\!\(\*StyleBox[\"\\\"RGBColor[\\\"\", \"MR\"]\)\!\(\*StyleBox[\"\\\"r\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) \!\(\*StyleBox[\"\\\"g\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\",\\\"\", \"MR\"]\) \!\(\*StyleBox[\"\\\"b\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) ""颜色指定"
"\!\(\*StyleBox[\"\\\"Thickness[\\\"\", \"MR\"]\)\!\(\*StyleBox[\"\\\"w\\\"\", \"TI\"]\)\!\(\*StyleBox[\"\\\"]\\\"\", \"MR\"]\) """线宽指定
• 可以使用下列选项:
"\!\(\*StyleBox[\"\\\"AspectRatio\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"1/GoldenRatio\\\"\", \"MR\"]\) "高与宽的比
"\!\(\*StyleBox[\"\\\"Axes\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"False\\\"\", \"MR\"]\) "是否画坐标轴
"\!\(\*StyleBox[\"\\\"AxesLabel\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"None\\\"\", \"MR\"]\) "坐标轴标签
"\!\(\*StyleBox[\"\\\"AxesOrigin\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"Automatic\\\"\", \"MR\"]\) "坐标轴原点
"\!\(\*StyleBox[\"\\\"AxesStyle\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"Automatic\\\"\", \"MR\"]\) "用来指定坐标轴风格的图形指令
"\!\(\*StyleBox[\"\\\"Background\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"Automatic\\\"\", \"MR\"]\) ""图象的背景色 "
"\!\(\*StyleBox[\"\\\"ColorOutput\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"Automatic\\\"\", \"MR\"]\) ""输出颜色类型 "
"\!\(\*StyleBox[\"\\\"DefaultColor\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"Automatic\\\"\", \"MR\"]\) "图象元素的缺省颜色
"\!\(\*StyleBox[\"\\\"DisplayFunction\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"$DisplayFunction\\\"\", \"MR\"]\) "输出函数
"\!\(\*StyleBox[\"\\\"Epilog\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"{}\\\"\", \"MR\"]\) "主图象之后执行的图形指令
"\!\(\*StyleBox[\"\\\"FormatType\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"$FormatType\\\"\", \"MR\"]\) "文本的缺省格式类型
"\!\(\*StyleBox[\"\\\"Frame\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"False\\\"\", \"MR\"]\) """是否围绕图形放上一个框
"\!\(\*StyleBox[\"\\\"FrameLabel\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"None\\\"\", \"MR\"]\) "框标签
"\!\(\*StyleBox[\"\\\"FrameStyle\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"Automatic\\\"\", \"MR\"]\) "用来给出框风格的图形指令
"\!\(\*StyleBox[\"\\\"FrameTicks\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"Automatic\\\"\", \"MR\"]\) "框标记
"\!\(\*StyleBox[\"\\\"GridLines\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"None\\\"\", \"MR\"]\) "要画的网格线
"\!\(\*StyleBox[\"\\\"ImageSize\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"Automatic\\\"\", \"MR\"]\) "笔记本中使用的图形的绝对大小
"\!\(\*StyleBox[\"\\\"PlotLabel\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"None\\\"\", \"MR\"]\) ""图形标签"
"\!\(\*StyleBox[\"\\\"PlotRange\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"Automatic\\\"\", \"MR\"]\) "图形值的范围
"\!\(\*StyleBox[\"\\\"PlotRegion\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"Automatic\\\"\", \"MR\"]\) "要被填充的最后显示区域
"\!\(\*StyleBox[\"\\\"Prolog\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"{}\\\"\", \"MR\"]\) "在主图之前使用的图形指令
"\!\(\*StyleBox[\"\\\"RotateLabel\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"True\\\"\", \"MR\"]\) "是否旋转框上的y标签
"\!\(\*StyleBox[\"\\\"TextStyle\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"$TextStyle\\\"\", \"MR\"]\) "文本缺省风格
"\!\(\*StyleBox[\"\\\"Ticks\\\"\", \"MR\"]\) ""\!\(\*StyleBox[\"\\\"Automatic\\\"\", \"MR\"]\) "标记
• 可以给出图形指令的嵌套列表. 诸如GrayLevel的指定实际上只保持到直至包含它们的列表末尾.
Graphics[Graphics3D[ ... ]]生成一个与3D图形对应的普通2D图形对象. 这同SurfaceGraphics, ContourGraphicsDensityGraphics有相同效果.
Graphics[ ... ]的标准输入形式是-Graphics-.InputForm输出指令的显式列表.
• 参见 Mathematica全书: 2.9.1节.
• 同时参见: Plot, ListPlot, ParametricPlot.
• 相关的包: Graphics`Graphics`.
Further Examples

This defines a polygon and a line from some vertices.

In[1]:=  

In[2]:=  

In[3]:=  

You can create pictures and display graphics primitives using Graphics.

Evaluate cell to see the graphic.

In[4]:=  

In[5]:=