\documentclass[tikz,border=10pt]{standalone}
\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}
\draw plot [hobby] coordinates {(0,4) (1,3.2) (2,1.5) (2.5,1.2) (3,1) (4,0.8)};
\end{tikzpicture}
\begin{tikzpicture}
\draw[black, thick] (-1,1) -- (1,-1);
\draw[black, thick] (-1,-1) -- (1,1);
\filldraw[black] (0,0) circle (2pt) ;
\draw[black, thick] (0,0) -- (0,-1.5);
\draw[black, thick] (0,-1.5) -- (0.5,-1);
\draw[black, thick] (0,-1.5) -- (-0.5,-2);
\filldraw[color=red!60, fill=red!5, very thick](-1,1) circle (.3);
\filldraw[color=red!60, fill=white, very thick](-1,-1) circle (.3);
\filldraw[color=red!60, fill=red!5, very thick](1,-1) circle (.3);
\filldraw[color=red!60, fill=red!5, very thick](1,1) circle (.3);
\draw (-.5,-2) .. controls (0.1,-2.8) and (.3,-2) .. (.5,-1);
\end{tikzpicture}
\end{document}
이 작업을 수행했지만 경로에 배치하는 방법을 모르겠습니다.
답변1
길에서 사용할 수 있는 pic
미니와 같은 를 사용하는 것이 좋습니다 . tikzpicture
아래 코드에서는 드론 코드를 가져와서 pic
. 코드의 출처에 따라 배치 위치가 결정되므로 pic
다음을 사용하여 배치를 이동했습니다 yshift
(또한 크기도 조정했습니다). 그런 다음 다른 노드와 마찬가지로 경로에 배치할 수 있습니다.
재미삼아 decorations.pathmorphing
.
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta, decorations.pathmorphing}
\tikzset{drone/.pic={
\draw[black, thick] (-1,1) -- (1,-1);
\draw[black, thick] (-1,-1) -- (1,1);
\filldraw[black] (0,0) circle (2pt) ;
\draw[black, thick] (0,0) -- (0,-1.5);
\draw[black, thick] (0,-1.5) -- (0.5,-1);
\draw[black, thick] (0,-1.5) -- (-0.5,-2);
\filldraw[color=red!60, fill=red!5, very thick](-1,1) circle (.3);
\filldraw[color=red!60, fill=white, very thick](-1,-1) circle (.3);
\filldraw[color=red!60, fill=red!5, very thick](1,-1) circle (.3);
\filldraw[color=red!60, fill=red!5, very thick](1,1) circle (.3);
\draw (-.5,-2) .. controls (0.1,-2.8) and (.3,-2) .. (.5,-1);
}
}
\begin{document}
\begin{tikzpicture}[every pic/.style={yshift=1cm, scale=.5, transform shape}]
\pgfmathsetseed{1415}
\draw[decorate, decoration={random steps, segment length=3mm, amplitude=1pt}, line width=8mm, cyan!60!white](-.5,-.4)--(9,-.4);
\draw[<->, thick](0,1.5)node[left]{$z$}|-(1.5,0)node[below]{$x$};
\draw(0,4)to[out=-20, in=180]pic[pos=0]{drone}pic[pos=1]{drone}(5,0)pic[xshift=3cm]{drone};
\draw[<->, thick, red](0,-1)--node[below]{flying}(5,-1);
\draw[<->, thick, red](5,-1)--node[below]{sailing}(9,-1);
\end{tikzpicture}
\end{document}