1

What is the best strategy to recreate this figure in tikz? I would like to add some color gradient to the red "triangular" region (darker at the bottom and lighter on top). Also, the larger side of that region should be slightly curved, as is shown in the picture. enter image description here

1
  • 1
    I'd use tikz-3dplot along with the 3d library. The shading is easy, top color=white,bottom color=red or something like this.
    – user121799
    Commented Jan 28, 2019 at 16:45

1 Answer 1

5

While some may be able to uniquely determine the 3d coordinates from such a screen shot, I cannot, so I had to guess. Given some 3d coordinates, it is straightforward to draw things using tikz-3dplot. The color gradient can be achieved with basic shading syntax.

\documentclass[tikz,border=3.14mm]{standalone}
\usepackage{tikz-3dplot}
\usetikzlibrary{3d,angles,quotes}
\definecolor{prbright}{RGB}{222,233,233}
\definecolor{prtop}{RGB}{192,217,221}
\definecolor{prdark}{RGB}{170,197,194}
\definecolor{prleft}{RGB}{178,200,202}
\begin{document}
\tdplotsetmaincoords{110}{-12}
\begin{tikzpicture}[tdplot_main_coords,line join=miter]
  \pgfmathsetmacro{\h}{8}
  \pgfmathsetmacro{\w}{8}
  \begin{scope}[shift={(-0.6*\w,0,0.2*\h)}]
   \draw[-latex] (0,0,0) -- (1,0,0) node[pos=1.1]{$x$};
   \draw[-latex] (0,0,0) -- (0,1,0) node[pos=1.1]{$y$};
   \draw[-latex] (0,0,0) -- (0,0,1) node[pos=1.1]{$z$};
  \end{scope} 
  \draw[fill=prbright] (0,-\w/2,-\h) coordinate (btip) -- (-\w/2,-\w/2,0) coordinate (bl) 
  --  (\w/2,-\w/2,0) coordinate (br) --  cycle;
  \draw[fill=prleft]  (btip) -- (0,\w/2,-\h) coordinate (ftip) 
  -- (-\w/2,\w/2,0) coordinate (fl) -- (bl) -- cycle;
  \draw[fill=prdark]  (btip) -- (ftip) 
  -- (\w/2,\w/2,0) coordinate (fr) -- (br) -- cycle;
  \draw[fill=prtop]  (bl) -- (fl) --  (fr) -- (br) -- cycle;
  \draw[thick,dashed] (0,4,-5) coordinate(A) -- (0,4,7);
  \draw[line width=2mm,-latex,red] (-2,6,-2) coordinate(C) -- (0,4,0) coordinate
  (B)  pic [draw,-,line width=0.6pt,red,angle radius=1cm,"$\alpha$",angle
  eccentricity=1.2] 
  {angle = C--B--A};
  \begin{scope}[canvas is xz plane at y=4,transform shape]
   \draw[red,thick,latex-] (3,1) node[black,above right]{$k_x$} -| (0,6);
   \draw[red,thick,top color=white,bottom color=red!80,middle color=red!20] 
    (2,1) -| (0,5) to[out=-90,in=135] cycle;
  \end{scope}
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .