7

The following code:

\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}

generates:

    enter code here

Why are the horizontal lines missing?

I have the same problem with real figures (i.e. loading images with \includegraphics)

7

The grid function stumbles because the y vector is negative. If you draw the grid from the bottom up by specifying a ystep=-0.1, it works fine:

\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}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.