I would like to draw a shaded triangle by defining the 3 vertices and an RGB color at each of those vertices. The interior shaded color would vary linearly from one vertex to the other.
Here is what I have so far but the shading is not what I am needing.
\documentclass[tikz]{standalone}
\usetikzlibrary{calc,intersections}
\begin{document}
\begin{tikzpicture}
% Specify the coordinates
\coordinate (A1) at (0,0);
\coordinate (A2) at (5,2);
\coordinate (A3) at (10,-3);
\definecolor{c1}{RGB}{0,129,188}
\definecolor{c2}{RGB}{252,177,49}
\definecolor{c3}{RGB}{35,34,35}
% Draw the sides of the triangle
\draw (A1) -- (A2) -- (A3) -- cycle;
\shade [left color=c1,right color=c2] (A1) -- (A2) -- (A3) -- cycle;
\end{tikzpicture}
\end{document}
While this question is similar: Tikz triangle with point colours
The answers are limited in the following ways
- Several of the solutions are artistic approximations and not precise shading between the vertices.
- The solutions are presented for an equilateral triangle and not a general triangle.
- The solution method using pgfplots works the best but won't display in ShareLatex and is having difficulty printing so is limited.