我想绘制一条曲线并定义相对于我使用过的先前节点的坐标(而不是绝对坐标,绝对坐标可以正常工作)。这是我目前所做的,但它给出了以下错误:
程序包 PGF 数学错误:未知函数“r1”(在“r1.west”中)
为什么我不能在这里使用节点的名称?更重要的是,我该如何解决这个问题?我添加了一张我想要实现的图片,以防我的描述不清楚
到目前为止的代码(最后一行有错误):
\documentclass[crop,tikz]{standalone}
\usetikzlibrary{plotmarks,shapes,shapes.symbols,arrows,chains,positioning,decorations.pathreplacing}
\begin{document}
% Start the picture
\begin{tikzpicture}%
[%
>=stealth', %Define standard arrow tip
start chain=going below, % General flow is top-to-bottom
node distance=1cm and 1cm, % Global setup of box spacing
every join/.style={-, draw}, % Default linetype for connecting boxes
]
\tikzset{
reservoir/.style={draw, rectangle,on chain, on grid, align=center, minimum height=4ex},
% coord node style is used for placing corners of connecting lines
coord/.style={coordinate, on chain, on grid},
}
\tikzstyle{myarrows}=[line width=1mm,draw,-triangle 45,postaction={draw, line width=3mm, shorten >=4mm, -}]
% Start by placing the nodes
\node [reservoir,rotate=45, text width=2.5cm] (r1) {1};
\node [reservoir,rotate=20, text width= 1cm,right=0.5cm of r1.east] (r2) {2};
\draw [decorate,decoration={brace,amplitude=12pt}]([xshift=0.2cm,yshift=-0.2cm]r2.east)--([xshift=0.2cm,yshift=-0.2cm]r1.west);
\node [reservoir,rotate=-30, text width= 2cm,right=0.5cm of r2.east] (r3) {3};
\node [reservoir,rotate=15, text width= 3.5cm,right=0.5cm of r3.east] (r4) {4};
\draw [decorate,decoration={brace,amplitude=12pt}]([yshift=-1.3cm]r4.east)--([yshift=-1.3cm]r3.west) node [midway, anchor=north,yshift=-1cm]{Rainfall-runoff link 2};
% add connection lines
\draw (r1.east) -- (r2.west);
\draw (r2.east) -- (r3.west);
\draw (r3.east) -- (r4.west);
% add river curved line
\node [coord, above=1cm of r1.west] (b1) {};
\node [coord, above=1cm of r3.west] (b2) {};
\node [coord, above=1cm of r4.west] (b3) {};
\node [coord, above=1cm of r4.east] (b4) {};
\draw ([yshift=1cm]r1.west,[yshift=1cm]r1.west) .. controls ([yshift=1cm]r3.west,[yshift=1cm]r3.west) and ([yshift=1cm]r4.west,[yshift=1cm]r4.west) .. ([yshift=1cm]r4.east,[yshift=1cm]r4.east);
\end{tikzpicture}
\end{document}