|
繪圖指令
|
Plot[f,{x,xmin,xmax}] |
畫f,從xmin畫到xmax |
|
|
Plot[{f1,f2,f3...},{x,xmin,xmax}] |
同時畫出數個函數圖 |
|
|
Plot[Evaluate[f],{x,xmin,xmax}] |
先對f算值再畫圖 |
|
|
Plot[Evaluate[Table[f,..]],{x,xmin,xmax}] |
產生出一系列函數再畫圖 |
|
|
Plot[Evaluate[y[x]/.solution],{x,xmin,xmax}] |
畫微分方程式解的圖 |
|
選項設定的意義
|
Automatic |
預設值 |
|
|
None |
不包含此項目 |
|
|
All |
包含此項目 |
|
|
True |
執行此項目 |
|
|
False |
不執行此項目 |
|
選項種類
|
選項 |
說明 |
預設 |
|
AspectRatio |
長寬比例,預設約0.618 |
1/GoldenRatio |
|
Axes |
是否含座標軸 Axes->{False,True},只畫y的坐標軸 |
Automatic |
|
AxesLabel |
座標軸是否含標記。若要含標記, AxesLabel->{"xlabel","ylabel"},只有一個的話就是y軸 |
None |
|
AxesOrigin |
AxesOrigin->{x,y} |
Automatic |
|
TextStyle |
所使用的字型 |
$TextStyle |
|
FormatType |
預設的字型 |
StandardForm |
|
DisplayFunction |
如何展示圖形,設Identity將不顯示任何圖形 |
$DisplayFunction |
|
Frame |
是否加外框 |
False |
|
FrameLabel |
是否從X軸下方以順時針的順序來加註解
FrameLabel->None
FrameLabel->{x,y}設定下方左方的標記
FrameLabel->{x1,y1,x2,y2}從X軸下方順時針方向設定四邊的標記 |
None |
|
FrameTicks |
為外框加刻度,None不加,{xticks,yticks,..}設每一邊的刻度 |
Automatic |
|
GridLines |
加上網格線 |
None |
|
PlotLabel |
PlotLabel->label設定整張圖圖名 |
None |
|
PlotRange |
PlotRange->All繪出所有圖形
PlotRange->{min,max}指定y方向的範圍
PlotRange->{{xmin,xmax},{ymin,ymax}}分別指定xy方向的範圍 |
Automatic |
|
Ticks |
Ticks->None 沒有刻度記號
Ticks->{xticks,yticks} 設定xy方向刻度記號的位置
Ticks->{{x1,label1,len1},{x2,label2,len2},....} 在xn位置填上labeln記號並指定n長度 |
Automatic |
TextStyle指令的下法:
|
ex:TextStyle->{FontSize->n, FontWeight->"Bold", FontFamily->"Name" } |
|
參數 |
選項 |
|
|
FontSize |
12 |
字型大小 |
|
FontWeight |
"Plain" or "Bold" |
是否為粗體字 |
|
FontSlant |
"Plain" or "Italic" |
是否為斜體字 |
|
FontFamily |
"Courier" ,"Times" ,"Helvetica" |
字型的種類 |
|
FontColor |
GrayLevel[0] |
字的顏色 |
|
Background |
GrayLevel[1] |
背景的顏色 |
離散資料繪圖
|
ListPlot[{y1 , y2, …}] |
將一個個的離散資料畫出來 |
|
|
ListPlot[{{x1,y1},{x2,y2},...}] |
畫出{x1,y1},{x2,y2},..的點 |
|
|
ListPlot[list,PlotJoined -> True] |
把點用線段連起來 |
|
|
ListPlot3D[{z11,z12,...},{z21,z22,...}] |
3D離散資料繪圖 |
|
|
ListContourPlot[array] |
離散等高線繪圖 |
|
|
ListDensityPlot[array] |
離散密度繪圖 |
|
指定顏色和線條粗細
|
Plot[{f1,f2,...},{x,xmin,xmax},PlotStyle->{RGBColor[r1,g1,b1],RGBColor[r2,g2,b2],...}] |
|
分別以RGB1,RGB2..分別為f1,f2上色 |
|
Plot[{f1,f2,...},{x,xmin,xmax},PlotStyle->{GrayLevel[i],GrayLevel[j],..}] |
|
分別以GrayLeveli,j分別為f1,f2上色 |
|
Plot[{f1,f2,...},{x,xmin,xmax},PlotStyle->{Thickness[r1],Thickness[r2],...}] |
|
指定r1,r2為線條的寬度 |
圖形的合併
|
Show[plot] |
重新顯示一張圖 |
|
|
Show[plot1,plot2,...] |
合併plot1,plot2 |
|
|
Show[plot,option->options] |
加入選項 |
|
圖形的並排
|
Show[GraphicsArray[{{g1}, {g2}}]] |
將圖形垂直並排 |
|
Show[GraphicsArray[{g1, g2}]] |
將圖形水平並排 |
|
Show[GraphicsArray[{{g1, g2}, {g3, g4}}]] |
將圖形排成矩陣形式 |
參數式繪圖
|
ParametricPlot[{x[t], y[t]}, {t, tmin, tmax}] |
參數式繪圖 |
|
ParametricPlot[[{x1[t], y1[t]}, {x2[t], y2[t]},...],{t, tmin, tmax}] |
同時畫很多圖 |
|
ParametricPlot[{x[t], y[t]}, {t, tmin, tmax},AspectRatio -> Automatic] |
保持x:y的比例為1:1 |
等高線繪圖
|
ContourPlot[f, {x,xmin,xmax}, {y,ymin,ymax}] |
f的等高線繪圖 |
|
參數 |
意義 |
預設值 |
|
ColorFunction |
填色的選則 |
Automatic |
|
Contours |
等高線的數目 |
10 |
|
PlotRange |
高度z的範圍{zmin, zmax} , All or Automatic |
Automatic |
|
ContourShading |
Contours的上色 False不上色 |
True |
|
PlotPoints |
試驗函數在各方向的最少點數 |
25 |
|
ContourLines |
是否要畫等高線 |
True |
|
Compiled |
是否要編譯欲繪出的函數成機器碼 |
True |
密度圖
|
DensityPlot[f, {x,xmin,xmax}, {y,ymin,ymax}] |
f的密度圖 |
|
選項 |
意義 |
預設值 |
|
Mesh |
是否加上網格線 |
True |
|
PlotPoints |
各方向取樣點的最少數目 |
25 |
|
ColorFunction |
選顏色,Hue為色彩,預設為灰階 |
Automatic |
|
Compiled |
是否要編譯欲繪出的函數成機器碼 |
True |
3D繪圖
|
Plot3D[f,{x,xmin,xmax},{y,ymin,ymax}] |
指定xy的範圍畫出f的3d圖 |
|
|
Plot3D[f,GrayLevel[g],{x,xmin,xmax},{y,ymin,ymax}] |
三維圖依g來上灰階 |
|
|
Plot3D[f,Hue[g],{x,xmin,xmax},{y,ymin,ymax}] |
三維圖依g來上全彩 |
|
|
選項 |
意義 |
預設值 |
|
Axes |
是否要畫座標軸 |
True |
|
AxesLabel |
每一軸的標示{xlabel, ylabel, zlabel} |
None |
|
Boxed |
是否在外面加一個3d的盒子 |
True |
|
ColorFunction |
上色的方式。Hue是表示一系列色彩 |
Automatic |
|
TextStyle |
字的型式 |
$TextStyle |
|
FormatType |
字的格式 |
StandardForm |
|
DisplayFunction |
顯示圖形的模式。Identity無圖形顯示 |
$DisplayFunction |
|
FaceGrids |
是否加上表面網格。All表示每一面都加上網格 |
None |
|
HiddenSurface |
是否除去隱藏線 |
True |
|
Lighting |
是否用光源來上色 |
True |
|
Mesh |
是否加上網格線 |
True |
|
PlotRange |
Z方向上繪圖的範圍 |
Automatic |
|
Shading |
表面是否上色和留白 |
True |
|
ViewPoint |
視角的參數 |
{1.3,-2.4,2} |
|
PlotPoints |
不同方向取樣點的數目 |
25 |
|
Compiled |
是否要編譯欲繪出的函數成機器碼 |
True |
其中ViewPoint的參數
|
{1.3,-2.4,2} |
預設 |
|
|
{0,-2,0} |
從前方看 |
|
|
{0,0,2} |
上往下看 |
|
|
{0,-2,2} |
前方上面往下面看 |
|
|
{0,-2,-2} |
前方下面往上面看 |
|
|
{-2,-2,0} |
從左前方看 |
|
|
{2,-2,0} |
從右前方看 |
|
三維參數繪圖
|
ParametricPlot3D[{f1,f2,f3},{t,tmin,tmax}] |
以t為參數畫出三維的點f1,f2,f3 |
|
|
ParametricPlot3D[{f1,f2,f3},{t,tmin,tmax},{u,umin,umax}] |
以t,u為參數畫出三維的點f1,f2,f3 |
|
|
ParametricPlot3D[{{f1,f2,f3},{g1,g2,g3}},..] |
同時畫出多個參數圖 |
|
|
ParametricPlot3D[{f1,f2,f3,h},....] |
以h函數來上色 |
|
圖形的轉換
|
Show[ContourGraphics[h]] |
將圖形轉成等高線圖 |
|
|
Show[DensityGraphics[h]] |
將圖形轉成密度圖 |
|
|
Show[SurfaceGraphics[h]] |
將圖形轉成三維立體圖 |
|
|
Show[Graphics[h]] |
將三維轉成二維影像 |
|
圖元和線段控制指令
|
GrayLevel[i] |
0到1的灰階 |
|
|
RGBColor[r,g,b] |
紅藍綠,rgb都是0到1的數字 |
|
|
Hue[h] |
0到1的色彩 |
|
|
Hue[h,s,b] |
指定色彩h、飽和度s、亮度b |
|
|
Thickness[r] |
r倍的寬度來畫線 |
|
|
AbsoluteThickness[s] |
以絕對寬度s來畫線 |
|
|
Dashing[{r1,r2,..}] |
以虛線顯示線段 |
|
|
AbsoluteDashing[{s1,s2,..}] |
以絕對單位來做為虛線線段的長度 |
|
三維基本圖元
|
Point[{x,y,z}] |
{x,y,z}的點 |
|
|
Line[{x1,y1,z1},{x2,y2,z2},...] |
連接不同點的線段 |
|
|
Polygon[{x1,y1,z1},{x2,y2,z2},...] |
多邊形 |
|
|
Cuboid[{x1,y1,z1},{x2,y2,z2}] |
立方體 |
|
|
Text[expr,{x,y,z}] |
以點為中心的文字expr |
|
對數繪圖
|
<< Graphics`Graphics` |
先載入函式庫 |
|
|
LogPlot[f,{x,x1,x2}] |
線性對數繪圖 |
|
|
LogLinearPlot[f,{x,x1,x2}] |
對數線性繪圖 |
|
|
LogLogPlot[f,{x,x1,x2}] |
對數對數繪圖 |
|
|
LogListPlot[{x1,y1},{x2,y2},...] |
串列繪圖,y軸為對數 |
|
|
LogLinearListPlot[{x1,y1},{x2,y2},...] |
串列繪圖,x軸為對數 |
|
|
LogLogListPlot[{x1,y1},{x2,y2},...] |
串列繪圖,x,y軸為對數 |
|
極座標繪圖
|
<< Graphics`Graphics` |
先載入函式庫 |
|
|
PolarPlot[f,{t,t1,t2}] |
極坐標繪圖,角度從t1到t2 |
|
|
PolarPlot[{f1,f2,f3},{t,t1,t2}] |
同時畫數張極坐圖 |
|
|
PolarListPlot[{r1,r2,...}] |
以相等角度繪出距原點為r1,r2的等 |
|
隱函數繪圖
|
<< Graphics`ImplicitPlot` |
載入函式庫 |
|
|
ImplicitPlot[eqn,{x,x1,x2}] |
於指定範圍內做隱函數繪圖 |
|
|
ImplicitPlot[{eqn1,eqn2,...},ranges,options] |
同時畫數個隱函數圖 |
|
向量場繪圖
|
<< Graphics`PlotField` |
載入函式庫 |
|
|
PlotVectorField[{fx,fy},{x,xmin,xmax},{y,ymin,ymax}] |
畫函數f的向量場 |
|
|
PlotGradientField |
畫函數f的梯度向量場 |
|
|
|
|
|
其中的參數
|
ScaleFactor |
依比例畫出箭頭的大小 |
|
ScaleFunction |
用來指定箭頭大小的函數 |
|
ColorFunction |
設定顏色的函數 |
|
HeadLength |
設定箭頭的大小 |
三維等值曲線的指令
|
<< Graphics`ContourPlot3D` |
載入函式庫 |
|
|
ContourPlot3D[[f,{x,xmin,xmax},{y,ymin,ymax},{z,zmin,zmax}]] |
畫f=constant的三維等值曲面圖 |
|
離散資料的繪圖
|
<< Graphics`Graphics3D` |
載入函式庫 |
|
ScatterPlot3D[{x1,y1,z1},{x2,y2,z2},..] |
資料點的3度空間繪圖 |
|
ScatterPlot3D[{{x1,y1,z1},{x2,y2,z2},..},PlotJoined -> True] |
用線段連接起來 |
|
Shadow[h] |
將h投影到三個平面上 |
|
ShadowPlot3D[f,{x,xmin,xmax},{y,ymin,ymax}] |
投影到xy平面上 |
|
StackGraphics[{h1,h2,..}] |
將h1,h2,..疊起來成為三維的物件 |
三維向量場和梯度的繪圖
|
<< Graphics`PlotField3D` |
載入函式庫 |
|
PlotVectorField3D[{f1,f2,f3},{x,xmin,xmax},{y,ymin,ymax},{z,zmin,zmax}] |
三維向量場繪圖 |
|
PlotGradientField3D[f,{x,xmin,xmax},{y,ymin,ymax},{z,zmin,zmax}] |
三維梯度向量場繪圖 |
|
SphericalPlot3D[r,{theta,min,max},{phi,min,max}] |
畫出三維球 |
其他繪圖
|
TextListPlot[{x1,y1,"s1"},....] |
用Sn的字串來描繪出xn,yn |
|
|
ListPlotVectorField[list] |
用list裏的二維陣列來畫出向量場 |
|
動態繪圖
|
<<Graphics`Animation` |
讀入函式庫 |
|
|
Animate[plot,{t,tmin,tmax}] |
以不同的t來執行plot |
|
|
ShowAnimation[{g1,g2,...}] |
依序執行g來展示動畫 |
|
|