我从那段代码开始。
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[help lines,black] (0,0) grid (9,9);
\draw [ultra thick,black, ->] (0,0)--(9.5,0) node[below right] {\textbf{\Huge $X\left[ km \right]$}};
\draw [ultra thick,black, ->] (0,0)--(0,9.5) node[above left] {\textbf{\Huge $Y \left[ km \right]$}};
\foreach \i in {1,...,9}
\draw (\i,.3)--++(-90:6mm) node[below]{\Huge \textbf{\i}};
\foreach \i in {1,...,9}
\draw (.3,\i)--++(180:6mm) node[left]{\Huge \textbf{\i}};
\node[below left] at (0,0) {\Huge \textbf{0}};
\draw [fill=black] (0.0,0.0) circle (4.0pt);
\draw [ultra thick,black] (0.0,0.0)--(5.0,5.0) node[above left] {\textbf{\Large }};
\draw [fill=black] (5.0,5.0) circle (4.0pt);
\end{tikzpicture}
\end{document}
答案1
虽然选择pgfplots
更改轴标签可能是更好的选择,但相对容易:
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}
\pgfkeys{/pgf/number format/.cd,fixed,precision=2}
\draw[help lines,black] (0,0) grid (9,9);
\draw [ultra thick,black, ->] (0,0)--(9.5,0) node[below right] {\textbf{\Huge $X$ \lbrack km\rbrack}};
\draw [ultra thick,black, ->] (0,0)--(0,9.5) node[above left] {\textbf{\Huge $Y$ \lbrack km\rbrack}};
\foreach \i in {1,...,9}
\draw (\i,.3)--++(-90:6mm) node[below]{\Large\pgfmathparse{\i/10}$\mathbf{\pgfmathprintnumber{\pgfmathresult}}$};
\foreach \i in {1,...,6}
\draw (.3,\i)--++(180:6mm) node[left]{\Large\pgfmathparse{\i/6*24}$\mathbf{\pgfmathprintnumber{\pgfmathresult}}$};
\node[below left] at (0,0) {\Large \textbf{0}};
\draw [fill=black] (0.0,0.0) circle (4.0pt);
\draw [ultra thick,black] (0.0,0.0)--(5.0,5.0) node[above left] {\textbf{\Large }};
\draw [fill=black] (5.0,5.0) circle (4.0pt);
\end{tikzpicture}
\end{document}
结果是