妈妈:
\documentclass{article}
\usepackage{datapie}
\begin{filecontents}{test.csv}
Name,Quantity
"Apples",30
"Pears",25
"Lemons,Limes",40.5
"Peaches",34.5
"Cherries",20
\end{filecontents}
\DTLloaddb{fruit}{test.csv}
\begin{document}
\begin{figure}[htbp]
\centering
\DTLsetpiesegmentcolor{1}{blue}
\DTLsetpiesegmentcolor{2}{red}
\DTLsetpiesegmentcolor{3}{green}
\DTLsetpiesegmentcolor{4}{cyan}
\DTLsetpiesegmentcolor{5}{pink}
\DTLpiechart{variable=\quantity,outerlabel=\name}{fruit}{%
\name=Name,\quantity=Quantity}
\caption{A pie chart}
\end{figure}
\end{document}
答案1
这是由于舍入错误导致的,其中实数被截断为整数。该问题现已在 2.26 版中修复。
\documentclass{article}
\usepackage{datapie}[2016/07/20]
\begin{filecontents}{test.csv}
Name,Quantity
"Apples",30
"Pears",25
"Lemons,Limes",40.5
"Peaches",34.5
"Cherries",20
\end{filecontents}
\DTLloaddb{fruit}{test.csv}
\begin{document}
\begin{figure}[htbp]
\centering
\DTLsetpiesegmentcolor{1}{blue}
\DTLsetpiesegmentcolor{2}{red}
\DTLsetpiesegmentcolor{3}{green}
\DTLsetpiesegmentcolor{4}{cyan}
\DTLsetpiesegmentcolor{5}{pink}
\DTLpiechart{variable=\quantity,outerlabel=\name}{fruit}{%
\name=Name,\quantity=Quantity}
\caption{A pie chart}
\end{figure}
\end{document}