1

How do I put a title on the following pie chart? I tried using \stackon.

\documentclass[10pt]{amsart}
\usepackage{mathtools,systeme,array}

\usepackage{tikz}

\usepackage{adjustbox}
\usepackage{mathtools}

\usepackage{array}
\usepackage{makecell}
\usepackage{stackengine}\setstackEOL{\cr} %EOL is abbreviation for "end of line."


\begin{document}


%\setlength\extrarowheight{2pt}
%\stackon{%


\begin{tikzpicture}[every node/.style={align=center}, pin distance=5mm]

\coordinate (O) at (0,0);
\draw (O) circle (3);
\draw (O) -- (0:3);
\draw (O) -- (90:3);
\draw (O) -- (216:3);
\draw (O) -- (234:3);
\draw (O) -- (288:3);

\path (O) -- node{Food \\ 25\%} (45:3);
\path (O) -- node{Rent and \\ Utilities \\ 35\%} (153:3);
\path (O) -- node[pin=225:Clothing \\ 5\%] {} (225:5);
\path (O) -- node{Other \\ 5\%} (261:3);
\path (O) -- node{Car \\ 20\%} (324:3);
\end{tikzpicture}

%}{\bfseries\Longstack{David's Monthly Expenses}}


\end{document}
6
  • What does this have to do with tables? – user31729 May 27 '15 at 23:55
  • @Christian Hupfer Pie chart and tables are both convenient ways to organize data. Does the \stackon command only apply to tables? – user74973 May 28 '15 at 0:17
  • A pie chart is no table, so I am still wondering: Where's the table in your question? – user31729 May 28 '15 at 0:20
  • @Christian Hupfer No table. May you suggest what tag to put on it? – user74973 May 28 '15 at 0:22
  • I would remove the tables tag ;-) – user31729 May 28 '15 at 0:23
1

Normally pictures doesn't contain titles, this is task of figure captions, something like this:

text text text
    \begin{figure}
... picture ...
    \caption{David's Monthly Expenses}
    \label{fig:david-expences}
    \end{figure}
text text text

To add picture name on picture -- as I said in my comment, you need add a node with picture title:

\documentclass[tikz,border=2mm]{standalone}
\usetikzlibrary{angles,calc,positioning}

\begin{document}
    \begin{tikzpicture}[
every node/.style={align=center},
     pin distance=9mm
                    ]
    \coordinate (O) at (0,0);
\draw (O) circle (3);
\draw (O) -- (0:3);
\draw (O) -- (90:3);
\draw (O) -- (216:3);
\draw (O) -- (234:3);
\draw (O) -- (288:3);

\path (O) -- node{Food\\ 25\%} (45:3);
\path (O) -- node{Rent and\\ Utilities\\ 35\%} (153:3);
\path (O) -- node[pos=0.75,pin=225:Clothing\\ 5\%] {} (225:3);
\path (O) -- node{Other\\ 5\%} (261:3);
\path (O) -- node{Car\\ 20\%} (324:3);

\node[below=33mm of O] {\textbf{Title of picture}};%select one, which you more like
\node[right=33mm of O] {\textbf{Title of picture}};
    \end{tikzpicture}
\end{document}

enter image description here

Of course, bots solution has nothing with tables, except if you like to put picture in table (what wasn't state in question). For your pie chart I use my answer on one of your previous question.

9
  • If I want it directly above the pie chart, and centered, do I issue the command \node[above=33mm of O] {\textbf{Title of picture}};? (I guess 35mm is just as good as 33mm.) – user74973 May 28 '15 at 1:11
  • Of course. That is matter of your taste. I just show two possibilities and how to do this (if you persist to name the pictures on this way). – Zarko May 28 '15 at 1:17
  • I issue the command \path (O) -- node[align=left,pin=225:Clothing \\ 5\%] {} (225:5); and TikZ does not display what I expect. The direction of the pin is not 225 degrees; the direction looks to be about 200 degrees. Also, "5%" is not typed on the second line. It seems that "\\" just removes the space between "Clothing" and "5%" to give `Clothing5%'. – user74973 May 28 '15 at 12:24
  • What part of the command \path (O) -- node[pos=0.75,pin=225:Clothing\\ 5\%] {} (225:3); instructs TikZ to draw the pin from the above right corner of the node? – user74973 May 28 '15 at 12:45
  • Sorry, I do not understood your question. This line in my MWE hasn't such instruction. It just say: center of node lie on 75% of distance from O and (225:3), pin is directed in azimuth 225 degree`` for 9mm from node. Label is below this point (default features of pin). For other possibilities see question http://tex.stackexchange.com/questions/246995/tikz-adjusting-pin-anchor – Zarko May 28 '15 at 13:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.