1

I am beginner in tikz. I am using the following code so that the grid also rotating how I prevent the rotation of grid / how I rotate grid by 0 .

 \begin{scope} [xshift=15 ,yshift=0, rotate=30]
     \draw[step=1, red,thin] (-1cm,-1cm) grid (1cm,1cm); 
  • use another scope inside the scope with rotate=-30 – percusse Jun 6 '16 at 6:08
  • @ percusse superb idea – Kevin Jun 6 '16 at 6:59
  • @percusse Would you like to write up an answer? – Torbjørn T. Oct 5 '16 at 21:35
2

If I would answer this a bit more general than what is requested, the transformations are represented as an affine map in PDF specifications. In other words, say the current point to be transformed is x and y is the result of the transformation, then they satisfy the equation:

y = Ax + b

Here A and b are the transformation elements that you can see as

[y1]   [ xscale | xslant ] [x1]   [xshift]
[--] = [ ------ | ------ ] [--] + [------]
[y2]   [ yslant | yscale ] [x2]   [yshift]

However, you can see that because it is an affine map, the order matters

A2(A1x + b1) + b2 != A1(A2x + b2) + b1

In this particular case, because the translational part is zero (it is only a rotation matrix of 30 degrees and no shifts) we can invert the transformation with -30 degrees again with no shifts. Since the transformations are local to the TeX group they are in another scope with inverse transformation would help.

The relevant commands for transformations can be found in the manual. For example to specify a full transformation without the scales slants and shifts you can simply use the cm key as

\begin{tikzpicture}[cm={cos(30),sin(30),-sin(30),cos(30),(15,0)}]
  ...
\end{tikzpicture}

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.