# Change edge color of pgfplots patches

I am plotting patches and do not want them to be colored according to their z-values. Instead, I want to define the colors by myself.

Here is an example:

\addplot3[area legend,patch,forget plot,patch type=triangle,color=red,opacity=0.8]
table[row sep=crcr, point meta=\thisrow{c}] {%
x   y   z   c\\
0   0   0   0\\
0   0.3 0   0\\
0.3 0   0   0\\
};


I can override the color with color=red, but the edge color of the patches is still plotted in different Colors:

I can't find the appropriate parameter to change them to black. Has anyone an idea of how to do that?

Here is a full example:

\documentclass{article}

\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\pagestyle{empty}

\begin{document}

\begin{figure}[htb]
\centering
\begin{tikzpicture}
\begin{axis}[%
width=0.5\linewidth,
height=0.5\linewidth,
view={-213.5}{18},
scale only axis,
xmin=0,
xmax=1,
ymin=0,
ymax=1,
zmin=0,
zmax=1,
axis x line*=bottom,
axis y line*=left,
axis z line*=left]

table[row sep=crcr, point meta=\thisrow{c}] {%
x     y   z   c\\
0     0   0   0\\
0     0.3 1   0\\
0.3   0   0.5 0\\};
\end{axis}
\end{tikzpicture}%
\end{figure}

\end{document}

• Will 'draw=<desired colour>' help? I cannot test this since you didn't provide MWE. Sep 1, 2014 at 18:17
• Sorry, I added a full example. Draw does not help. Sep 2, 2014 at 6:43

You can change the color of the edge lines by setting faceted color=<color>, or disable them completely by setting faceted color=none.

\documentclass{article}

\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\pagestyle{empty}

\begin{document}

\begin{tikzpicture}
\begin{axis}[%
view={-213.5}{18},
xmin=0,
xmax=1,
ymin=0,
ymax=1,
zmin=0,
zmax=1
]

patch,
patch type=triangle,
color=red!25,
faceted color=black
]
table[row sep=crcr, point meta=\thisrow{c}] {%
x     y   z   c\\
0     0   0   0\\
0     0.3 1   0\\
0.3   0   0.5 0\\};
\end{axis}
\end{tikzpicture}%
\end{document}


I found out that the color can be specified with the c argument of the table. As changing the values for every triangle is quite tedious, a simple (but not very elegant) solution is to modify the underlying color map of the axis:

colormap={mymap}{rgb=(0,0,0); rgb=(0,0,0)}


Now every edge is drawn in black.

• I see you've unaccepted my answer and accepted yours instead. Could you explain why you prefer this solution over the faceted color approach?
– Jake
Sep 8, 2014 at 18:02