Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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)

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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