4

I created the following image with MS Visio: enter image description here

MWE

Now I want to create it with Tikz. Therefor I already got an MWE to this:

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}

\definecolor{g1}{RGB}{235,240,245}
\definecolor{g2}{RGB}{223,230,237}
\definecolor{g3}{RGB}{205,217,225}
\definecolor{g4}{RGB}{190,205,215}
\definecolor{g5}{RGB}{173,190,203}
\definecolor{g6}{RGB}{155,175,190}
\definecolor{g7}{RGB}{135,155,170}

\begin{document}

\begin{tikzpicture}
    \clip (0,0) rectangle (7,1.75);
    \foreach \n [count=\i] in {28,24,...,4}{
        \fill[g\i, draw=black] (28em,0) circle (\n em);
    }
    \draw[black, line width=0.75pt] (0,0) -- (7,0) -- (7,1.75) -- (0.215,1.75);
\end{tikzpicture}
\end{document}

Result

whicht produces: enter image description here (note: this has an additional circle, that is intended)

Question

How can I reproduce the text as in the first image?

And besides the text: Is my MWE optimal? (In the means of sizing (using just 7 cm width which will lead to really big text) and coding of repeated functions.)

  • 1
    You can use a foreach loop for the circles – percusse Aug 26 '16 at 9:29
  • If there's an extra circle, which one should be the empty circle: smallest or the biggest? – Alenanno Aug 26 '16 at 11:03
  • @Alenanno I don't understand what you mean. I added an extra circle because I had an additional layer in my work case. If you mean the arc of the text, than there should be an arc between every two where the text should align so that is has a mean bending – Phil Aug 26 '16 at 11:22
  • I meant that there are 6 "texts", but 7 circles in your own solution, where you say you added an extra one. So, which circle should be empty, as in without text? – Alenanno Aug 26 '16 at 12:02
  • Ah ok. The fifth from the left should be empty ;) But for your example you can type some blindtext. – Phil Aug 26 '16 at 12:07
4

Here is a possible solution:

Output

enter image description here

Code

\documentclass[margin=10pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.text, intersections}

\definecolor{g8}{RGB}{255,255,255} %to trick foreach
\definecolor{g1}{RGB}{235,240,245}
\definecolor{g2}{RGB}{223,230,237}
\definecolor{g3}{RGB}{205,217,225}
\definecolor{g4}{RGB}{190,205,215}
\definecolor{g5}{RGB}{173,190,203}
\definecolor{g6}{RGB}{155,175,190}
\definecolor{g7}{RGB}{135,155,170}

\tikzset{
    curvetext/.style n args={4}{postaction={decorate,
        decoration={
            text along path,
            text={|\sffamily#2|#3},
            text align={center, left indent=1mm, #4},
            raise=#1,
            reverse path,
            %text effects/.cd,
            every character/.style={draw},
            %text width=2cm,
            }}}
}

\begin{document}
\begin{tikzpicture}
\clip (-.1,0) rectangle (28em,2);
\foreach \angle/\texta/\textb [count=\j, evaluate=\j as \x using int(32-4*\j)] in {%
    0/,
    -6/Zaun mit Tor/,
    -7/Uberwachungs-/kameras,
    -9/verschlossene/Schaltwarte,
    -11/pw-geschutzte/Bedienung,
    -25/,
    -32/verschlossene/Schaltschranke,
    20/2-Augen-/prinzip
}{%
    \ifnum\j=8
    \path[
         curvetext={-3mm}{\scriptsize\phantom{,}}{\texta}{},
         curvetext={-6mm}{\scriptsize\phantom{,}}{\textb}{},
         ]
    (28em,4em) arc (90:180:4em);
    \else
    \begin{scope}[shift={(28em,0)}]
    \draw[
        fill=g\j, rotate=\angle,
        curvetext={7mm}{\scriptsize}{\texta}{},
        curvetext={4mm}{\scriptsize}{\textb}{}
        ] 
    (0,0) circle (\x em);
    \end{scope}
    \fi
}%
\path[name path=circ] (28em,0) circle (28em);
\path[name path=horiz] (-.1,2) --++ (5,0);
\path[name intersections={of=circ and horiz,by=E}];
\draw (E) -| (28em,0) -- (0,0);
\end{tikzpicture}
\end{document}
  • Could you make the text centered in each area? And please without serifes. And the text in the smallest circle looks a bit stretched, could you resize it? – Phil Aug 26 '16 at 14:58
  • @Phil The serifs can be removed by adding \sffamily to the second argument of curvetext. The other two requests are much harder to implement. Try commenting out the clip, then change the text align to center, the text will not stay in that position. All of this was manually done and it's not easy to fine tune the text's position. – Alenanno Aug 26 '16 at 15:04
  • @Phil Maybe I found a way. Please, stand by. :P – Alenanno Aug 26 '16 at 15:13
  • Thanks for trying so hard ;) Isn't there a possibility to calculate the length of the path for the text using the readius of the bow and the heigth of the clipping? And then just centering the text ;) – Phil Aug 26 '16 at 15:21
  • @Phil Maybe. But that would require a slightly different solution. I'm using the circles as paths, but for your solution, I'd have to make new paths. :P – Alenanno Aug 26 '16 at 15:23

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.