如何用 TikZ 绘制人物附件?

如何用 TikZ 绘制人物附件?

如何绘制附图TikZ

\documentclass[border=0.5cm]{standalone}
\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
\draw (-2.5,0) -- (2.5,0);
\draw (0,-3) -- (0,3);
\end{tikzpicture}

\end{document}

在此处输入图片描述

答案1

使用一个解决方案to [out=out_angle, in=in_angle]和一个小技巧来绘制另一个(尺度 y = -1)。

\documentclass[margin=5mm, varwidth]{standalone}

\usepackage{tikz}

\usetikzlibrary{calc,decorations.markings}
\begin{document}
\begin{tikzpicture}[decoration={
markings,% switch on markings
mark=at position 1cm with {\arrow[black]{stealth}},
mark=at position -1cm with {\arrow[black]{stealth}}
}
]

\begin{scope}
\draw[-latex] (-1.5,0) -- (1.5,0);
\draw[-latex] (0,-2.5) -- (0,2.5);

\draw[thick,postaction={decorate},shorten >=1mm,shorten <=1mm] (0,0) coordinate (O) 
to[out=45, in=-90] (1,1.4) to [out=90,in=0] (0,2)
to[out=180,in=90] (-1,1.4) to[out=-90, in=135] (O)
to[out=-45, in=90] (1,-1.4) to [out=-90,in=0] (0,-2)
to[out=180,in=-90] (-1,-1.4) to[out=90, in=-135] (O)
;

\end{scope}
\begin{scope}[xshift=4cm]
\draw[-latex] (-1.5,0) -- (1.5,0);
\draw[-latex] (0,-2.5) -- (0,2.5);

\begin{scope}[yscale=-1,xscale=1]
\draw[thick,postaction={decorate},shorten >=1mm,shorten <=1mm] (0,0) coordinate (O) 
to[out=45, in=-90] (1,1.4) to [out=90,in=0] (0,2)
to[out=180,in=90] (-1,1.4) to[out=-90, in=135] (O)
to[out=-45, in=90] (1,-1.4) to [out=-90,in=0] (0,-2)
to[out=180,in=-90] (-1,-1.4) to[out=90, in=-135] (O)
;
\end{scope}

\end{scope}

\end{tikzpicture}

在此处输入图片描述

答案2

这些是简单的参数图。其中一个接近的参数化是这个。

\documentclass[tikz,border=3mm]{standalone}
\usetikzlibrary{arrows.meta,decorations.pathreplacing,decorations.markings}
\tikzset{->-/.style={decoration={% https://tex.stackexchange.com/a/39282/194703
  markings,
  mark=at position #1 with {\arrow{Stealth}}},postaction={decorate}},
  ->-/.default=0.55,
  -<-/.style={decoration={% https://tex.stackexchange.com/a/39282/194703
  markings,
  mark=at position #1 with {\arrow{Stealth[reversed]}}},postaction={decorate}},
  -<-/.default=0.55}
\tikzset{ rubout/.style={/utils/exec=\tikzset{rubout/.cd,#1},
 decoration={show path construction,
      curveto code={
       \draw [white,line width=\pgfkeysvalueof{/tikz/rubout/line width}+2*\pgfkeysvalueof{/tikz/rubout/halo}] 
        (\tikzinputsegmentfirst) .. controls
        (\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb)  ..(\tikzinputsegmentlast); 
       \draw [line width=\pgfkeysvalueof{/tikz/rubout/line width},shorten <=-0.1pt,shorten >=-0.1pt] (\tikzinputsegmentfirst) .. controls
        (\tikzinputsegmentsupporta) and (\tikzinputsegmentsupportb) ..(\tikzinputsegmentlast);  
      }}},rubout/.cd,line width/.initial=0.4pt,halo/.initial=0.8pt
}
\begin{document}
\begin{tikzpicture}[declare function={r=2;}] 
\begin{scope}
 \draw (-0.8*r,0) -- (0.8*r,0) (0,-1.1*r) -- (0,1.1*r);   
 \draw[postaction={rubout,decorate},-<-=0.08,-<-=0.18] 
    plot[variable=\t,domain=45:400,samples=61,smooth cycle] 
    ({0.67*r*sin(2*\t)},{r*cos(\t)});
\end{scope} 
\begin{scope}[xshift=5cm]
 \draw (-0.8*r,0) -- (0.8*r,0) (0,-1.1*r) -- (0,1.1*r);   
 \draw[postaction={rubout,decorate},-<-=0.58,-<-=0.68] 
    plot[variable=\t,domain=45:400,samples=61,smooth cycle] 
    ({0.67*r*sin(2*\t)},{r*cos(\t)});
\end{scope} 
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案3

\documentclass[tikz, border=0.5cm]{standalone}
\usetikzlibrary{decorations.markings, arrows}  
\begin{document}
\begin{tikzpicture}
\draw (-2.5,0) -- (2.5,0);
\draw (0,-3) -- (0,3);
\begin{scope}[
    xscale=0.8, yscale=0.6,
    decoration={
    markings,
    mark=at position 0.56 with {\arrow{stealth}},
    mark=at position 0.45 with {\arrow{stealth}}
    }] 
\draw[thick, postaction={decorate}] (0,0) -- (1,-1) arc(45:-225:{sqrt(2)}) -- (1,1) arc (-45:225:{sqrt(2)}) -- cycle;
\end{scope}
\end{tikzpicture}
\end{document}

带有两个箭头的 8 字形

相关内容