我想把这个节点放在椭圆上大约 35% 的位置
\node[draw, circle, inner sep = .08cm, scale = .75] (location) {2};
\documentclass{article}
\begin{document}
\usepackage{tikz}
\usetikzlibrary{arrows, decorations.markings, decorations.pathreplacing}
\begin{tikzpicture}
\begin{scope}[decoration = {markings, mark = at position 0.3 with {\arrow{>}},} ]
\clip (-5,0) rectangle (1,2.5);
\draw[postaction = decorate] (-2,0) ellipse (3cm and 2cm);
\end{scope}
\end{tikzpicture}
\end{document}
我怎样才能实现这个目标?
答案1
您可以使用markings
用于放置箭头的库来放置节点:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows, decorations.markings, decorations.pathreplacing}
\begin{document}
\begin{tikzpicture}
\begin{scope}[
decoration = {
markings,
mark = at position 0.3 with {\arrow{>}},
mark = at position 0.3 with {\node[draw, circle, inner sep = .08cm, scale = .75] (location) {2};}
} ]
\clip (-5,0) rectangle (1,2.5);
\draw[postaction = decorate] (-2,0) ellipse (3cm and 2cm);
\end{scope}
\end{tikzpicture}
\end{document}