ContourPlot[f,{x,xmin,xmax},{y,ymin,ymax}]
f を x と y の関数とした等高線プロットを作成する.
ContourPlot[f==g,{x,xmin,xmax},{y,ymin,ymax}]
f=g である等高線をプロットする.
ContourPlot[{f1==g1,f2==g2,…},{x,xmin,xmax},{y,ymin,ymax}]
複数の等高線をプロットする.
ContourPlot[…,{x,y}∈reg]
変数{x,y}が,幾何学領域 reg にあるものと解釈する.
ContourPlot
ContourPlot[f,{x,xmin,xmax},{y,ymin,ymax}]
f を x と y の関数とした等高線プロットを作成する.
ContourPlot[f==g,{x,xmin,xmax},{y,ymin,ymax}]
f=g である等高線をプロットする.
ContourPlot[{f1==g1,f2==g2,…},{x,xmin,xmax},{y,ymin,ymax}]
複数の等高線をプロットする.
ContourPlot[…,{x,y}∈reg]
変数{x,y}が,幾何学領域 reg にあるものと解釈する.
詳細とオプション
- ContourPlotは,等値線,iso曲線,等位集合,あるいは下位集合しても知られている.
- ContourPlotは,関数 f が与えられると,f[x,y]が定数値 d1,d2等を持つ等位集合に対応する等高線を構築する.デフォルトで,値が diと di+1の間にある領域がより簡単に識別できるように曲線間の領域には陰影が付けられる.
- これは,領域
を可視化する. - ContourPlotは,等式 f==g が与えられるとこの等式を満足する{x,y}の曲線を表示する.領域の陰影付けは行われない.複数の等式からの曲線は陰影付けが無意味である任意の方法で交差することがある.これは,集合
を可視化する. - f が実数に評価されない位置では,等高線プロットの背景が見えるように表面に穴が残る.
- ContourPlotは,実質的にBlockを使い変数 x と変数 y を局所的なものとして扱う.
- ContourPlotには属性HoldAllがあり,x と y に特定の数値を割り当てた後ではじめて fiと giを評価する.
- 場合によっては,x と y に特定の数値が割り当てられる前にEvaluateを使って fiと giを記号的に評価した方がより効率的である.
- f を評価するとNoneになる領域のプロット部分は空白のまま残される.
- ContourPlotには,Graphicsと同じオプションに以下が追加・修正されたものが使われる. [全オプションのリスト]
- PlotLegendsでよく使われ設定
-
None 凡例は使わない Automatic 凡例を自動的に決定する Placed[lspec,…] 凡例の置き方を指定する - ContourShading->Automaticのデフォルト設定では,ContourPlot[f,…]については陰影付けが行われるが,ContourPlot[f==g,…]については行われない.
- ContourPlot[{f1==g1,f2==g2,…},…]は,等式 fi==gi のすべてに関連する等高線を重ね合せる.
- ColorData["DefaultPlotColors"]は,方程式の集合をプロットする際にContourStyleで使われるデフォルトの色のシーケンスを与える.
- 等高線レベル間の領域の彩色方法の決定の際,ContourPlotは,まずContourShadingに与えられた明示的な設定を調べて,その後ColorFunctionに与えられた設定を調べる.
- ColorData["DefaultPlotColors"]は,ContourStyleで使われるデフォルトの色のシーケンスを与える.
- ContourPlotは最初に,PlotPointsで指定された等間隔に置かれたサンプル点の格子で,f を評価する.次に,適応的なアルゴリズムを用いて最高MaxRecursion回まで部分分割し,滑らかな等高線を生成する.
- ContourPlotは有限個のサンプル点しか使わないことで,関数の特徴を見付けられない可能性もあるので注意されたい.結果の検証にはPlotPointsとMaxRecursionの設定値を大きくしてみるとよい.
- PerformanceGoalの設定値によっては,他の特定のオプション設定が無効となることもある.
- MeshFunctionsとRegionFunctionの関数に渡される引数は x,y,f である.
- ColorFunctionには引数が1つ渡される.この引数はデフォルトで,連続する等高線レベルの各ペアについての f のスケールされた値の平均で渡される.
- デフォルト設定のExclusions->AutomaticおよびExclusionsStyle->Noneでは,不連続性を感知した位置で,ContourPlotのサンプリングの連続性が途絶える.この不連続性は,特定の等高レベルから飛び抜けるような場合にのみ即座に分かるようになる.
- ScalingFunctionsの可能な設定値
-
sf f の値をスケールする {sx,sy} x 軸と y 軸をスケールする {sx,sy,sf} x 軸,y 軸,f の値をスケールする - 次は,各入力を別々のプロットパネルで表示するPlotLayoutの可能な設定である.
-
"Column" パネルの列内で別々の等高線を使う "Row" パネルの行内で別々の等高線を使う {"Column",k},{"Row",k} k 列(行)を使う {"Column",UpTo[k]},{"Row",UpTo[k]} 最高で k 列(行)を使う - LightingAngle->None以外の設定では,ContourPlotはBoxRatiosが決定する高さの値に基づいた擬似照明を含む.
- ContourPlotはGraphics[GraphicsComplex[data]]を返す.
全オプションのリスト
例題
すべて開く すべて閉じる例 (4)
ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}]ContourPlot[Cos[x] + Cos[y] == 1 / 2, {x, 0, 4Pi}, {y, 0, 4Pi}]ContourPlot[{Abs[Sin[x]Sin[y]] == 0.5, Abs[Cos[x]Cos[y]] == 0.5}, {x, -3, 3}, {y, -3, 3}]ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, PlotLegends -> Automatic]スコープ (22)
サンプリング (11)
関数が急速に変化するところではより多くの点がサンプルとして取られる:
ContourPlot[Sin[x y], {x, 0, 2}, {y, 0, 2}, Mesh -> All]ContourPlot[1 / (x ^ 2 + y ^ 2), {x, -1, 1}, {y, -1, 1}]ContourPlot[Sqrt[x y], {x, -1, 1}, {y, -1, 1}]ContourPlot[Im[ArcSin[(x + I y) ^ 3]], {x, -2, 2}, {y, -2, 2}]PlotPointsとMaxRecursionを使って適応的サンプリングを制御する:
Grid[Table[ContourPlot[Sin[x y], {x, 0, 4}, {y, 0, 4}, PlotPoints -> pp, MaxRecursion -> mr], {mr, {0, 2}}, {pp, {5, 15}}]]PlotRangeを使って関心領域に焦点を当てる:
{ContourPlot[x ^ 4 - 2x ^ 2 + y ^ 4 - 2y ^ 2 + 5, {x, -2, 2}, {y, -2, 2}], ContourPlot[x ^ 4 - 2x ^ 2 + y ^ 4 - 2y ^ 2 + 1, {x, -2, 2}, {y, -2, 2}, PlotRange -> {-2, 2}, ClippingStyle -> None]}Exclusionsを使って曲線を除去したり結果の曲面を分断したりする:
f = 1 / ChebyshevU[x y - 1, 2];{ContourPlot[f, {x, -2, 2}, {y, -2, 2}, ClippingStyle -> Automatic], ContourPlot[f, {x, -2, 2}, {y, -2, 2}, ClippingStyle -> Automatic, Exclusions -> {x == 0, y == 0}]}RegionFunctionを使って曲面を不等式によって与えられた領域に限る:
ContourPlot[Sin[x + y ^ 2], {x, -3, 3}, {y, -2, 2}, RegionFunction -> Function[{x, y, z}, 0 < x + y ^ 2 < Pi]]ContourPlot[Sin[x + Cos[y]], {x, y}∈Disk[{0, 0}, 3]]領域はMeshRegionで指定することができる:
𝒟 = MeshRegion[{{0, 0}, {5, -2}, {3, 0}, {5, 2}}, Polygon[{1, 2, 3, 4}]];ContourPlot[Sin[x]Cos[y], {x, y}∈𝒟]ContourPlot[(x y^2/x^2 + y^4), {x, -Infinity, Infinity}, {y, -Infinity, Infinity}]プレゼンテーション (11)
ContourPlot[Sin[x y], {x, 0, 3}, {y, 0, 3}, FrameLabel -> {x, y}, PlotLabel -> Sin[x y]]ContourPlot[Sin[x y] == 0, {x, -3, 3}, {y, -3, 3}, FrameLabel -> {x, y}, PlotLabel -> Sin[x y] == 0]ContourPlot[Sin[x y], {x, 0, 3}, {y, 0, 3}, ColorFunction -> "Rainbow"]ContourPlot[Sin[x ^ 2 + y ^ 2], {x, -1, 1}, {y, -1, 1}, ContourLabels -> True]ContourPlot[Sin[x ^ 2 + y ^ 2], {x, -1, 1}, {y, -1, 1}, ColorFunction -> "DeepSeaColors", PlotLegends -> Automatic]ContourPlot[{Abs[Sin[x]Sin[y]] == 0.5, Abs[Cos[x]Cos[y]] == 0.5}, {x, -3, 3}, {y, -3, 3}, PlotLegends -> "Expressions"]ContourPlot[Sin[x y], {x, 0, 3}, {y, 0, 3}, ContourShading -> Hue /@ Range[0, 0.8, 0.8 / 10]]ContourPlot[Sin[x y], {x, 0, 3}, {y, 0, 3}, ContourStyle -> {Red, Directive[Red, Dashed]}]ContourPlot[{Abs[Sin[x]Sin[y]] == 0.5, Abs[Cos[x]Cos[y]] == 0.5}, {x, -3, 3}, {y, -3, 3}]ContourPlot[{Abs[Sin[x]Sin[y]] == 0.5, Abs[Cos[x]Cos[y]] == 0.5}, {x, -3, 3}, {y, -3, 3}, ContourStyle -> {Red, Dashed}]ContourPlot[Sin[x y], {x, 0, 3}, {y, 0, 3}, Mesh -> 3, MeshStyle -> {Red, Blue}, MeshFunctions -> {#1&, #2&}]強調された等高線のスタイル,単純な目盛,凡例のテーマを使う:
ContourPlot[Sin[x y], {x, 0, 3}, {y, 0, 3}, PlotTheme -> "Business"]単純な目盛で凡例には太線のカラースキームというテーマを使う:
ContourPlot[{Abs[Sin[x]Sin[y]] == 0.5, Abs[Cos[x]Cos[y]] == 0.5}, {x, -3, 3}, {y, -3, 3}, PlotTheme -> "Web"]ContourPlot[{Sin[x]Cos[y], Sin[x + y]Cos[x - y]}, {x, -7, 7}, {y, -7, 7}, PlotLayout -> "Row"]ContourPlot[{Sin[x]Cos[y], Sin[x + y]Cos[x - y]}, {x, -7, 7}, {y, -7, 7}, PlotLayout -> "Column"]オプション (112)
AspectRatio (4)
デフォルトで,ContourPlotは縦と横に同じ長さを使う:
ContourPlot[Sin[x]Cos[y], {x, -2Pi, 2Pi}, {y, -Pi / 2, 3Pi / 2}]ContourPlot[Sin[x]Cos[y], {x, -2Pi, 2Pi}, {y, -Pi / 2, 3Pi / 2}, AspectRatio -> 1 / 2]AspectRatioAutomaticはプロット範囲から縦横比を決める:
ContourPlot[Sin[x]Cos[y], {x, -2Pi, 2Pi}, {y, -Pi / 2, 3Pi / 2}, AspectRatio -> Automatic]AspectRatioFullは他の構造物の中にぴったり収まるように縦横比を調節する:
plot = ContourPlot[Sin[x]Cos[y], {x, -2Pi, 2Pi}, {y, -Pi / 2, 3Pi / 2}, AspectRatio -> Full];
{Framed[Pane[plot, {75, 100}]], Framed[Pane[plot, {100, 100}]], Framed[Pane[plot, {100, 75}]]}Axes (4)
デフォルトで,ContourPlotは軸ではなく枠を使う:
ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}]ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}, Frame -> False, Axes -> True]AxesOriginを使って軸の交点を指定する:
ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}, Frame -> False, Axes -> True, AxesOrigin -> {1, 1}]{ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}, Frame -> False, Axes -> {True, False}], ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}, Frame -> False, Axes -> {False, True}]}AxesLabel (4)
ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}, Frame -> False, Axes -> True]ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}, Frame -> False, Axes -> True, AxesLabel -> y]ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}, Frame -> False, Axes -> True, AxesLabel -> {x, y}]ContourPlotで指定された変数に基づくラベルを使う:
ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}, Frame -> False, Axes -> True, AxesLabel -> Automatic]AxesOrigin (2)
AxesStyle (4)
ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}, Frame -> False, Axes -> True, AxesStyle -> Red]ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}, Frame -> False, Axes -> True, AxesStyle -> {Red, Blue}]ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}, Frame -> False, Axes -> True, AxesStyle -> Green, TicksStyle -> Blue]ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}, Frame -> False, Axes -> True, AxesStyle -> Green, LabelStyle -> Blue]BoundaryStyle (5)
ContourPlot[Sin[x y], {x, -2, 2}, {y, -2, 2}]ContourPlot[Sin[x y], {x, -2, 2}, {y, -2, 2}, BoundaryStyle -> Red]ContourPlot[Sin[x y], {x, -2, 2}, {y, -2, 2}, BoundaryStyle -> Directive[Red, Thick]]BoundaryStyleはRegionFunctionによって切り取られた穴に適用される:
ContourPlot[Sin[x y], {x, -2, 2}, {y, -2, 2}, BoundaryStyle -> Red, RegionFunction -> Function[{x, y, z}, x ^ 2 + y ^ 2 ≥ 1]]BoundaryStyleはExclusionsによって切り取られた部分には適用されない:
ContourPlot[Im[Sqrt[x + I y]], {x, -2, 2}, {y, -2, 2}, BoundaryStyle -> Red]代りにExclusionsStyleを使う:
ContourPlot[Im[Sqrt[x + I y]], {x, -2, 2}, {y, -2, 2}, ExclusionsStyle -> Red]ClippingStyle (4)
ContourPlot[Im[Gamma[x + I y]], {x, -3.5, 3.5}, {y, -3.5, 3.5}, ClippingStyle -> Automatic]ContourPlot[Im[Gamma[x + I y]], {x, -3.5, 3.5}, {y, -3.5, 3.5}, ClippingStyle -> None]ContourPlot[Im[Gamma[x + I y]], {x, -3.5, 3.5}, {y, -3.5, 3.5}, ClippingStyle -> Pink]上に切り取られた部分には薄い赤,下に切り取られた部分にはピンクを使う:
ContourPlot[Im[Gamma[x + I y]], {x, -3.5, 3.5}, {y, -3.5, 3.5}, ClippingStyle -> {Pink, LightRed}]ColorFunction (3)
ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}, ColorFunction -> Hue]ContourPlot[y + Sin[x ^ 2 + 3y], {x, -3, 3}, {y, -3, 3}, ColorFunction -> "DarkRainbow"]ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, Contours -> {1 / 2}, ColorFunction -> (If[#1 > 1 / 2, Red, White]&)]ColorFunctionScaling (1)
ContourLabels (2)
ContourLines (1)
ContourLinesはContourStyleに置き換えられた:
{ContourPlot[Sin[x]Sin[y], {x, -2, 2}, {y, -3, 3}, ContourLines -> False], ContourPlot[Sin[x]Sin[y], {x, -2, 2}, {y, -3, 3}, ContourStyle -> None]}Contours (7)
ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, Contours -> 10]ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, Contours -> Automatic]ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, Contours -> {Automatic, 5}]ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, Contours -> {-0.5, 0.5}]ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, Contours -> {{-0.5, Thick}, {0.5, Dashed}}]ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, Contours -> Function[{min, max}, Range[min, max, 0.1]]]ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, Contours -> Function[{min, max}, Rescale[{0.1, 0.9}, {0, 1}, {min, max}]]]ContourShading (4)
ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, ContourShading -> Automatic]Noneを使うと等高線だけが示される:
ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, ContourShading -> None]ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, ContourShading -> Automatic, ColorFunction -> "Rainbow"]ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, Contours -> 3, ContourShading -> {Red, Orange, Yellow, White}]ContourStyle (7)
ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, ContourStyle -> Automatic]ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, ContourStyle -> Opacity[1]]Noneを使って等高線を示さないようにする:
ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, ContourStyle -> None]ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, ContourStyle -> {Red, Dashed}]ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, ContourStyle -> Directive[Red, Dashed]]ContourPlot[{Abs[Sin[x]Sin[y]] == 0.5, Abs[Cos[x]Cos[y]] == 0.5}, {x, -3, 3}, {y, -3, 3}, ContourStyle -> {Red, Dashed}]ContourPlot[{Abs[Sin[x]Sin[y]] == 0.5, Abs[Cos[x]Cos[y]] == 0.5}, {x, -3, 3}, {y, -3, 3}, ContourStyle -> Directive[Red, Dashed]]EvaluationMonitor (2)
ContourPlotが関数のどの部分をサンプルとするかを示す:
ListPlot[Reap[ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, EvaluationMonitor :> Sow[{x, y}]]][[-1, 1]], PlotStyle -> PointSize[Tiny]]Block[{k = 0}, ContourPlot[Sin[x]Sin[y], {x, -3, 3}, {y, -3, 3}, EvaluationMonitor :> k++];k]Exclusions (6)
ContourPlot[Im[ArcSin[x + I y]], {x, -2, 2}, {y, -2, 2}]ContourPlot[Im[ArcSin[x + I y]], {x, -2, 2}, {y, -2, 2}, Exclusions -> None]ContourPlot[ 1 / (y ^ 2 - x ^ 3 + 3x - 3), {x, -3, 3}, {y, -3, 3}, Exclusions -> {y ^ 2 - x ^ 3 + 3x - 3 == 0}, ClippingStyle -> Automatic]ContourPlot[Tan[x y] + 1 / (y ^ 2 - x ^ 3 + 3x - 3), {x, -2, 2}, {y, -2, 2}, Exclusions -> {Cos[x y] == 0, y ^ 2 - x ^ 3 + 3x - 3 == 0}, ClippingStyle -> Automatic]ContourPlot[Im[Sqrt[x + I y]], {x, -2, 2}, {y, -2, 2}, Exclusions -> {{y == 0, x ≤ 0}}]ContourPlot[Im[(x + I y) ^ (1 / 3)] / (x ^ 2 - y ^ 2), {x, -2, 2}, {y, -2, 2}, Exclusions -> {Automatic, x ^ 2 - y ^ 2 == 0}, ClippingStyle -> Automatic]//QuietExclusionsStyle (2)
ImageSize (7)
Tiny,Small,Medium,Largeのように名前付きのサイズを使う:
{ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, ImageSize -> Tiny], ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, ImageSize -> Small]}{ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, ImageSize -> 150], ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, AspectRatio -> 1.5, ImageSize -> 150]}{ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, ImageSize -> {Automatic, 150}], ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, AspectRatio -> 2, ImageSize -> {Automatic, 150}]}{ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, ImageSize -> UpTo[200]], ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, AspectRatio -> 2, ImageSize -> UpTo[200]]}グラフィックスの縦横の長さを指定し,必要なら空間で充填する:
ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, ImageSize -> {300, 200}, Background -> StandardGray]AspectRatioFullとすると使用可能な空間が埋められる:
ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, AspectRatio -> Full, ImageSize -> {200, 300}, Background -> StandardGray]{ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, ImageSize -> {UpTo[150], UpTo[100]}], ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, AspectRatio -> 2, ImageSize -> {UpTo[150], UpTo[100]}]}ImageSizeFullを使ってオブジェクトの中の使用可能な空間を埋める:
Framed[Pane[ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, ImageSize -> Full, AspectRatio -> Full, Background -> StandardGray], {300, 200}]]Framed[Pane[ContourPlot[Cos[x] + Cos[y], {x, 0, 4Pi}, {y, 0, 4Pi}, AspectRatio -> Full, ImageSize -> {Scaled[0.5], Scaled[0.5]}, Background -> StandardGray], {200, 100}]]MaxRecursion (1)
Mesh (2)
{ContourPlot[Sin[x + y ^ 2], {x, -3, 3}, {y, -2, 2}, Mesh -> Full], ContourPlot[Sin[x + y ^ 2], {x, -3, 3}, {y, -2, 2}, Mesh -> All]}{ContourPlot[Sin[x + y ^ 2] == 0, {x, -3, 3}, {y, -2, 2}, Mesh -> Full],
ContourPlot[Sin[x + y ^ 2] == 0, {x, -3, 3}, {y, -2, 2}, Mesh -> All]}ContourPlot[Sin[x + y ^ 2], {x, -3, 3}, {y, -2, 2}, Mesh -> 5, MeshFunctions -> {#1&, #2&}]ContourPlot[Sin[x + y ^ 2] == 0, {x, -3, 3}, {y, -2, 2}, Mesh -> 5, MeshFunctions -> {#1&, #2&}]MeshFunctions (2)
ContourPlot[Sin[x + y ^ 2], {x, -3, 3}, {y, -2, 2}, MeshFunctions -> {#1&, #2&}, Mesh -> {5, 5}]ContourPlot[Sin[x + y ^ 2] == 0, {x, -3, 3}, {y, -2, 2}, MeshFunctions -> {#1&, #2&}, Mesh -> {5, 5}]ContourPlot[Sin[x + y ^ 2], {x, -3, 3}, {y, -2, 2}, MeshFunctions -> {Norm[{#1, #2, #3}]&}, Mesh -> 5]ContourPlot[Sin[x + y ^ 2] == 0, {x, -3, 3}, {y, -2, 2}, MeshFunctions -> {Norm[{#1, #2}]&}, Mesh -> 5]MeshStyle (2)
ContourPlot[Sin[x + y ^ 2], {x, -3, 3}, {y, -2, 2}, MeshStyle -> Red, Mesh -> 5, MeshFunctions -> {#1&, #2&}]ContourPlot[Sin[x + y ^ 2] == 0, {x, -3, 3}, {y, -2, 2}, MeshStyle -> Red, Mesh -> 5, MeshFunctions -> {#1&, #2&}]
方向に赤いメッシュラインを,
方向に太いメッシュラインを使う:
ContourPlot[Sin[x + y ^ 2], {x, -3, 3}, {y, -2, 2}, MeshStyle -> {Red, Thick}, Mesh -> 5, MeshFunctions -> {#1&, #2&}]ContourPlot[Sin[x + y ^ 2] == 0, {x, -3, 3}, {y, -2, 2}, MeshStyle -> {Red, PointSize[Large]}, Mesh -> 5, MeshFunctions -> {#1&, #2&}]PerformanceGoal (2)
Timing[ContourPlot[Sin[x + y ^ 2], {x, -2, 2}, {y, -2, 2}, PerformanceGoal -> "Quality"]]Timing[ContourPlot[Sin[x + y ^ 2] == 0, {x, -2, 2}, {y, -2, 2}, PerformanceGoal -> "Quality"]]Timing[ContourPlot[Sin[x + y ^ 2], {x, -2, 2}, {y, -2, 2}, PerformanceGoal -> "Speed"]]Timing[ContourPlot[Sin[x + y ^ 2] == 0, {x, -2, 2}, {y, -2, 2}, PerformanceGoal -> "Speed"]]PlotInteractivity (2)
PlotLayout (2)
ContourPlot[{Sin[x]Cos[y], Sin[2x]Cos[y], Sin[x]Cos[2y]}, {x, -3, 3}, {y, -2, 2}, ImageSize -> Medium, PlotLayout -> "Column"]ContourPlot[{Sin[x]Cos[y], Sin[2x]Cos[y], Sin[x]Cos[2y]}, {x, -3, 3}, {y, -2, 2}, ImageSize -> Medium, PlotLayout -> "Row"]ContourPlot[{Sin[x]Cos[y], Sin[2x]Cos[y], Sin[x]Cos[2y]}, {x, -3, 3}, {y, -2, 2}, ImageSize -> Medium, PlotLayout -> {"Row", 2}]ContourPlot[{Sin[x]Cos[y], Sin[2x]Cos[y], Sin[x]Cos[2y], Cos[x]Sin[y], Cos[2x]Sin[y], Cos[x]Sin[2y]}, {x, -3, 3}, {y, -2, 2}, ImageSize -> Medium, PlotLayout -> {"Column", UpTo[4]}]ContourPlot[{Sin[x]Cos[y], Sin[2x]Cos[y], Sin[x]Cos[2y], Cos[x]Sin[y], Cos[2x]Sin[y], Cos[x]Sin[2y]}, {x, -3, 3}, {y, -2, 2}, ImageSize -> Medium, PlotLayout -> {"Column", 4}]PlotLegends (8)
ContourPlot[Sin[2 x + y]Cos[x - 2y], {x, 0, Pi}, {y, 0, Pi}, PlotLegends -> Automatic]Table[ContourPlot[Sin[2 x + y]Cos[x - 2y], {x, 0, Pi}, {y, 0, Pi}, Contours -> c, PlotLegends -> Automatic], {c, {5, 10, 20}}]ContourPlot[Sin[2 x + y]Cos[x - 2y], {x, 0, Pi}, {y, 0, Pi}, PlotLegends -> BarLegend[Automatic, All]]ContourPlot[Sin[2 x + y]Cos[x - 2y], {x, 0, Pi}, {y, 0, Pi}, PlotLegends -> BarLegend[Automatic, None]]PlotLegendsは自動的に色関数をマッチする:
ContourPlot[Sin[2 x + y]Cos[x - 2y], {x, 0, Pi}, {y, 0, Pi}, ColorFunction -> "GrayYellowTones", PlotLegends -> Automatic]PlotLegends->Automaticとすると陰関数曲線にプレースホルダの値でラベルが付けられる:
ContourPlot[{Abs[Sin[x]Sin[y]] == 0.5, Abs[Cos[x]Cos[y]] == 0.5}, {x, -3, 3}, {y, -3, 3}, PlotLegends -> Automatic]PlotLegends->"Expressions"として実際の方程式を使う:
ContourPlot[{Abs[Sin[x]Sin[y]] == 0.5, Abs[Cos[x]Cos[y]] == 0.5}, {x, -3, 3}, {y, -3, 3}, PlotLegends -> "Expressions"]ContourPlot[{Abs[Sin[x]Sin[y]] == 0.5, Abs[Cos[x]Cos[y]] == 0.5}, {x, -3, 3}, {y, -3, 3}, ContourStyle -> {Red, Dashed}, PlotLegends -> {"label1", "label2"}]Placedを使って凡例の位置を変える:
Table[ContourPlot[Sin[x + y ^ 2], {x, -3, 3}, {y, -2, 2}, PlotLegends -> Placed[Automatic, pos], PlotLabel -> pos], {pos, {Before, After}}]Table[ContourPlot[Sin[x + y ^ 2], {x, -3, 3}, {y, -2, 2}, PlotLegends -> Placed[Automatic, pos], PlotLabel -> pos], {pos, {Above, Below}}]BarLegendを使って凡例の外観を変える:
ContourPlot[Sin[x + y ^ 2], {x, -3, 3}, {y, -2, 2}, PlotLegends -> BarLegend[Automatic, LegendMarkerSize -> 180, LegendFunction -> "Frame", LegendMargins -> 5, LegendLabel -> "z-value"]]PlotPoints (1)
Table[ContourPlot[Sin[x + y ^ 2], {x, -3, 3}, {y, -2, 2}, Mesh -> None, MaxRecursion -> 0, PlotPoints -> pp], {pp, {5, 10, 15, 20}}]Table[ContourPlot[Sin[x + y ^ 2] == 0, {x, -3, 3}, {y, -2, 2}, Mesh -> None, MaxRecursion -> 0, PlotPoints -> pp], {pp, {5, 10, 15, 20}}]PlotRange (5)
ContourPlot[1 / (x ^ 2 + y ^ 2), {x, -2, 2}, {y, -2, 2}]ContourPlot[1 / (x ^ 2 + y ^ 2), {x, -2, 2}, {y, -2, 2}, PlotRange -> All]ContourPlot[Sqrt[1 - x ^ 2 - y ^ 2], {x, -2, 2}, {y, -2, 2}, PlotRange -> Full]ContourPlot[Sqrt[1 - x ^ 2 - y ^ 2], {x, -2, 2}, {y, -2, 2}, PlotRange -> Automatic]{ContourPlot[x ^ 2 - y ^ 2, {x, -4, 4}, {y, -4, 4}], ContourPlot[x ^ 2 - y ^ 2, {x, -4, 4}, {y, -4, 4}, PlotRange -> {-2, 2}]}PlotTheme (1)
RegionFunction (4)
ContourPlot[Sin[x + y ^ 2], {x, -2, 2}, {y, -2, 2}, RegionFunction -> Function[{x, y, z}, 1 < x ^ 2 + y ^ 2 < 4], BoundaryStyle -> Red]ContourPlot[Sin[x + y ^ 2], {x, -2, 2}, {y, -2, 2}, RegionFunction -> Function[{x, y, z}, 0 < Mod[x ^ 2 + y ^ 2, 2] < 1], BoundaryStyle -> Red]ContourPlot[Exp[-(x ^ 2 + y ^ 2)], {x, -2, 2}, {y, -2, 2}, RegionFunction -> Function[{x, y, z}, x < 0 || y > 0], BoundaryStyle -> Red]ContourPlot[x ^ 2 == y ^ 3 - y / 5, {x, -1, 1}, {y, -1, 1}, RegionFunction -> Function[{x, y}, x ^ 2 + y ^ 2 < 1]]ScalingFunctions (9)
ContourPlot[Max[x, y], {x, 0, 10}, {y, 0, 10}]ContourPlot[Max[x, y], {x, 0, 10}, {y, 0, 10}, ScalingFunctions -> {None, "Log"}]ContourPlot[Max[x, y], {x, 0, 10}, {y, 0, 10}, ScalingFunctions -> {None, "Reverse"}]ContourPlot[Max[x, y], {x, 0, 10}, {y, 0, 10}, ScalingFunctions -> {None, "Reciprocal"}, PlotRangePadding -> None]ContourPlot[Max[x, y], {x, 0, 10}, {y, 0, 10}, ScalingFunctions -> {"Reverse", "Log"}]ContourPlot[Max[x, y], {x, 0, 10}, {y, 0, 10}, ScalingFunctions -> {"Reverse", None}]ContourPlot[Max[x, y], {x, 0, 10}, {y, 0, 10}, ScalingFunctions -> {None, {-Log[#]&, Exp[-#]&}}]TicksおよびGridLines内の位置は自動的にスケールされる:
ContourPlot[Max[x, y], {x, 0, 10}, {y, 0, 10}, ScalingFunctions -> {"Log", None}, Ticks -> {2 ^ Range[10], Automatic, Automatic}, GridLines -> Automatic]PlotRangeは自動的にスケールされる:
ContourPlot[Max[x, y], {x, 0, 10}, {y, 0, 10}, ScalingFunctions -> {None, "Log"}, PlotRange -> {1, 100}]WorkingPrecision (2)
ContourPlot[Sin[x y + 10 ^ 16], {x, 0, 3}, {y, 0, 3}, WorkingPrecision -> MachinePrecision]ContourPlot[Sin[x y + 10 ^ 16] == 0, {x, 0, 3}, {y, 0, 3}, WorkingPrecision -> MachinePrecision]ContourPlot[Sin[x y + 10 ^ 16], {x, 0, 3}, {y, 0, 3}, WorkingPrecision -> 20]ContourPlot[Sin[x y + 10 ^ 16] == 0, {x, 0, 3}, {y, 0, 3}, WorkingPrecision -> 20]アプリケーション (6)
ContourPlot[2x + 3y == 1, {x, -2, 2}, {y, -2, 2}]ContourPlot[x ^ 2 + y ^ 2 == 1, {x, -1, 1}, {y, -1, 1}]ContourPlot[x ^ 2 + (2y) ^ 2 == 1, {x, -1, 1}, {y, -1, 1}]ContourPlot[x ^ 2 == y, {x, -2, 2}, {y, -2, 2}]ContourPlot[x y == 1, {x, -4, 4}, {y, -4, 4}]ContourPlot[x ^ 2 - y ^ 2 == x ^ 3, {x, -2, 2}, {y, -2, 2}]ContourPlot[Evaluate[Sum[Sin[RandomReal[5, 2].{x, y}], {5}]], {x, 0, 5}, {y, 0, 5}]{min, {steps}} = Reap[NMinimize[{(x - 1) ^ 2 + 100(y - x ^ 2) ^ 2, x ^ 2 + y ^ 2 ≤ 1}, {{x, -1, -1 / 2}, {y, -1, -1 / 2}}, StepMonitor :> Sow[{x, y}], Method -> "DifferentialEvolution"]];ContourPlot[(x - 1) ^ 2 + 100(y - x ^ 2) ^ 2, {x, -1, 1}, {y, -1, 1}, Contours -> Function[{lo, hi}, Exp[Range[0.01, Log[hi], (Log[hi] - 0.01) / 10]]], RegionFunction -> Function[{x, y, z}, x ^ 2 + y ^ 2 ≤ 1], Epilog -> {Green, Line[steps], Red, Point[steps]}]cdf = CDF[NormalDistribution[0, 1], x]CDF[NormalDistribution[0, 1], y]ContourPlot[cdf, {x, -2, 2}, {y, -2, 2}, Contours -> Function[{min, max}, Rescale[{0.1, 0.9}, {0, 1}, {min, max}]], PlotRange -> All]位置
における点電荷の集合
から構築された静電ポテンシャル:
ElectroStaticPotential[q_, p_, r_] := Sum[ (q[[i]]/Norm[r - p[[i]]]), {i, Length[q]}]ElectroStaticPotential[{Subscript[q, 1], Subscript[q, 2]}, {{Subscript[x, 1], Subscript[y, 1]}, {Subscript[x, 2], Subscript[y, 2]}}, {x, y}]//TraditionalFormc = Join[Table[Lighter[Green, i / 4], {i, 0, 3}], Table[Lighter[Orange, i / 4], {i, 3, 0, -1}]];ContourPlot[Evaluate[ElectroStaticPotential[{-1, 1}, {{-1, 0}, {1, 0}}, {x, y}]], {x, -4, 4}, {y, -4, 4}, Contours -> {-0.75, -0.25, -0.1, 0, 0.1, 0.25, 0.75}, PlotRange -> {{-4, 4}, {-4, 4}, {-1, 1}}, ClippingStyle -> Automatic, ContourShading -> c]ContourPlot[Evaluate[ElectroStaticPotential[{-1, -1, 2}, {{-1, -1}, {-1, 1}, {1, 0}}, {x, y}]], {x, -4, 4}, {y, -4, 4}, Contours -> {-0.75, -0.25, -0.1, 0, 0.1, 0.25, 0.75}, PlotRange -> {{-4, 4}, {-4, 4}, {-1, 1}}, ClippingStyle -> Automatic, ContourShading -> c ]特性と関係 (6)
ContourPlotは,必要な場合はより多くの点をサンプルとして取る:
ContourPlot[Sin[x y], {x, 0, 3}, {y, 0, 3}, Mesh -> All]データのプロットにListContourPlotを使う:
data = Table[Sin[x y], {x, 0, 3, .1}, {y, 0, 3, .1}];ListContourPlot[data]曲面と密度にPlot3DとDensityPlotを使う:
{Plot3D[Sin[x y], {x, -2, 2}, {y, -2, 2}],
DensityPlot[Sin[x y], {x, -2, 2}, {y, -2, 2}]}一変量関数にPlotを使う:
Plot[Sin[x] + Sin[Sqrt[2]x], {x, 0, 20}]ParametricPlotを平面のパラメトリック曲線と領域に使う:
{ParametricPlot[{Cos[θ], Sin[θ]}, {θ, 0, 2Pi}], ParametricPlot[{r Cos[θ], r Sin[θ]}, {θ, 0, 2Pi}, {r, 1 / 2, 1}]}陰関数の曲面と領域にContourPlot3DとRegionPlot3Dを使う:
{ContourPlot3D[Sin[x y] == z, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}],
RegionPlot3D[Sin[x y] ≥ z, {x, -2, 2}, {y, -2, 2}, {z, -2, 2}]}考えられる問題 (2)
ContourPlot[1 / x + 1 / y == 0, {x, -1, 1}, {y, -1, 1}]f[x_ ? NumberQ, y_ ? NumberQ] := Boole[x ^ 2 + y ^ 2 ≤ 1]ContourPlot[f[x, y] == 0, {x, -1, 1}, {y, -1, 1}]ContourPlot[f[x, y] == 0.5, {x, -1, 1}, {y, -1, 1}]おもしろい例題 (3)
ContourPlot[Evaluate[Re[Product[x + I y - (a + I b), {a, -2, 2}, {b, -2, 2}]]], {x, -3, 3}, {y, -3, 3}]Table[ContourPlot[Evaluate[Sum[Product[Norm[{x, y} - RandomReal[{-3, 3}, {2}]], {i, j}] / Product[Norm[{x, y} - RandomReal[{-3, 3}, {2}]], {i, j}], {j, 1, 5}]], {x, -5, 5}, {y, -5, 5}, Contours -> 50, ColorFunction -> (Hue[#]&), ClippingStyle -> Automatic, FrameTicks -> None], {3}]Table[ContourPlot[Re[f[x + I y]], {x, -Pi, Pi}, {y, -Pi, Pi}, PlotLabel -> f, FrameTicks -> {{-Pi, 0, Pi}, {-Pi, 0, Pi}}, ClippingStyle -> Automatic, ColorFunction -> "Pastel"], {f, {ArcSin, ArcCos, ArcCsc, ArcSec, ArcTan, ArcCot}}]テクニカルノート
履歴
1988 で導入 (1.0) | 2007 で更新 (6.0) ▪ 2008 (7.0) ▪ 2012 (9.0) ▪ 2014 (10.0) ▪ 2016 (11.0) ▪ 2017 (11.1) ▪ 2021 (13.0) ▪ 2025 (14.3)
テキスト
Wolfram Research (1988), ContourPlot, Wolfram言語関数, https://reference.wolfram.com/language/ref/ContourPlot.html (2025年に更新).
CMS
Wolfram Language. 1988. "ContourPlot." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2025. https://reference.wolfram.com/language/ref/ContourPlot.html.
APA
Wolfram Language. (1988). ContourPlot. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ContourPlot.html
BibTeX
@misc{reference.wolfram_2026_contourplot, author="Wolfram Research", title="{ContourPlot}", year="2025", howpublished="\url{https://reference.wolfram.com/language/ref/ContourPlot.html}", note=[Accessed: 16-October-2026]}
BibLaTeX
@online{reference.wolfram_2026_contourplot, organization={Wolfram Research}, title={ContourPlot}, year={2025}, url={https://reference.wolfram.com/language/ref/ContourPlot.html}, note=[Accessed: 16-October-2026]}