![使用 \draw[o-] 时,可以在圆圈内看到一条线](https://linux22.com/image/316651/%E4%BD%BF%E7%94%A8%20%5Cdraw%5Bo-%5D%20%E6%97%B6%EF%BC%8C%E5%8F%AF%E4%BB%A5%E5%9C%A8%E5%9C%86%E5%9C%88%E5%86%85%E7%9C%8B%E5%88%B0%E4%B8%80%E6%9D%A1%E7%BA%BF.png)
当我使用圆圈放在\draw[o-]
一条线的上方时,可以看到圆圈内的线。如果圆圈是空的,那就更好了。这是一个例子。
\begin{tikzpicture}
\draw[->] (-2,0) -- (2,0) node [below] {$x$};
\draw[->] (0,-2) -- (0,2) coordinate[label = {right:$y$}] (ymax);
\draw (0.25,-0.25) node{{$O$}};
\draw[o-,thick] (-0.1,1) -- (2,1);
\draw[very thick] (0.1,1) -- (2,1);
\draw (-0.25,1) node{{$1$}};
\draw[o-,thick] (0.1,-1) -- (-2,-1);
\draw[very thick] (-0.1,-1) -- (-2,-1);
\draw (0.4,-1) node{{$-1$}};
\end{tikzpicture}
答案1
o-
我建议你不要使用箭头,而是使用另一种方法,使用\node
白色填充的圆形,并设置所需的大小;当然,使用solid
下面示例中的样式。首先完成所有绘制,然后将圆形节点放置在所需位置(循环可简化此过程):
代码:
\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{arrows,arrows.meta}
\tikzset{
solid/.style={thick,draw,fill=white,circle,inner sep=1.5pt}
}
\begin{document}
\begin{tikzpicture}
\draw[->]
(-2,0) -- (2,0) node [below] {$x$};
\draw[->]
(0,-2) -- (0,2) coordinate[label = {right:$y$}] (ymax);
\draw (0.25,-0.25) node{{$O$}};
\draw[very thick]
(0,1) node[left] {$1$} -- (2,1)
(0,-1) node[right] {$-1$} -- (-2,-1);
\foreach \Coord in {(0,1),(0,-1)}
\node[solid] at \Coord {};
\end{tikzpicture}
\end{document}
答案2
适用于所有类型的箭。
\documentclass[10pt,a4paper,french]{article}
\usepackage{cours-nk}
\usetikzlibrary{arrows,arrows.meta}
\begin{document}
\begin{tikzpicture}
\draw[->] (-2,0) -- (2,0) node [below] {$x$};
\draw[->] (0,-2) -- (0,2) coordinate[label = {right:$y$}] (ymax);
\draw (0.25,-0.25) node{{$O$}};
\draw[{Circle[fill=white]}-,thick] (-0.1,1) -- (2,1);
\draw[very thick] (0.1,1) -- (2,1);
\draw (-0.25,1) node{{$1$}};
\draw[{Circle[fill=white]}-,thick] (0.1,-1) -- (-2,-1);
\draw[very thick] (-0.1,-1) -- (-2,-1);
\draw (0.4,-1) node{{$-1$}};
\end{tikzpicture}
\end{document}