\begin{tikzpicture}
\node at (1,2) {Β};
\node at (-5,2) {Α};
\draw [thick] (0,0) ellipse [x radius=1cm, y radius=2cm] node [below = 2.3cm] {Σύνολο Άφιξης};;
\draw [thick] (-4,0) ellipse [x radius=1cm, y radius=2cm] node [below = 2.3cm] {Πεδίο Ορισμού};
\node[circle,inner sep=1.5pt,fill=black] (p1) at (-3.9,1) {};
\node[circle,inner sep=1.5pt,fill=black] (p2) at (-3.5,-0.3) {};
\node[circle,inner sep=1.5pt,fill=black] (p3) at (-4,-1.2) {};
\node[circle,inner sep=1.5pt,fill=black] (p4) at (-4.4,0.2) {};
\node[circle,inner sep=1.5pt,fill=black] (a1) at (0.3,1) {};
\node[circle,inner sep=1.5pt,fill=black] (a2) at (0.5,0) {};
\node[circle,inner sep=1.5pt,fill=black] (a3) at (-0.2,-1.2) {};
\node[circle,inner sep=1.5pt,fill=black] (a4) at (-0.4,-0.3) {};
\node[circle,inner sep=1.5pt,fill=black] (a5) at (-0.4,0.8) {};
\node[circle,inner sep=1.5pt,fill=black] (a6) at (0.3,-0.8) {};
\draw [thick, ->, out=135] (p1) -- (a1);
\draw [thick, ->, bend right = 90] (p3) -- (a5);
\end{tikzpicture}
答案1
正如@Henri Menke 所说,弯曲必须在形式坐标之间,例如:
\draw[<arrows options>] (a) to [bending left] (b);
其中a
和b
分别是箭头的起始和终止坐标。下面的 MWE 中就用到了这种方式。
另一种方式是使用可以在选项或和中edge
定义的样式,例如:tikzpicture
\tikzset{...}
\path (a) edge [bend left] (b)
(c) edge [bend right] (c);
其中边缘样式定义如下:
every edge/.stale = {draw, ->, semithick}
考虑第一个选项并定义点的通用样式,图像代码要短得多:
\documentclass[margin=3mm]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[
dot/.style = {circle, fill, inner sep=1.5pt}
]
\node at (1,2) {Β};
\node at (-5,2) {Α};
% elipses
\draw [thick] (0,0) ellipse [x radius=1cm, y radius=2cm] node [below = 2.3cm] {Σύνολο Άφιξης};;
\draw [thick] (-4,0) ellipse [x radius=1cm, y radius=2cm] node [below = 2.3cm] {Πεδίο Ορισμού};
% dots
\begin{scope}[nodes=dot]
\node (p1) at (-3.9,1) {};
\node (p2) at (-3.5,-0.3) {};
\node (p3) at (-4,-1.2) {};
\node (p4) at (-4.4,0.2) {};
\node (a1) at (0.3,1) {};
\node (a2) at (0.5,0) {};
\node (a3) at (-0.2,-1.2) {};
\node (a4) at (-0.4,-0.3) {};
\node (a5) at (-0.4,0.8) {};
\node (a6) at (0.3,-0.8) {};
\end{scope}
% arrows
\draw [thick, ->] (p1) to [bend left] (a1);
\draw [thick, ->] (p3) to [bend right] (a5);
\end{tikzpicture}
\end{document}
答案2
首先,你的代码不是最小工作示例,特别是,它不兼容(由于缺少某些语言包。帮助者不想关心你的语言。你应该在寻求帮助时摆脱它)。我确实从你的代码中删除了一些俄语字符,还重新输入了烦人的字符A
和B
。
第二,bend left
,bend right
,out=
,in =
等配合to
操作(见第 74.3 节 曲线在手册)所以你可以用替换--
,to
即替换
\draw [thick, ->, bend right = 90] (p3) -- (a5);
经过
\draw [thick, ->, bend right = 90] (p3) to (a5);
使其按预期工作。
第三,我使用样式dot
、循环\foreach
和scope
;还有+
操作(旧但更简短的语法)来清理你的代码ellipse
;名称a\i
,b\i
。一小段代码中的几件小事^^
\documentclass[tikz,border=5mm]{standalone}
\begin{document}
\begin{tikzpicture}[dot/.style={circle,inner sep=1.5pt,fill}]
\draw[thick]
(0,0) ellipse(1 and 2) +(1.2,2) node (B) {$B$}
(-4,0) ellipse(1 and 2) +(-1.2,2) node (A) {$A$};
\foreach \point [count =\i from 1] in {(-3.9,1), (-3.5,-0.3), (-4,-1.2), (-4.4,0.2)}
\node[dot] (a\i) at \point {};
\foreach \point [count =\i from 1] in {(0.3,1), (0.5,0), (-0.2,-1.2), (-0.4,-0.3), (-0.4,0.8), (0.3,-0.8)}
\node[dot] (b\i) at \point {};
\begin{scope}[-stealth,magenta]
\draw (a1) -- (b1);
\draw[bend right = 30] (a3) to (b4);
\draw[bend left] (a2) to (b2);
\end{scope}
\end{tikzpicture}
\end{document}