在饼图中重新定位 tikz-pins

在饼图中重新定位 tikz-pins

我只想知道是否有人知道如何重新定位 tikz-pin,使它们看起来像示例图片中的针脚,而无需创建额外的节点?这是我目前的代码:PS:如果不可能,有没有办法将针脚定位到更靠近饼图的位置,同时仍为文本留出额外的空间?(尤其是右半部分饼图?)

另外,有没有办法只将核能改为黑色文本,而不改变其他白色文本?还是我需要创建一个额外的节点?您真的可以改变饼图内部文本的位置吗?例如,我将左侧饼图中的 RE 重新定位到更靠近外缘的位置?提前致谢!

\documentclass{article}
\usepackage{pgf, tikz}
\usetikzlibrary{shapes,backgrounds,arrows}


\begin {document}
\scalebox{0.7} {
\begin{tikzpicture}
%portion of pie
\pie[/tikz/nodes={text=black, font=\scriptsize},
/tikz/every pin/.style={align=center, text=black, font=\scriptsize}, radius=5, rotate=-70, pos={6,0}, color={orange!50!white, blue!40!teal, cyan!80!white, cyan!30!white, red!80!black},before number=\phantom, after number=] %sum=39, blue!50!black
 {   0.5/\tikz [] {\draw[shorten <=0cm, thin, black] (0:-1) -- +(0:5mm) node [text=black, yshift=0.25cm, text width=1cm]{$0.01\%$ \\Geothermal};}, 
     8/\tikz [] {\draw[shorten <=0cm, thin, black] (0:-1) -- +(0:5mm) node [text=black,  yshift=0.25cm, text width=1cm]{$20\%$ \\Photovoltaik};}, 
     2.5/\tikz [] {\draw[shorten <=0cm, thin, black] (0:-1) -- +(0:5mm) node [text=black,  yshift=0.25cm, text width=1cm]{$7\%$ \\Hydropower};}, 
     20/\tikz [] {\draw[shorten <=0cm, thin, black] (0:-1) -- +(0:5mm) node [text=black,  yshift=-0.5cm, text width=1cm]{$52\%$ \\Wind energy};},
     8/\tikz [] {\draw[shorten <=0cm, thin, black] (0:-1) -- +(0:5mm) node [text=black, yshift=-0.5cm , text width=1.5cm]{$20\%$ \\Bio energy};}, 
  };
    

% %white pie for outer donut
\pie[radius=3.5, rotate=-70, pos={6,0}, white,
color={white},before number=\phantom, after number=,]
{39/}

%the pie
\pie[
/tikz/nodes={text=white, font=\scriptsize},
/tikz/every pin/.style={align=center, text=black, font=\tiny},
 radius=4, pos={0,0}, rotate=-80,color={cyan!45!white, blue!60!black, red!40!orange, orange!40!white,
orange!50!yellow,orange!70!white}, sum=auto, text=inside, before number=\phantom, after number=,]
{
    45 /RE \\45\%, 
    7.5/\tikz [] {\draw[shorten <=3cm, thin, black] (0:-1) -- +(90:35mm) node [text=black, yshift=0.2cm]{$7.5\%$ hard coal};},
    16.1/natural gas \\16.1\%, 
    11.3/nuclear energy \\ 11.3\%, 
    0.7/\tikz [] {\draw[shorten <=4cm, thin, black] (0:-1)--+(224:45mm) node [text=black, yshift=-0.4cm, text width=1.5cm]{$0.7\%$ \\mineral oil products};},
    16.2/lignite \\16.2\%
    }

\path (0,0) node (Kreis) [draw, thick, circle, fill=white, minimum width=2cm, minimum height=2cm] {};

\path (Kreis)+(0.19,4) node(P1);
% \path (Pie.north)+(0.15,3) node(P2) {o};
\path (7.7,4.7) node (P2) [] {o};
\draw [dashed, black!40, very thick] (P1.center)--(P2.center);

\path (0.7,-4) node (P3) [] {o};
\path (P2)+(0,-9.4) node(P4) {};
\draw [dashed, black!40, very thick] (P3.center)--(P4.center)

\end{tikzpicture}
}
\end {document}

到目前为止我的馅饼 示例饼图

相关内容