如何在两个节点之间绘制多个箭头?目前我只能在两个节点之间绘制一个。如何绘制弯曲的箭头?如何正确对齐它们?我想画这样的东西:
答案1
解释:
1)节点以一条路径放置,每个节点之间我放置一个选项来修改坐标系[xshift=7cm]
2)为了得到直箭头,想法是在(a)和(b)之间画第一个箭头
\draw (a.east) -- (b.west); % styles are defined in the scope environment
然后要得到最后的箭,只需移动第一个箭即可。这可以通过相同的魔法动作来实现:[yshift=\i * 0.8 cm]
\i 在每次循环中增加一并yshift
修改坐标系。
3)添加一些弯曲的箭头,你可以使用to[out=...,in=...]
或类似的东西[bend]
(参见手册以获得一些补充)
\documentclass[landscape]{scrartcl}
\usepackage{tikz}
\usetikzlibrary{arrows}
\begin{document}
\begin{tikzpicture}[thick]
\path [every node/.style={draw,minimum width=3cm, minimum height=5cm]}]
node (a) at (0,0) {}
[xshift=7cm]
node (b) at (0,0) {}
[xshift=7cm]
node (c) at (0,0) {};
\begin{scope}[->,>=latex]
\foreach \i in {-2,...,2}{%
\draw[->] ([yshift=\i * 0.8 cm]a.east) -- ([yshift=\i * 0.8 cm]b.west) ;}
\foreach \i in {1,2}{%
\draw[->] ([yshift=\i * 0.8 cm]a.east) to [out=50,in=130] ([yshift=\i * 0.8 cm]c.west) ;}
\foreach \i in {-1,-2}{%
\draw[->] ([yshift=\i * 0.8 cm]a.east) to [out=-50,in=-130] ([yshift=\i * 0.8 cm]c.west) ;}
\end{scope}
\end{tikzpicture}
\end{document}
答案2
你好像忘了添加图片。这是你想要的吗?
\documentclass{article}
\usepackage{tikz}
%
\begin{document}
\begin{tikzpicture}
\node (a) at (0,0) {A};
\node (b) at (4,0) {B};
\draw[-latex] (a) -- (b);
\draw[-latex,bend right] (a) edge (b);
\draw[-latex,bend left] (a) edge (b);
\end{tikzpicture}
\end{document}
答案3
阅读精美手册;)
\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows,calc}
\begin{document}
\begin{tikzpicture}
% two boxes
\node[draw,minimum width=3cm, minimum height=3cm] (a) at (0,0) {A};
\node[draw,minimum width=3cm, minimum height=3cm] (b) at (5,0) {B};
% normal line
\draw[-latex] (a) -- (b);
% compute a point in the middle between E and NE or W and NW, then draw a line between these two
\path (a.east) -- (a.north east) coordinate[pos=0.5] (a1);
\path (b.west) -- (b.north west) coordinate[pos=0.5] (b1);
\draw[latex-] (a1) -- (b1);
% use 'to' operation with different looseness and 'calc' library for computing starting points
\draw[red,looseness=3] ($(a.south)-(0.1,0)$) to[out=270,in=270] ($(b.south)+(0.1,0)$);
\draw[blue,looseness=0.3] ($(a.south)+(0.1,0)$) to[out=270,in=270] ($(b.south)-(0.1,0)$);
\draw[green,looseness=1] (a.south) to[out=270,in=270] (b.south);
% use 'bend left' and 'bend right' for bent arrows
\draw[bend right=20,red,-latex] (a.north east) to (b.north west);
\draw[bend left=45,blue,latex-] (a.north east) to (b.north west);
\end{tikzpicture}
\end{document}
答案4
问:如何在两个节点之间绘制多个箭头?
A:您可以按照如下方式绘制。
\documentclass{standalone}
\usepackage{tikz}
%
\begin{document}
%
\begin{tikzpicture}
\coordinate (A) at (0,0);
\coordinate (B) at (2,0);
\coordinate (C) at (4,0);
\coordinate (D) at (6,0);
\draw [-latex] (A) -- (B);
\draw [-latex] (A) to [bend left] (C);
\draw [-latex] (A) to [bend left=60] (D);
\end{tikzpicture}
%
\end{document}