Problem producing a pie chart

4,294

You have two beamer syntax errors, so this isn't really related to the pie-charts at all:

  • \begin{columns}[2]: there is no optional argument 2 for columns, you don't have to specify the number of columns, if that is what you wanted. Just remove [2].

  • \begin{column}[0.4\textwidth]: the width of a column is a mandatory argument, and has to placed in braces, not brackets. Hence, write \begin{column}{0.4\textwidth} instead.

Note that beamers columns are not related to the multicol package, they are defined by the document class itself, so you don't actually need that package for this example.


If you want to use pgf-pie you have to download pgf-pie.sty from https://code.google.com/p/pgf-pie/ and make it available for use. The quickest way is to place it in the same folder as your .tex file.

Share:
4,294

Related videos on Youtube

Vaibhav
Author by

Vaibhav

Updated on August 01, 2022

Comments

  • Vaibhav
    Vaibhav over 1 year

    I tried producing a pie chart with pgf-pie (which seemed easy to me), but it was not available on my system and on MiKTex. So I tried this unsuccessfully. Kindly help.

    \documentclass{beamer}
    \usepackage{multicol}
    \usepackage{datapie}
    \usetheme{Warsaw}
    \begin{filecontents}{institutes.csv}
    Name,Quantity
    "ERD", 50
    "NERD",50
    \end{filecontents}
    \begin{filecontents}{population.csv}
    Name,Quantity
    "ERD", 30
    "NERD", 70
    \end{filecontents}
    
    \DTLloaddb{institute}{institutes.csv}
    \DTLloaddb{population}{population.csv}
    
    \begin{document}
    \begin{frame}{Are all the gastroesophageal reflux disease patients same? }
    \begin{exampleblock}
    {All patients present with  heart burn \texttt{and/or} regurgitation of sour fluid in mouth }So all these patients are same with varying severity of symptoms?
    \end{exampleblock}
    \begin{itemize}
    \item upper gastro-intestinal endoscopy 
    \item 24 hour Ph-metry 
    \end{itemize}
    \end{frame}
    
    %-------------------------------------------------------------------------------------------------------------------------
    \begin{frame}{Endoscopy Data}
    \begin{columns}[2]
    \begin{column}[0.4\textwidth]
    \begin{figure}[htbp]
    \DTLpiechart{variable=\quantity,outerlabel=\name}{institute}{%
    \name=Name,\quantity=Quantity}
    \caption{A pie chart} 
    \end{figure}
    \end{column}
    \begin{column}[0.4\textwidth]
    \begin{figure}[htbp]
    \DTLpiechart{variable=\quantity,outerlabel=\name}{population}{%
    \name=Name,\quantity=Quantity}
    \caption{A pie chart}
    \end{figure}
    \end{column}
    \end{columns}
    \end{frame}
    \end{document}
    
    • morbusg
      morbusg over 9 years
      Do you really need a pie chart to display a 50-50 distribution? Maybe you could just say that in a sentence instead? Just a thought.
  • Vaibhav
    Vaibhav over 9 years
    Thanks for the help. How can I rotate the pie chart so that the one with 50, 50 distribution is vertically divided and not horizontal
  • Torbjørn T.
    Torbjørn T. over 9 years
    @user34083 No idea, I'd ask a new question about that.