我想在坐标上画粗黑点
(0,0)和(4,0)
以及坐标上的小圆圈
(0,4)和(4,4)
但我不知道该怎么做。你能帮助我吗?
\documentclass{article}
\usepackage{amsmath}
\usepackage{pgfplots}
\usepackage{color}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
[
x=1cm, y=1cm, scale=1.0,
font=\footnotesize,
>=latex
]
\draw[ help lines] (0,0) grid (4.5,4.5);
% x-axis
\draw[->] (-0.2,0) -- (4.5,0) node[below] {$\varphi(a)$};
%numbers on x-axis
\draw[shift={(0,0)}, color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $0$};
\draw[shift={(4,0)}, color=black] (0pt,2pt) -- (0pt,-2pt) node[below] {\footnotesize $4$};
% y-axis
\draw[->] (0,-0.2) -- (0,4.5) node[right] {};%node[above left]
% numbers on axis
\draw[shift={(0,4)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $4$};
\draw[shift={(0,2)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $2$};
\draw[shift={(0,1.5)},color=black] (2pt,0pt) -- (-2pt,0pt) node[left] {\footnotesize $\varphi(e)$};
\end{tikzpicture}
\end{document}
答案1
删除所有多余的东西并在所需坐标上添加点和圆圈后:
\documentclass{article}
\usepackage{amsmath}
\usepackage{pgfplots}
\usepackage{color}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
[
x=1cm, y=1cm, scale=1.0,
font=\footnotesize,
>=latex
]
\draw[ help lines] (0,0) grid (4.5,4.5);
% x-axis
\draw[->] (-0.2,0) -- (4.5,0) node[below] {$\varphi(a)$};
%numbers on x-axis
\foreach \i in {0,...,4}
\draw (\i,1mm) -- ++ (0pt,-2mm) node[below] {$\i$};
% y-axis
\draw[->] (0,-0.2) -- (0,4.5);
% numbers on axis
\foreach \i in {1,...,4}
\draw (0,\i) -- ++ (-2mm,0pt) node[left] {$\i$};
\draw (1mm,1.5) -- ++ (-2mm,0pt) node[left] {$\varphi(e)$};
% cirles (marks)
\fill (0,0) circle (1mm) (4,0) circle (1mm); % <--- added
\draw[fill=white]
(0,4) circle (1mm) (4,4) circle (1mm); % <--- added
\end{tikzpicture}
\end{document}