图例位置朝南的饼图

图例位置朝南的饼图

我尝试了这个问题中南方代码的图例(见下面的代码):带合并图例位置的饼图

但不幸的是它不起作用。

如果我将 yshift 改为固定值,它就会起作用。但只有当我在 overleaf 中编译它时才会起作用 - 如果我使用 textstudio 编译它则不会。

有人能告诉我 overleaf 和我本地的 latex 发行版相比有什么问题吗?

\documentclass[border=5pt, tikz]{standalone}
\usepackage{pgf-pie}

\begin{document}
\tikzset{
legend to the south/.code={
\coordinate[xshift=-1.5cm,
yshift=(\value{pgfpie@sliceLength}*0.5+1)*0.5cm-4em] (legendpos) at
(current bounding box.south);},
}

\begin{tikzpicture}[
every path/.style={draw=white, very thick}
]
\pie[square, 
scale font,
color = {blue!10, blue!20, blue!40}, 
sum=auto, text=legend, 
after number = {\%}, 
style={legend to the south}
]{58/Unidentifiable ML,25/MOP only,11/SMO only,6/MOP \& SMP} 
\end {tikzpicture}
\end{document}

答案1

解决方案来自带合并图例位置的饼图早于 pgf-pie v0.4,其中他们将定义从 .cls 移至 .tex。

我所做的就是下载pgf-pie v0.3 .cls 文件作为 pgf-pie3.cls 并将其导入本地。然后我对xshift和使用了固定位置yshift

    \tikzset{
    legend to the south/.code={{
    \coordinate[xshift=-1.5cm, yshift=2mm] (legendpos) at
    (current bounding box.south);}},
    }

相关内容