How to rotate the box?
How to change the above grid to the below shown grid
I used this code to rotate
\draw[step=1, red,thin,rotate=30] (-1cm,-1cm) grid (1cm,1cm);
but i don't wan't to rotate the grid, i only need to rotate the rectangular box.
How to rotate the box?
How to change the above grid to the below shown grid
I used this code to rotate
\draw[step=1, red,thin,rotate=30] (-1cm,-1cm) grid (1cm,1cm);
but i don't wan't to rotate the grid, i only need to rotate the rectangular box.
Draw the grid but clipped with a convenient path.
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}
\clip[draw] (0,-3cm) -- (3,0) -- (0,3)--(-3,0)--cycle;
\draw[step=.5, red, thin] (-3cm,-3cm) grid (3cm,3cm);
\end{tikzpicture}
\end{document}
**Update: **
From Kevin comments I understand that he wants to draw a non rotated grid over a rotated image. And the grid should also be clipped to rotated image size. Something like:
which has been done with following code:
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}
\node[anchor=south west, inner sep=0, rotate=23] (image) at (0,0) {\includegraphics{lion}};
\clip[draw] (image.south west) --(image.south east)--(image.north east)--(image.north west)--cycle;
\draw[white] (image.north west|-image.south west) grid (image.north east-|image.south east);
\end{tikzpicture}
\end{document}
First the external image is include as a rotated node. These node corners define the clipping path for the grid which is drawn later on.
By the way, the lion comes from Keep the frame background in minislides
\scaledwidthand\scaledheight. Even more, to my understandingrotate=-30rotates the grid which is drawn with this command. Do you want a rotated grid inside a differently rotated rectangle? – Ignasi Jun 06 '16 at 13:35