答案1
像这样:
代码:
\documentclass[a4paper]{article}
\usepackage{tikz}
\begin{document}
\thispagestyle{empty}
\begin{tikzpicture}[scale=.7]
\draw[gray!20] (-5,-5) grid (5,5); % <-- comment this line after seeiing the code
\draw[red,line width=2pt] (-4,-4)--(-4,4);
\draw[blue,line width=2pt] (-3,-4)--(-3,4);
\draw[blue,line width=2] (4,-4) arc (0:180:3);
\draw[blue,line width=2] (4,4) arc (0:-180:3);
\draw[red,line width=2pt] (.5,-4)--(.5,4);
\draw[red,line width=2pt] (1.5,-4)--(1.5,4);
\end{tikzpicture}
\end{document}
编辑:如果您希望在每条线弧的末尾添加彩色点,请在之前添加此行\end{tikzpicture}
:
\foreach \j in {-4,4}{
\foreach \i/\c in {-4/red,-3/blue,-2/blue,.5/red,1.5/red,4/blue}
\filldraw[\c] (\i,\j) circle(4pt);
}
新输出: