# tikz: How to mirror the path decoration "text along path"?

I'd like to create labeled nested ellipses in tikz. The labels should follow the shape of the ellipses. I used a path decoration with pre to move the label to the right place, but I couldn't figure out: a): how to turn it [the mirror option mirrors it in the wrong way] and b): as soon as I include pre and pre length, other options (such as raise or mirror) do not seem to be respected anymore. Has anyone an idea how to solve this?

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[american]{babel}
\usepackage{tikz}
\usepackage{xcolor}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{decorations.pathmorphing, decorations.text}

\begin{document}

\begin{tikzpicture}[decoration=zigzag]
% ellipses
\filldraw[fill=gray!10, draw=gray!80] (0,0) ellipse (6.4cm and 3.2cm);
\filldraw[fill=gray!20, draw=gray!80] (0,0) ellipse (4.8cm and 2.4cm);
\filldraw[fill=gray!30, draw=gray!80,
postaction={decorate,
decoration={pre=moveto, pre length=3cm, raise=4mm, text along path, text={|\tt|Function 2}}}]
(0,0) ellipse (3.2cm and 1.6cm);
\filldraw[fill=gray!40, draw=gray!80] (0,0) ellipse (1.6cm and 0.8cm) node
{\texttt{Function 1}};
\end{tikzpicture}
\end{document}


Instead of decorate the ellipse, you can decorate an arc of this ellipse. And you can choose the direction of this arc.

\documentclass{standalone}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{tikz}
\usepackage{xcolor}
\usetikzlibrary{shapes,arrows}
\usetikzlibrary{decorations.pathmorphing, decorations.text}
\begin{document}
\begin{tikzpicture}[decoration=zigzag]
% ellipses
\filldraw[fill=gray!10, draw=gray!80] (0,0) ellipse (6.4cm and 3.2cm);
\path[postaction={decorate,
decoration={
raise=-1em,
text along path,
text={|\tt|Function 4},
text align=center,
},
}] (0,0) ++(110:6.4cm and 3.2cm) arc(110:70:6.4cm and 3.2cm);
\filldraw[fill=gray!20, draw=gray!80] (0,0) ellipse (4.8cm and 2.4cm);
\path[postaction={decorate,
decoration={
raise=-1em,
text along path,
text={|\tt|Function 3},
text align=center,
},
}] (0,0) ++(110:4.8cm and 2.4cm) arc(110:70:4.8cm and 2.4cm);
\filldraw[fill=gray!30, draw=gray!80] (0,0) ellipse (3.2cm and 1.6cm);
\path[postaction={decorate,
decoration={
raise=-1em,
text along path,
text={|\tt|Function 2},
text align=center,
},
}] (0,0) ++(110:3.2cm and 1.6cm) arc(110:70:3.2cm and 1.6cm);
\filldraw[fill=gray!40, draw=gray!80] (0,0) ellipse (1.6cm and 0.8cm) node
{\texttt{Function 1}};
\end{tikzpicture}
\end{document}

• If you really want to, you can mirror the text with reverse path, or add space before the text with text align={left indent=<insert favorite length>}, but this answer is a much easier and more elegant way of doing it. Feb 3, 2013 at 0:30