我在以下 tikzpicture 中遇到了一些问题。由于这是属于较大模型的代码示例,我无法在水平方向上扩展元素之间的距离(垂直扩展就可以了)。但是,您可以看到数字与线条重叠。您对如何解决我的问题有什么想法/建议吗?
\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{positioning, shapes,arrows}
%opening
\title{TikZ-Problem}
\author{Jens}
\begin{document}
\maketitle
\section{}
\begin{tikzpicture}[auto,>=latex,align=center,
latent/.style={circle,draw, thick,inner sep=0pt,minimum size=10mm},
manifest/.style={rectangle,draw, thick,inner sep=2pt,minimum size=10mm},
mean/.style={regular polygon,regular polygon sides=3,draw,thick,inner sep=0pt,minimum
size=10mm},
paths/.style={->, very thick, >=stealth'},
variance/.style={<->, thick, >=stealth', bend left=270, looseness=2},
arrow/.style={-latex, shorten >=1ex, shorten <=1ex, bend angle=45}
]
\node [latent] (LV1) at (0,0) {Factor};
\node [manifest] (WR) [below =of LV1] {Indic1};
\node [manifest] (SI) [left = 0.5cm of WR] {Indic2};
\node [manifest] (IN) [right =0.5cm of WR] {Indic2};
\node [latent] (EIN) [below =of IN] {Error};
\node [latent] (ESI) [below =of SI] {Error};
\node [latent] (EWR) [below =of WR] {Error};
\draw [paths,above] (LV1) to node {0.999} (IN);
\draw [paths,above] (LV1) to node [pos=.75] {0.999} (SI);
\draw [paths] (LV1) to node {0.999} (WR);
\foreach \e in {IN, SI, WR}
\draw [paths] (E\e) to node {1} (\e);
\foreach \x/\xlab in {EIN/0.111, ESI/0.111, EWR/0.111}
\draw [variance] (\x.south west) to node [swap] {\xlab} (\x.south east);
\end{tikzpicture}
\end{document}
答案1
你可以基本上确定并改变节点距离,然后摆弄节点
\node [latent] (LV1) at (0,0) {Factor};
\begin{scope}[node distance=1.5cm]
\node [manifest] (WR) [below =of LV1] {Indic1};
\node [manifest] (SI) [left = of WR] {Indic2};
\node [manifest] (IN) [right = of WR] {Indic2};
\end{scope}
\node [latent] (EIN) [below =of IN] {Error};
\node [latent] (ESI) [below =of SI] {Error};
\node [latent] (EWR) [below =of WR] {Error};
\draw [paths] (LV1) to node[midway,sloped,above] {0.999} (IN);
\draw [paths] (LV1) to node[midway,sloped,above] {0.999} (SI);
\draw [paths] (LV1) to node[midway,sloped,above] {0.999} (WR);