当我使用圆圈放在\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}