我在画树时遇到了一个非常奇怪的问题forest
。在每棵树的左下角,我都会看到这个虚假的、错误的点。
以下是一个例子:
\usepackage{pgfplots}
\pgfplotsset{width=12cm,compat=1.10}
\pgfmathdeclarefunction{gauss}{2}{%
\pgfmathparse{1/(#2*sqrt(2*pi))*exp(-((x-#1)^2)/(2*#2^2))}
}
\usetikzlibrary{patterns}
\usepackage{adjustbox}
\usepgfplotslibrary{fillbetween}
\usepackage{forest}
\usepackage{listings}
\usepackage{amssymb}
%\usepackage[utf8]{inputenc}
\usepackage{xcolor}
\tikzset{
decision/.style={rectangle, minimum height=10pt, minimum width=10pt, draw=black, fill=black!30!white, thick, inner sep=0pt},
chance/.style={circle, minimum width=10pt, draw=black, fill=black!30!white, thick, inner sep=0pt},
leaf-chance/.style={isosceles triangle, minimum width=10pt, draw=black, thick, fill=white, inner sep=0pt,
shape border rotate=180, outer sep=-\pgflinewidth}
}
\forestset{
declare toks={optimality}{},
declare toks={edge label below}{},
}
\begin{document}
\begin{center}
\begin{frame}
\scalebox{0.85}{
\begin{forest}
my label/.style={
edge label={node[auto, sloped,pos=.75,anchor=south]{#1}}
},
my below/.style={
edge label below={node[midway,below, pos = 0.75, font = \scriptsize,align = center]{#1}}
%edge label={node[auto, sloped,pos=1.75,anchor=south]{#1}}
},
for tree={
grow=0,
child anchor=west,
anchor=west,
text ragged,
inner sep=1mm,
edge={thick, draw=black},
l sep+=30mm,
s sep+=5mm,
if n children=0{
before typesetting nodes={
label/.wrap pgfmath arg={right:#1}{content()},
content={},
leaf-chance,
},
}{},
edge path={
\noexpand\path [draw, \forestoption{edge}] (!u.parent anchor) |- (.child anchor)\forestoption{edge label below}\forestoption{edge label};
},
}
[, decision, label = left: HIV in Liberia,
[,chance,my label=Treat all, label = right: 25.1
[25, my label = HIV$^-$, my below = 0.985, tier = word]
[30, my label = HIV$^+$, my below = 0.015, tier = word]
]
[,chance,my label=Test all, label = right: 34.8
[,chance, my label = HIV$^-$, my below = 0.985, label = above right: 34.9
[35, my label= Test$^-\rightarrow$ Don't treat, my below = 0.99, tier = word]
[25, my label = Test$^+\rightarrow$ Treat, my below = 0.01, tier = word]
]
[,chance, my label = HIV$^+$, my below = 0.015, label = above right: 28.6
[2, my label= Test$^-\rightarrow$ Don't treat, my below = 0.05, tier = word]
[30, my label = Test$^+\rightarrow$ Treat, my below = 0.95, tier = word]
]
]
]
\end{forest} }
\end{frame}
\end{center}
\end{document}
看到西南角的那个点了吗?我的文档中每棵树上都有这个点。我不知道如何去掉它。
谢谢你!