你能帮我画两个圆圈并用一条线(中间的箭头)连接它们吗?
哦-->--哦
抱歉,我无法发布图片。
编辑* 太感谢了。
你能再帮我一下吗?这是我的代码。我需要在点状圆圈之间画出中间箭头线。
谢谢
\begin{tikzpicture}
\draw [dotted] (0,1) -- (0,10);
\draw [dotted] (1.5,1.3) -- (1.5,10);
\draw [dotted] (3.0,1.3) -- (3.0,10);
\draw [dotted] (4.5,1.3) -- (4.5,10);
\draw [dotted] (6.0,1.3) -- (6.0,10);
\draw [dotted] (7.5,1.3) -- (7.5,10);
% Lower Row
\filldraw[pattern=dots] (7.5,1) circle (0.2) ;
\filldraw[pattern=dots] (6.0,1) circle (0.2);
\filldraw[pattern=dots] (4.5,1) circle (0.2);
\draw (3.0,1) circle (0.2);
\end{tikzpicture}
答案1
这是对您发布的代码的修改,其中添加了箭头。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{patterns,calc}
\begin{document}
\begin{tikzpicture}
\draw [dotted] (0,1) -- (0,10);
\draw [dotted] (1.5,1.3) -- (1.5,10);
\draw [dotted] (3.0,1.3) -- (3.0,10);
\draw [dotted] (4.5,1.3) -- (4.5,10);
\draw [dotted] (6.0,1.3) -- (6.0,10);
\draw [dotted] (7.5,1.3) -- (7.5,10);
% Lower Row
\draw[pattern=dots] (7.5,1) node[circle,minimum size=0.4cm,draw,fill] (A) {};
\draw[pattern=dots] (6.0,1) node[circle,minimum size=0.4cm,draw,fill] (B) {};
\draw[pattern=dots] (4.5,1) node[circle,minimum size=0.4cm,draw,fill] (C) {};
\draw (3.0,1) circle (0.2);
% Arrows
\draw[->] (B.east) -- ($(B.east)!0.5!(A.west)$);
\draw ($(B.east)!0.5!(A.west)$) -- (A.west);
\draw[->] (C.east) -- ($(C.east)!0.5!(B.west)$);
\draw ($(C.east)!0.5!(B.west)$) -- (B.west);
\end{tikzpicture}
\end{document}
主要的变化是将圆圈变成带标签的节点。然后我们可以参考锚点位置,例如A.west
用于连接线条的位置。
答案2
像这样吗?
\input tikz
\usetikzlibrary{decorations.markings}
\tikzset{circ/.style={circle, draw, fill=white},
conn/.style={postaction=decorate, decoration={
markings, mark=at position .55 with {\arrow{stealth}}}}}
\tikz\draw[conn] (0,0) node[circ]{} -- +(1,0) node[circ]{};
\bye