1

How can I draw a cone and color it except its basis (circle). Then drawing an arrow from the colored part and adding a comment?

  • Welcome! You could do \documentclass[tikz,border=3mm]{standalone} \begin{document} \begin{tikzpicture} \draw[left color=blue,right color=blue!70,middle color=blue!30] (170:2 and 0.4) arc(170:10:2 and 0.4) -- (0,3) -- cycle; \draw (170:2 and 0.4) arc(170:370:2 and 0.4); \draw[stealth-] (0.3,1.4) -- ++ (2,1) node[right]{text}; \end{tikzpicture} \end{document} –  Nov 11 '19 at 18:33
  • Thank you so much. In the {text} it seems that I am not able to break my text using \. Do you have any idea how can I do this? – olgaolgano Nov 11 '19 at 19:53
  • You need to specify some alignment in order to enable line breaks, e.g. \documentclass[tikz,border=3mm]{standalone} \begin{document} \begin{tikzpicture} \draw[left color=blue,right color=blue!70,middle color=blue!30] (170:2 and 0.4) arc(170:10:2 and 0.4) -- (0,3) -- cycle; \draw (170:2 and 0.4) arc(170:370:2 and 0.4); \draw[stealth-] (0.3,1.4) -- ++ (2,1) node[right,align=left]{some\\text}; \end{tikzpicture} \end{document} –  Nov 11 '19 at 19:54

1 Answers1

1

This is an attempt to create a somewhat realistic shading for the cone.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{fadings}
\tikzfading[name=fade cone,
left color=transparent!100,
right color=transparent!100,
middle color=transparent!30,shading angle=100]
\begin{document}
\begin{tikzpicture}[upper cone/.style={insert path={
    (174:2 and 0.4) arc(174:6:2 and 0.4) -- (0,3) -- cycle}}]
 \draw[fill=blue,upper cone];
 \begin{scope}
  \clip[upper cone];
  \fill[white,path fading=fade cone] (-2,-0.4) rectangle (2.7,3);
 \end{scope}
 \draw (174:2 and 0.4) arc(174:366:2 and 0.4);
 \draw[stealth-] (0.3,1.4) -- ++ (2,1) node[right,align=left]{some\\text};
\end{tikzpicture}
\end{document}

enter image description here

One could make it more interesting by shading the inner side as well, and more versatile by dropping some of the hard coded values in favor of computed quantities.

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{fadings,calc}
\tikzfading[name=fade cone,
left color=transparent!100,
right color=transparent!100,
middle color=transparent!30,shading angle=100]
\tikzfading[name=inner cone,
left color=transparent!30,
right color=transparent!30,
middle color=transparent!100,shading angle=80]
\begin{document}
\begin{tikzpicture}[upper cone/.style={insert path={
    (174:2 and 0.4) arc(174:6:2 and 0.4) -- (0,3) -- cycle}}]
 \draw[fill=blue,upper cone];
 \begin{scope}[local bounding box=fore]
  \clip[upper cone];
  \fill[white,path fading=fade cone] 
   let \p1=($(fore.north east)-(fore.south west)$),
   \n1={-\x1*cos(100)/2},\n2={max(\x1,\y1)} in
  (fore.south west) rectangle ++ (\n2+\n1,\n2);
 \end{scope}
 \draw[fill=blue] circle[x radius=2cm,y radius=0.4cm];
 \begin{scope}[local bounding box=back]
  \clip circle[x radius=2cm,y radius=0.4cm];
  \fill[black,path fading=inner cone] 
   let \p1=($(back.north east)-(back.south west)$),
   \n1={-\x1*cos(100)/2},\n2={max(\x1,\y1)} in
  (back.north east) rectangle ++ (-\n2-\n1,-\n2);
 \end{scope}
 \draw[stealth-] (0.3,1.4) -- ++ (2,1) node[right,align=left]{some\\text};
\end{tikzpicture}
\end{document}

enter image description here

Of course, this is not really realistic.