8

I found this question that shows how to draw curly braces in tikz and to mirror them using decorations. But, how can they be rotated an arbitrary angle? .

2
  • Does \draw [decorate,decoration={brace}] (0,0) -- (30:4); work as you expect it to? Commented Nov 11, 2013 at 0:26
  • 2
    Could you a minimal working example (MWE) of what you want to achieve? This decoration more or less connects the start and the target coordinate on a straight line. Around what point do you want to rotate what? Commented Nov 11, 2013 at 0:32

2 Answers 2

19
\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}

\begin{tikzpicture}
\draw[help lines] (-6,-6) grid (6,6);
\foreach \x in {0,36,72,...,324}
\draw [decorate,decoration={brace,amplitude=10pt},rotate=\x] (0.5,0.5) -- (0.5,5.0);
\end{tikzpicture}
\end{document}

enter image description here

You can also rotate around a point.

\documentclass[tikz]{standalone}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}

\begin{tikzpicture}
\draw[help lines] (-6,-6) grid (6,6);
\foreach \x in {0,36,72,...,324}
\draw [decorate,decoration={brace,amplitude=10pt},rotate around={\x:(0.5,0.5)},=\x] (0.5,0.5) -- (0.5,5.0);
\end{tikzpicture}
\end{document}

enter image description here

enter image description here

1
  • 2
    ...and now one with one degree steps, and I'll be completely dizzy. Nice work! Commented Nov 11, 2013 at 0:46
3

As one can guess:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}

\begin{tikzpicture}[scale=1,rotate=60] % the only change
\draw[thick] (-1,0) rectangle +(6,7.5);
\filldraw[thick, top color=white,bottom color=red!50!] (0.5,0) rectangle node{$N_S$} +(1.3,0.5);
\filldraw[thick, top color=white,bottom color=red!50!] (2.2,0) rectangle node{$N_L$} +(1.3,0.65);
\filldraw[top color=white,bottom color=blue!50!] (0.5,0.5) rectangle node{$P_{1}$} +(1.3,0.5);
\filldraw[top color=white,bottom color=blue!50!] (2.2,0.65) rectangle node{$P_{2}$} +(1.3,1.0);
\filldraw[top color=white,bottom color=blue!50!] (0.5,1.0) rectangle node{$P_{3}$} +(1.3,1.5);
\filldraw[top color=white,bottom color=blue!50!] (2.2,1.65) rectangle node{$P_{4}$} +(1.3,2.0);
\filldraw[top color=white,bottom color=blue!50!] (0.5,2.5) rectangle node{$P_{5}$} +(1.3,2.5);
\filldraw[top color=white,bottom color=blue!50!] (2.2,3.65) rectangle node{$P_{6}$} +(1.3,3.0);
\draw [decorate,decoration={brace,amplitude=10pt},xshift=-4pt,yshift=0pt]
(0.5,0.5) -- (0.5,5.0) node [black,midway,xshift=-0.6cm] 
{\footnotesize $P_1$};
\draw [decorate,decoration={brace,amplitude=10pt},xshift=-4pt,yshift=0pt]
(3.5,0.65) -- (3.5,6.5)node [black,midway,xshift=9pt] {\footnotesize
$P_2$};
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .