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
, other options (such as
lengthraise
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}
Best Answer
Instead of decorate the ellipse, you can decorate an arc of this ellipse. And you can choose the direction of this arc.