I have a basic pic ("brick") that I rotate/flip/shift within other pics (e.g. "wall"). These pics ("wall") then get drawn in my tikzpicture, possibly themselves rotated/flipped/shifted.
The brick pic renders fine, the wall pic renders fine, but I cannot seem to scale or rotate the wall pic (I can shift it with xshift
and yshift
though).
I have followed this nested pics question which was resolved by replacing the \draw
in the wall pic with \path
.
However, that question did not deal with rotations and scalings.
How can I rotate/scale my wall
pic? At the moment my ugly workaround is to put the tikz for brick
into a macro which I call in the wall code (as opposed to drawing the brick pic), but this does not seem to be the tikz way.
In the above, shifting the wall works (blue), but the x-mirrored wall (red) does not mirror. (Obviously not intended to be bricks and walls, unless I am constructionally challenged).
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\tikzset{
brick/.pic={
\draw (0, 0) -- (1, 3) -- (2, 1.5) -- cycle;
},
wall/.pic={
\path pic {brick};
\path pic [xshift=1cm,yshift=2cm,scale=0.5] {brick};
}
}
\begin{tikzpicture}
\draw (-3, -1) rectangle (3, 4);% bounding box
\node at (0, 0) {.}; % origin
\draw pic {wall};
\path pic [red,ultra thin,xscale=-1] {wall};
% shifting works
\path pic [blue,ultra thin,xshift=1cm] {wall};
\end{tikzpicture}
\end{document}
pics
(see comments below post). It turned out that mirroring doesn't work withpics
. – gernot Dec 9 '16 at 14:26transform shape
. – Symbol 1 Dec 10 '16 at 16:32transform shape
into the tikzpiture\path pic
, and it worked. (I think I'llevery node/.style={transform shape}
). If you would like to post it as an answer I can mark the question as closed. Otherwise I'll post your answer as an answer (for posterity) tomorrow some time. – mathematical.coffee Dec 11 '16 at 11:49