
TikZ 画像の配置に問題があります。半円を配置したいのですが、どのようにすればよいかわかりません。
\begin{tikzpicture}
\draw [domain=0:180] plot ({cos(\x)}, {sin(\x)});
\end{tikzpicture}
誰か助けてくれませんか?
答え1
これはおそらく、円 (または半円) を描く最も簡単な方法ではありません。ただし、円の位置を決めたい場合は、plot
を使用できますshift
。
ここに、TikZ で円を描くことができる例とその他のコマンド (私が知っている限り) をいくつか示します。
\documentclass[tikz,border=7]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[ultra thick, domain=0:180,shift={(.5cm,1.5cm)}] plot ({cos(\x)}, {sin(\x)});
\draw (-3,0) circle(1);
\draw[brown] (-2,0) ellipse(1);
\draw[green] (-2,0) arc(-180:180:1);
\draw[blue] plot[smooth cycle,tension=1] coordinates{(-1,0)(0,1)(1,0)(0,-1)};
\draw[red, xshift=1cm] \foreach \r in {0,...,3}{[rotate=90*\r]
(-1,0) .. controls (-1,0.555) and (-.555,1) .. (0,1)};
\node[yellow,draw,circle,minimum height=2 cm] at (2,0){};
\draw[cyan,bend left=45] (2,0) to (3,1) to (4,0) to (3,-1) to (2,0);
\path[gray] (3,0) edge[out=90,in=180] (4,1)
(4,1) edge[out=0,in=90] (5,0)
(5,0 )edge[out=-90,in=0] (4,-1)
(4,-1) edge[out=180,in=-90] (3,0);
\end{tikzpicture}
\end{document}