如何用字母而不是数字标记 x 中的所有子网格?我尝试过这个,但最后四个子网格根本没有标记:
\documentclass[tikz,border=30pt]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.9\textwidth]{test.jpg}};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
\draw[help lines,xstep=.1,ystep=.1,thick,yellow] (0,0) grid (1,1);
\foreach \y in {1,...,10} { \node [anchor=east] at (0,\y/10-.05) {\y}; }
\begin{axis}[xticklabels={,A,B,C,D,E,F,G,H,I,J},yticklabels={}]
\end{axis}
\end{scope}
\end{tikzpicture}
\end{document}
结果是:
多谢!!
答案1
\documentclass[tikz,border=30pt]{standalone}
\begin{document}
\begin{tikzpicture}
\node[anchor=south west,inner sep=0] (image) at (0,0) {\includegraphics[width=0.9\textwidth]{example-image}};
\begin{scope}[x={(image.south east)},y={(image.north west)}]
\draw[help lines,xstep=.1,ystep=.1,thick,yellow] (0,0) grid (1,1);
\foreach \y in {1,...,10}
\node [anchor=east] at (0,\y/10-.05) {\y};
\foreach \x [count=\nx] in {A,B,...,J}
\node [anchor=north] at (\nx/10-.05,0) {\x};
\end{scope}
\end{tikzpicture}
\end{document}