グラフィックスプリミティブのオプションで,頂点に割り当てる色を指定する.
VertexColors
グラフィックスプリミティブのオプションで,頂点に割り当てる色を指定する.
詳細
- VertexColorsはPolygon,Line,Tube,Point,GraphicsComplexに使うことができる.
- VertexColors->{col1,col2,…}は,色 coliを頂点 i に割り当てるように指定する.
- 多角形の内部はVertexColorsで指定された色を補間して彩色される.
- 3Dでは,VertexColorsの設定値に,擬似光源とともに使うための任意の曲面や材料の属性を含むことができる.
- それぞれの頂点に対する色 coliは,GrayLevel[g]やRGBColor[r,g,b]のように明示的な色指示子でもよく,以下の形式でもよい.
-
g GrayLevel[g] {g,a} GrayLevel[g,a] {r,g,b} RGBColor[r,g,b] {r,g,b,a} RGBColor[r,g,b,a]
例題
すべて開く すべて閉じる例 (3)
Graphics[Polygon[{{0, 0}, {0, 1}, {1, 1}, {1, 0}}, VertexColors -> {Blue, Green, Brown, Purple}]]Graphics3D[{Polygon[{{0, 0, 0}, {1, 1, 0}, {0, 1, 1}}, VertexColors -> {Blue, Yellow, Orange}]}]Graphics[{Thick, Line[{{0, 0}, {1, 1}, {2, 0}}, VertexColors -> {StandardRed, StandardYellow, StandardGreen}]}]スコープ (17)
グラフィックスオブジェクト (5)
Graphics[Polygon[{{-1, 0}, {1, 0}, {0, Sqrt[3]}}, VertexColors -> {Red, Green, Blue}]]Graphics[Polygon[{{{-1, 0}, {1, 0}, {0, Sqrt[3]}}, {{2, 0}, {4, 0}, {3, Sqrt[3]}}}, VertexColors -> {{Red, Green, Blue}, {Yellow, Cyan, Magenta}}]]Line:
Graphics[{Thick, Line[{{0, 0}, {2, 1}}, VertexColors -> {Red, Green}]}]Graphics[{Thick, Line[{{{0, 0}, {2, 1}}, {{1, 0}, {3, 1}}}, VertexColors -> {{Red, Green}, {Yellow, Blue}}]}]Graphics[{PointSize[0.1], Point[{{0, 0}, {1, 1}, {2, 2}}, VertexColors -> {StandardRed, StandardYellow, StandardBlue}]}]Graphics[{Triangle[{{0, 0}, {0, 1}, {1, 1}}, VertexColors -> {Red, Green, Blue}]}]Graphics[{Triangle[{{{0, 0}, {0, 1}, {1, 1}}, {{2, 0}, {2, 1}, {3, 1}}}, VertexColors -> {{Red, Green, Blue}, {Yellow, Cyan, Magenta}}]}]GraphicsComplexでは,色は共有頂点に割り当てられる:
Graphics[{GraphicsComplex[{{0, 0}, {1, 0}, {0, 1}, {1, 1}, {.5, .5}}, {Polygon[{1, 2, 5}], Polygon[{3, 4, 5}]}, VertexColors -> {LightRed, DarkRed, LightBlue, DarkBlue, Purple}]}]Graphics3Dのプリミティブと形状 (5)
Graphics3D[Polygon[{{0, -1, 0}, {0, 1, 0}, {-1, 0, 1}}, VertexColors -> {Red, Green, Blue}]]Graphics3D[Polygon[{{{0, -1, 0}, {0, 1, 0}, {-1, 0, 1}}, {{0, -1, 1}, {0, 1, 1}, {-1, 0, 2}}}, VertexColors -> {{Red, Green, Blue}, {Cyan, Magenta, Yellow}}]]Line:
Graphics3D[{Thick, Line[{{0, 0, 0}, {1, 1, 1}, {2, 2, 1}}, VertexColors -> {Red, Green, Yellow}]}]Graphics3D[{Thick, Line[{{{0, 0, 0}, {2, 1, 1}}, {{1, 0, 0}, {3, 1, 1}}}, VertexColors -> {{Red, Green}, {Blue, Yellow}}]}]Tube:
Graphics3D[{Tube[{{0, 0, 0}, {1, 1, 1}, {2, 2, 1}}, 0.1, VertexColors -> {Red, Green, Yellow}]}]Graphics3D[{Tube[{{{0, 0, 0}, {2, 1, 1}}, {{1, 0, 0}, {3, 1, 1}}}, .2, VertexColors -> {{Red, Green}, {Blue, Yellow}}]}]Graphics3D[{PointSize[0.1], Point[{{0, 0, 0}, {1, 1, 1}, {2, 1, 0}}, VertexColors -> {StandardRed, StandardGreen, StandardOrange}]}, PlotRangePadding -> .1]GraphicsComplexでは,色は共有頂点に割り当てられる:
v = {{0, 0, 0}, {2, 0, 0}, {2, 2, 0}, {0, 2, 0}, {1, 1, 2}};i = {{1, 2, 5}, {2, 3, 5}, {3, 4, 5}, {4, 1, 5}};Graphics3D[{GraphicsComplex[v, Polygon[i], VertexColors -> {Red, Green, Yellow, Blue, Opacity[.8, White]}]}]色指定 (5)
Graphics3D[Polygon[{{0, -1, 0}, {0, 1, 0}, {-1, 0, 1}}, VertexColors -> {RGBColor[0, 1, 0, .1], RGBColor[0, 1, 0, .4], RGBColor[0, 1, 0, .9]}]]Directiveを使って色とOpacityが組み合せられる:
Graphics3D[Polygon[{{0, -1, 0}, {0, 1, 0}, {-1, 0, 1}}, VertexColors -> {Red, Green, Directive[Blue, Opacity[.5]]}]]Graphics[Polygon[{{0, -1}, {0, 1}, {-1, 0}}, VertexColors -> {RGBColor[0, 1, 0], GrayLevel[.2], LABColor[.6, .5, 1]}]]LightDarkSwitched指定を使うことができる:
g = Graphics[{Thickness[.1], Line[{{0, 0}, {1, 1}}, VertexColors -> {LightDarkSwitched[LightRed, LightBlue], LightDarkSwitched[DarkRed, DarkBlue]}]}];
{Rasterize[g, LightDark -> "Light"], Rasterize[g, LightDark -> "Dark"]}生の数字リストを使ってRGBColorの代りに{red,green,blue}が指定できる:
Graphics[{Polygon[{{0, 0}, {0, 1}, {2, 0}}, VertexColors -> {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}]}]Graphics[{Polygon[{{0, 0}, {0, 1}, {2, 0}}, VertexColors -> {{1, 0, 0, .1}, {0, 1, 0.9}, {0, 0, 1, .5}}]}]グレーレベルの指定には{gray1,gray2,…}を使う:
Graphics[{Polygon[{{0, 0}, {0, 1}, {2, 0}}, VertexColors -> {.1, .9, .4}]}]不透明度があるグレーレベルは{gray,opacity}として指定する:
Graphics[{Polygon[{{0, 0}, {0, 1}, {2, 0}}, VertexColors -> {{.5, 0}, {.5, 1}, {.5, .5}}]}]可視化関数 (2)
ListPlot3D[{{0, 0, 1}, {1, 0, 0}, {0, 1, 0}}, VertexColors -> {Red, Green, Blue}, Lighting -> "Neutral"]ListDensityPlot[{{0, 0, 1}, {1, 0, 0}, {0, 1, 0}}, VertexColors -> {Red, Green, Blue}]考えられる問題 (2)
FilledCurveのセグメント内で指定された頂点の色は無視される:
Graphics[{EdgeForm[Thick], Pink, FilledCurve[Line[{{0, 0}, {1, 0}, {1, 1}, {0, 1}}, VertexColors -> {Red, Green, Blue, Yellow}]]}]短すぎるVertexColorsリストは,残りの点にデフォルトの色を使う:
Graphics[{Polygon[{{0, 0}, {1, 1}, {2, 0}}, VertexColors -> {StandardOrange, StandardBlue}]}]デフォルトのプリミティブの色が指示子で変更された場合は,変更された色が使われる:
Graphics[{StandardPurple, Polygon[{{0, 0}, {1, 1}, {2, 0}}, VertexColors -> {StandardOrange, StandardBlue}]}]おもしろい例題 (2)
PolyhedronData["GreatRhombicosidodecahedron"] /. Polygon[x_] :> Polygon[x, VertexColors -> Map[Opacity[If[EvenQ[#], 0, 1], White]&, x, {-1}]]ExampleDataの画像を使う:
pic = Reverse[ExampleData[{"TestImage", "Sailboat"}, "Data"] / 255.];テクスチャをシミュレーションして頂点に色が付いたデータをプロットする:
ListPlot3D[Table[x + Sin[x y], {x, -5, 5, .1}, {y, -5, 5, .1}], Mesh -> None, VertexColors -> {pic[[5 ;; -5 ;; 5, 5 ;; -5 ;; 5]]}, Lighting -> "Neutral"]関連項目
関連するガイド
-
▪
- 3Dグラフィックスオプション ▪
- 色 ▪
- 多角形 ▪
- 多面体
テキスト
Wolfram Research (2007), VertexColors, Wolfram言語関数, https://reference.wolfram.com/language/ref/VertexColors.html (2008年に更新).
CMS
Wolfram Language. 2007. "VertexColors." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2008. https://reference.wolfram.com/language/ref/VertexColors.html.
APA
Wolfram Language. (2007). VertexColors. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VertexColors.html
BibTeX
@misc{reference.wolfram_2026_vertexcolors, author="Wolfram Research", title="{VertexColors}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/VertexColors.html}", note=[Accessed: 01-December-2026]}
BibLaTeX
@online{reference.wolfram_2026_vertexcolors, organization={Wolfram Research}, title={VertexColors}, year={2008}, url={https://reference.wolfram.com/language/ref/VertexColors.html}, note=[Accessed: 01-December-2026]}