3

i'am not able to correctly place a text string along the perimeter of 3 circles that I've produced using tikz together with the decorations.text library.

This is what i've got till now

enter image description here

Clearly, the text is completely offset, I need text A and B specular in the top right of the circle while Text C at the bottom of its circle. Also I would like to colour the intersection of the three circle with some shade of gray. Here is my code

\draw[ultra thick, -stealth,
  postaction={decorate,decoration={text effects along path,
    text={Some text A}, text align=left, reverse path,
    text effects/.cd, 
      text along path, 
      every character/.style={fill=white, yshift=-0.5ex}}}]
  (1.5, 0) circle [radius=4];

\draw[draw=black, ultra thick, -stealth,
  postaction={decorate,decoration={text effects along path,
    text={Some text B}, text align=center, reverse path,
        text effects/.cd, 
      text along path, 
      every character/.style={fill=white, xshift=2ex, yshift=-0.5ex}}}]
  (-1.5, 0) circle [radius=4];

\draw[draw=black, ultra thick, -stealth,
  postaction={decorate,decoration={text effects along path,
    text={Some text C}, text align=right,
    text effects/.cd, 
      text along path, 
      every character/.style={fill=white, yshift=-0.5ex}}}]
  (0, -3) circle [radius=4];

\node[draw=none,text width=2.5cm] at (0.5,-0.9) { Some other T};




\end{tikzpicture}

Any help is appreciated

2

I see that there is a -stealth directive, which gets suppressed, well, because as circle is a circle. So If you switch to arcs instead, you can have both: easier positioning of the text and have the arrow. The price you pay is that you have to feed in the starting point of the arc, not the center of the circle. UPDATE: You can keep the center coordinates and I place the arrows using another decoration (and I also remove the xshift which makes the thing look asymmetric, and replaced yshift by raise).

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.text,decorations.markings}

\begin{document}
 \begin{tikzpicture}


\draw[ultra thick, 
  postaction={decorate,decoration={text effects along path,
    text={Some text A}, text align=center, reverse path,raise=-0.5ex,
    text effects/.cd, 
      text along path, 
      every character/.style={fill=white}}},
      postaction={decorate,decoration={markings,{mark=at position 0.25 with
      {\arrow{stealth}}}}}]
  (1.5, 2)+(-90:4) arc(-90:270:4);

\draw[draw=black, ultra thick, 
  postaction={decorate,decoration={text effects along path,
    text={Some text B}, text align=center, reverse path,raise=-0.5ex,
        text effects/.cd, 
      text along path, 
      every character/.style={fill=white}}},
      postaction={decorate,decoration={markings,{mark=at position 0.75 with
      {\arrow{stealth}}}}}]
  (-1.5, 2)+(-90:4) arc(-90:270:4);

\draw[draw=black, ultra thick,
  postaction={decorate,decoration={text effects along path,raise=-0.5ex,
    text={Some text C}, text align=center,
    text effects/.cd, 
      text along path, 
      every character/.style={fill=white}}},
      postaction={decorate,decoration={markings,{mark=at position 0.25 with
      {\arrow{stealth}}}}}]
  (0,-3)+(90:4) arc(90:450:4);

\node[draw=none,text width=2.5cm] at (0.5,-0.9) { Some other T};

\end{tikzpicture}
\end{document}

enter image description here

For completeness, another way: just rotate the full thing and adjust the rotation angle to define the text position and without arrow.

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations.text}

\begin{document}
 \begin{tikzpicture}[scale=0.75]


\draw[ultra thick,rotate around={225:(1.5,2)},
  postaction={decorate,decoration={text effects along path,
    text={Some text A}, text align=center, reverse path,raise=-0.5ex,
    text effects/.cd, 
      text along path, 
      every character/.style={fill=white}}}]
  (1.5, 2) circle(4);

\draw[draw=black, ultra thick,rotate around={315:(-1.5,2)}, 
  postaction={decorate,decoration={text effects along path,
    text={Some text B}, text align=center, reverse path,raise=-0.5ex,
        text effects/.cd, 
      text along path, 
      every character/.style={fill=white}}}]
  (-1.5, 2) circle(4);

\draw[draw=black, ultra thick,rotate around={90:(0,-3)},
  postaction={decorate,decoration={text effects along path,raise=-0.5ex,
    text={Some text C}, text align=center,
    text effects/.cd, 
      text along path, 
      every character/.style={fill=white}}}]
  (0,-3) circle(4);

\node[draw=none,text width=2.5cm] at (0.5,-0.25) { Some other T};

\end{tikzpicture}
\end{document}

enter image description here

  • thanks for this, is there a way to get rid of the arrow? Otherwise, this solution would not work for my problem – Alberto Stefanelli May 25 '18 at 21:42
  • 1
    @AlbertoStefanelli Absolutely. I thought you wanted the arrow since you had -stealth in your \draw commands. Just remove postaction={decorate,decoration={markings,{mark=at position 0.25 with {\arrow{stealth}}}}} from the \draw commands. – marmot May 25 '18 at 21:51

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.