这是 floor 函数图的代码。我想做一些修改,如下所示:
\documentclass{article}
\usepackage{pgf,tikz,pgfplots,tkz-base}
\begin{document}
\begin{tikzpicture}
\tkzInit[xmin = -3, xmax = 3, ymin = -3, ymax = 3]
\tkzAxeXY
\foreach \a in {-3,...,3}{
\draw[blue] (\a, \a) -- (\a + 1, \a);
\node [circle, draw, fill, line width = .5pt, color = blue, inner sep = 0pt, minimum size = 3pt] (ca) at (\a, \a) {};
\node [circle, draw, fill=none, line width = .5pt, color = red, inner sep = 0pt, minimum size = 3pt] (ca) at (\a + 1, \a) {};
}
\end{tikzpicture}
\end{document}
答案1
您可以剪掉圆的一半,比如说orig=false
移除它0
并在轴下方放置一个简单的节点。
\documentclass{article}
\usepackage{tikz,tkz-base}
\begin{document}
\begin{tikzpicture}
\tkzInit[xmin = -3, xmax = 3, ymin = -3, ymax = 3]
\tkzAxeX[orig=false]
\tkzAxeY
\foreach \a in {-3,...,3}{
\draw[blue] (\a, \a) -- (\a + 1, \a);
\node [circle, draw, fill, line width = .5pt, color = blue, inner sep = 0pt, minimum size = 3pt] (ca) at (\a, \a) {};
\begin{scope}
\clip ([xshift=-1em,yshift=-1em]\a + 1, \a) rectangle
([yshift=1em]\a + 1, \a);
\node [circle, draw, fill=none, line width = .5pt, color = red, inner sep = 0pt, minimum size = 3pt] (ca) at (\a + 1, \a) {};
\end{scope}
}
\node[below] at (0,-3.2) {title of the plot};
\end{tikzpicture}
\end{document}