网格缺少水平线

网格缺少水平线

以下代码:

\begin{figure}[!t]
\centering%
\begin{tikzpicture}[xscale=1,yscale=1,auto, inner sep=0pt,remember picture]
\node[anchor=north west,inner sep=0] (image) at (0,0) {\adjustbox{margin=1em,width=\textwidth,set height=4cm,set depth=4cm,frame,center}{Dummy}};
\begin{scope}[x={(image.north east)},y={(image.south west)}]
\draw[step=0.1,black,thin] (0,0) grid (1,1);
\foreach \x in {0,1,...,9} { \node [anchor=west] at (\x/10,0) {0.\x}; }
\foreach \y in {0,1,...,9} { \node [anchor=north] at (0,\y/10) {0.\y}; }
\end{scope}
\end{tikzpicture}
\end{figure}

生成:

    在此处输入代码

为何水平线消失了?

我对真实数字有同样的问题(即使用 加载图像\includegraphics

答案1

grid由于向量为负,因此函数出现问题。y如果通过指定 a 从下向上绘制网格ystep=-0.1,则它可以正常工作:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\usepackage{adjustbox}

\begin{document}

\begin{tikzpicture}[xscale=1,yscale=1,auto, inner sep=0pt,remember picture]
\node[anchor=north west,inner sep=0] (image) at (0,0) {\adjustbox{margin=1em,width=\textwidth,set height=4cm,set depth=4cm,frame,center}{Dummy}};
\begin{scope}[x={(image.north east)},y={(image.south west)}]
\draw[xstep=0.1,ystep=-0.1,black,thin] (0,1) grid (1,0);
\foreach \x in {0,1,...,9} { \node [anchor=south] at (\x/10,0) {0.\x}; }
\foreach \y in {0,1,...,9} { \node [anchor=east] at (0,\y/10) {0.\y}; }
\end{scope}
\end{tikzpicture}



\end{document}

相关内容