如何才能增加字体大小,同时保持圆圈大小不变?
\begin{figure}[!h]
\centering
\newcommand{\pieslice}[6][black!10]{ \pieslice[color]{total}{start angle}{end angle}{data value}{label}
\pgfmathparse{#3/#2*360}
\let\a\pgfmathresult
\pgfmathparse{#4/#2*360}
\let\b\pgfmathresult
\pgfmathparse{0.5*\a+0.5*\b}
\let\midangle\pgfmathresult
\draw[fill=#1] (0,0) -- (\a:1) arc (\a:\b:1) -- cycle;
\node[label=\midangle:{\tiny#6}] at (\midangle:1) {};
\pgfmathparse{min((\b-\a-10)/110*(-0.3),0)}
\let\temp\pgfmathresult
\pgfmathparse{max(\temp,-0.5) + 0.8}
\let\innerpos\pgfmathresult
\pgfmathparse{(\b-\a)/3.6} % convert slice size to percentage
\let\percentage\pgfmathresult
\node at (\midangle:\innerpos) {\tiny\pgfmathprintnumber[fixed,precision=1]{\percentage}\%};
}
\newcommand{\pie}[2][{{"black!10"}}]{
\pie[{colour palette array}]{{label/value array}}
\pgfmathparse{dim(#1)} % find N of array
\let\paletteDim\pgfmathresult
\newcounter{colourIndex}
\newcounter{total}
\foreach \val/\name in #2 {
\addtocounter{total}{\val}
}
\newcounter{a}
\newcounter{b}
\foreach \val/\name in #2 {
\setcounter{a}{\value{b}}
\addtocounter{b}{\val}
\pgfmathparse{#1[\thecolourIndex]}
\let\colour\pgfmathresult
\pieslice[\colour]{\thetotal}{\thea}{\theb}{\val}{\name}
\stepcounter{colourIndex}
\ifnum \thecolourIndex=\paletteDim \setcounter{colourIndex}{0}\fi
}
}
\def\palette{{"blue!60","cyan!50","yellow!50","orange!60","red!60",
"teal!50","brown!50!black!50","purple!50","lime!50!black!30"}}
\begin{tikzpicture}[scale=2.5]
\pie[\palette]{{ 4/Chemins de fer, 11/Marine, 11/Aviation, 34/Camions,40/Automobiles}}
\end{tikzpicture}
\label{f31}
\end{figure}
答案1
如果没有可编译的 MWE,很难回答您的问题,但据我所知,您可以在此行中自己定义字体大小:
\node at (\midangle:\innerpos) {\tiny\pgfmathprintnumber[fixed,precision=1]{\percentage}\%};
你试过\tiny
用其他东西代替吗?比如\normalsize
或\footnotesize
甚至\Large
等等?