3

i want continues in previous post: custom colour wheel

This Minimal Code:

\documentclass{article}
\usepackage[a5paper,landscape,left=1.0cm,right=0.3cm,top=0.5cm,bottom=0.5cm]{geometry}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{decorations.text,shadings}
\renewcommand*\familydefault{\sfdefault} % Set font to serif family
% smuggling from https://tex.stackexchange.com/a/470979/121799
\newcounter{smuggle}
\DeclareRobustCommand\smuggleone[1]{%
  \stepcounter{smuggle}%
  \expandafter\global\expandafter\let\csname smuggle@\arabic{smuggle}\endcsname#1%
  \aftergroup\let\aftergroup#1\expandafter\aftergroup\csname smuggle@\arabic{smuggle}\endcsname
}
\DeclareRobustCommand\smuggle[2][1]{%
  \smuggleone{#2}%
  \ifnum#1>1
    \aftergroup\smuggle\aftergroup[\expandafter\aftergroup\the\numexpr#1-1\aftergroup]\aftergroup#2%
  \fi
}
\begin{document}

    \begin{tikzpicture}[
        % Environment Cfg
        font=\Large,
        scale=1,
        % Styles
    ]
\tikzset{life wheel/.cd,
radius/.initial=10,
outer image radius/.initial=0.5,
inner image radius/.initial=1,
outer image parameters/.initial={width=1.25cm},
inner image parameters/.initial={width=2.5cm},
Separator/.style={thick, color=black!50},
Border/.style={line width=1pt,color=red!60,shading=color wheel},
colors/.initial={}
}    
% lifeweel from many codes arround TEX.SE
%Variables: 1:images, 2:image 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
\newcommand\LifeWeel[3][]{%
\def\imglst{{#2}}
\tikzset{life wheel/.cd,#1}
\edef\LstColors{\pgfkeysvalueof{/tikz/life wheel/colors}}
\edef\NumColors{0}
\foreach \X [count=\Y starting from 1] in \LstColors
{\edef\NumColors{\Y}
\smuggle[2]{\NumColors}}
\foreach \X [count=\Y starting from 0] in {#2}
{\edef\NumImages{\Y}
\smuggle[2]{\NumImages}}
\foreach \X [count=\Y] in {#3}
{\edef\NumFeatures{\Y}
\smuggle[2]{\NumFeatures}}
%Drawing the border
\draw[life wheel/Border] (0,0) circle [radius=\pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
\ifnum\NumColors>1
\foreach \m [count=\i] in {1,...,\NumFeatures}{
\pgfmathtruncatemacro{\myi}{mod(\i-1,\NumColors)}
\pgfmathsetmacro{\mycolor}{{\LstColors}[\myi]}
\draw[life wheel/Separator,top color=\mycolor!75!black,
bottom color=\mycolor,shading angle={-90+(360/\NumFeatures)*(\i-0.5)}] (0,0) -- (360/\NumFeatures*\i:\pgfkeysvalueof{/tikz/life wheel/radius})
arc({(360/\NumFeatures)*\i}:{(360/\NumFeatures)*(\i-1)}:\pgfkeysvalueof{/tikz/life wheel/radius})
-- cycle;}
\else
\foreach \m [count=\i] in {0,1,...,\NumFeatures}{
\draw[life wheel/Separator] (0,0) -- (360/\NumFeatures*\i:\pgfkeysvalueof{/tikz/life wheel/radius});}
\fi

%Drawing the names
    \foreach \o/\p [count=\j] in {#3}{
        \pgfmathtruncatemacro{\myint}{ifthenelse(sin(360/\NumFeatures*\j)<0,-1,1)} 
        \ifnum\myint<0% True
        \path[%Reverse
            decoration={
                raise = -0.4ex,
                text  along path,
                text = {|\huge|\o},
                text align = center,
                reverse path
            },
            decorate
        ]
        (360/\NumFeatures*\j:\pgfkeysvalueof{/tikz/life wheel/radius}+0.7) arc (360/\NumFeatures*\j:360/\NumFeatures*(\j-1):\pgfkeysvalueof{/tikz/life wheel/radius}+0.7);%\path
        \else%False
        \path[%Normal
            decoration={
                raise = -0.8ex,
                text  along path,
                text = {|\huge|\o},
                text align = center
                },
            decorate
        ]
        (360/\NumFeatures*\j:\pgfkeysvalueof{/tikz/life wheel/radius}+0.35) arc (360/\NumFeatures*\j:360/\NumFeatures*(\j-1):\pgfkeysvalueof{/tikz/life wheel/radius}+0.35); %Path
        \fi
    \foreach \X in {1,...,\NumImages}
    {\pgfmathsetmacro{\tmp}{360/\NumFeatures*\j+((1-2*\X)/(2*\NumImages))*360/\NumFeatures}
    \pgfmathsetmacro{\imgname}{\imglst[\X]}
    \begin{scope}
     \clip (\tmp:{\pgfkeysvalueof{/tikz/life
     wheel/radius}-1.1*\pgfkeysvalueof{/tikz/life wheel/outer image radius}}) 
     circle[radius=\pgfkeysvalueof{/tikz/life wheel/outer image radius}];
     \node[rotate={\tmp-\myint*90}] at 
     (\tmp:{\pgfkeysvalueof{/tikz/life wheel/radius}-1.1*\pgfkeysvalueof{/tikz/life wheel/outer image radius}})   
     {\edef\temp{\noexpand\includegraphics[\pgfkeysvalueof{/tikz/life wheel/outer image parameters}]{\imgname}}
     \temp};    
    \end{scope}
    }
}
\begin{scope}
    \pgfmathsetmacro{\imgname}{\imglst[0]}
    \clip (0,0) circle[radius=\pgfkeysvalueof{/tikz/life wheel/inner image radius}];
    \node at (0,0)
    {\edef\temp{\noexpand\includegraphics[\pgfkeysvalueof{/tikz/life wheel/inner image parameters}]{\imgname}}
     \temp}; 
\end{scope}
}


% This function draws the lifeweel
%\LifeWeel{figures}{list of features in the form feature_name/quantity}
\LifeWeel[radius=5,outer image radius=0.4,%
colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-a","example-image-a","example-image-b","example-image-c"}{%
        A/10,
        B/10,
        C/10,
        D/10,
        E/10,
        F/10,
        G/10,
        H/10}
        \end{tikzpicture}

\end{document}

How can i clone and scale this wheel (bigger/smaller) and put copy in same page with some other image/text? Thanks

5

When I wrote my life wheel answer, which you are using here but not linking to, I did that precisely in order to remove the vast number of arguments in favor of pgf keys. The only things that were not moved to the pgf keys were the image list and the texts. Other than that there is nothing that prevents you from using the \LifeWheel command with a minimal number of arguments, you can set all the defaults in the pgf keys.

To simplify matter even further,

  1. I moved the list of images also to the pgf keys, and
  2. made the decorations.text susceptible to the scale of the ambient tikzpicture since otherwise, as noted by Joule V, these texts do not get scaled properly.

With these changes, drawing a simple life wheel boils down to

\tikz{\LifeWeel{A/10,B/10,C/10,D/10,E/10,F/10,G/10,H/10}}

but I stress that before that all you needed to do is to add the list of figures, so the command was not much longer. With the above-mentioned changes, now it scales properly, i.e. you could do something like

\tikz[scale=0.5,transform shape]{\LifeWeel{A/10,B/10,C/10,D/10,E/10,F/10,G/10,H/10}}  

Setting the defaults is (and was) as simple as saying

\tikzset{life wheel/.cd,
radius=5,outer image radius=0.4,%
colors={"red","blue","magenta","purple","orange","green"},
img list={"example-image-a","example-image-a","example-image-b","example-image-c"}}

Let me mention that, while there is nothing wrong with a \scalebox, I am not a big fan of it, see e.g. here for more details. Of course, if you are absolutely sure you do not want to access the nodes later, you will be fine.

\documentclass{article}
\usepackage[a5paper,landscape,left=1.0cm,right=0.3cm,top=0.5cm,bottom=0.5cm]{geometry}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{decorations.text,shadings}
\renewcommand*\familydefault{\sfdefault} % Set font to serif family
% smuggling from https://tex.stackexchange.com/a/470979/121799
\newcounter{smuggle}
\DeclareRobustCommand\smuggleone[1]{%
  \stepcounter{smuggle}%
  \expandafter\global\expandafter\let\csname smuggle@\arabic{smuggle}\endcsname#1%
  \aftergroup\let\aftergroup#1\expandafter\aftergroup\csname smuggle@\arabic{smuggle}\endcsname
}
\DeclareRobustCommand\smuggle[2][1]{%
  \smuggleone{#2}%
  \ifnum#1>1
    \aftergroup\smuggle\aftergroup[\expandafter\aftergroup\the\numexpr#1-1\aftergroup]\aftergroup#2%
  \fi
}

\tikzset{life wheel/.cd,
radius/.initial=10,
outer image radius/.initial=0.5,
inner image radius/.initial=1,
outer image parameters/.initial={width=1.25cm},
inner image parameters/.initial={width=2.5cm},
Separator/.style={thick, color=black!50},
Border/.style={line width=1pt,color=red!60,shading=color wheel},
colors/.initial={},
img list/.initial={"example-image-a","example-image-a","example-image-b","example-image-c"}
}    
% lifeweel from many codes arround TEX.SE
%Variables: 1:images, 2:image 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
\newcommand\LifeWeel[2][]{%\pgfkeys{/tikz/life wheel/img list=#2}%\def\imglst{{#2}}
\tikzset{life wheel/.cd,#1}
\pgfgettransformentries{\mysfx}{\tmp}{\tmp}{\mysfy}{\tmp}{\tmp}
\pgfmathtruncatemacro{\myfsx}{\mysfx*24} % decoration text 
\pgfmathtruncatemacro{\myfsy}{\mysfy*24} % font scaling
\edef\imglst{\pgfkeysvalueof{/tikz/life wheel/img list}}
\edef\LstColors{\pgfkeysvalueof{/tikz/life wheel/colors}}
\edef\NumColors{0}
\foreach \X [count=\Y starting from 1] in \LstColors
{\edef\NumColors{\Y}
\smuggle[2]{\NumColors}}
\foreach \X [count=\Y starting from 0] in \imglst
{\edef\NumImages{\Y}
\smuggle[2]{\NumImages}}
\foreach \X [count=\Y] in {#2}
{\edef\NumFeatures{\Y}
\smuggle[2]{\NumFeatures}}
%Drawing the border
\draw[life wheel/Border] (0,0) circle [radius=\pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
\ifnum\NumColors>1
\foreach \m [count=\i] in {1,...,\NumFeatures}{
\pgfmathtruncatemacro{\myi}{mod(\i-1,\NumColors)}
\pgfmathsetmacro{\mycolor}{{\LstColors}[\myi]}
\draw[life wheel/Separator,top color=\mycolor!75!black,
bottom color=\mycolor,shading angle={-90+(360/\NumFeatures)*(\i-0.5)}] (0,0) -- (360/\NumFeatures*\i:\pgfkeysvalueof{/tikz/life wheel/radius})
arc({(360/\NumFeatures)*\i}:{(360/\NumFeatures)*(\i-1)}:\pgfkeysvalueof{/tikz/life wheel/radius})
-- cycle;}
\else
\foreach \m [count=\i] in {0,1,...,\NumFeatures}{
\draw[life wheel/Separator] (0,0) -- (360/\NumFeatures*\i:\pgfkeysvalueof{/tikz/life wheel/radius});}
\fi
%Drawing the names
    \foreach \o/\p [count=\j] in {#2}{%
        \pgfmathtruncatemacro{\myint}{ifthenelse(sin(360/\NumFeatures*\j)<0,-1,1)} 
        \ifnum\myint<0% True
        \path[%Reverse
            decoration={
                raise = -0.4ex,
                text  along path,
                text = {|\fontsize{\myfsy}{\myfsx}\selectfont|\o},
                text align = center,
                reverse path
            },
            decorate
        ]
        (360/\NumFeatures*\j:\pgfkeysvalueof{/tikz/life wheel/radius}+0.7) arc (360/\NumFeatures*\j:360/\NumFeatures*(\j-1):\pgfkeysvalueof{/tikz/life wheel/radius}+0.7);%\path
        \else%False
        \path[%Normal
            decoration={
                raise = -0.8ex,
                text  along path,
                text = {|\fontsize{\myfsy}{\myfsx}\selectfont|\o},
                text align = center
                },
            decorate
        ]
        (360/\NumFeatures*\j:\pgfkeysvalueof{/tikz/life wheel/radius}+0.35) arc (360/\NumFeatures*\j:360/\NumFeatures*(\j-1):\pgfkeysvalueof{/tikz/life wheel/radius}+0.35); %Path
        \fi
    \foreach \X in {1,...,\NumImages}
    {\pgfmathsetmacro{\tmp}{360/\NumFeatures*\j+((1-2*\X)/(2*\NumImages))*360/\NumFeatures}         
    \pgfmathsetmacro{\imgname}{{\imglst}[\X]}
    \begin{scope}
     \clip (\tmp:{\pgfkeysvalueof{/tikz/life
     wheel/radius}-1.1*\pgfkeysvalueof{/tikz/life wheel/outer image radius}}) 
     circle[radius=\pgfkeysvalueof{/tikz/life wheel/outer image radius}];
     \node[rotate={\tmp-\myint*90}] at 
     (\tmp:{\pgfkeysvalueof{/tikz/life wheel/radius}-1.1*\pgfkeysvalueof{/tikz/life wheel/outer image radius}})   
     {\edef\temp{\noexpand\includegraphics[\pgfkeysvalueof{/tikz/life wheel/outer image parameters}]{\imgname}}
     \temp};    
    \end{scope}
    }
}
\begin{scope}
    \pgfmathsetmacro{\imgname}{{\imglst}[0]}
    \clip (0,0) circle[radius=\pgfkeysvalueof{/tikz/life wheel/inner image radius}];
    \node at (0,0)
    {\edef\temp{\noexpand\includegraphics[\pgfkeysvalueof{/tikz/life wheel/inner image parameters}]{\imgname}}
     \temp}; 
\end{scope}
}
\begin{document}
% this defines all your default parameters. Of course, you can change them at any time.
\tikzset{life wheel/.cd,
radius=5,outer image radius=0.4,%
colors={"red","blue","magenta","purple","orange","green"},
img list={"example-image-a","example-image-a","example-image-b","example-image-c"}}

% drawing the actual life wheel is as simple as
\begin{tikzpicture}[font=\Large,scale=1]
\LifeWeel{A/10,B/10,C/10,D/10,E/10,F/10,G/10,H/10}
\end{tikzpicture}%
~\begin{tikzpicture}[font=\Large,scale=0.5,transform shape]
\LifeWeel{A/10,B/10,C/10,D/10,E/10,F/10,G/10,H/10}
\end{tikzpicture}
\end{document}

enter image description here

  • 1
    thank so much. in my above post is linked to old topic that use your code. thanks – latexforti Mar 23 at 18:55
  • 1
    @latexforti Yes, but this worked with none of the \LifeWheel versions. This is because these texts are passed to decorations.text. So what you can do is to say \LifeWeel{{|\small| AAA AAA}/10,B/10,C/10,D/10,E/10,F/10,G/10,H/10}, where the notation |\small| is the one that is appropriate to decorations.text. Probably \small is too small and you want to do something like \LifeWeel{{|\fontsize{16}{16}\selectfont| AAA AAA}/10,B/10,C/10,D/10,E/10,F/10,G/10,H/10},. – marmot Mar 23 at 19:31
6

Like this – when I changed scale=1 to scale=0.5? (I changed to a4paper so to have more space for big figures.)

\documentclass{article}
\usepackage[a4paper,landscape,left=1.0cm,right=0.3cm,top=0.5cm,bottom=0.5cm]{geometry}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{decorations.text,shadings}
\renewcommand*\familydefault{\sfdefault} % Set font to serif family
% smuggling from https://tex.stackexchange.com/a/470979/121799
\newcounter{smuggle}
\DeclareRobustCommand\smuggleone[1]{%
  \stepcounter{smuggle}%
  \expandafter\global\expandafter\let\csname smuggle@\arabic{smuggle}\endcsname#1%
  \aftergroup\let\aftergroup#1\expandafter\aftergroup\csname smuggle@\arabic{smuggle}\endcsname
}
\DeclareRobustCommand\smuggle[2][1]{%
  \smuggleone{#2}%
  \ifnum#1>1
    \aftergroup\smuggle\aftergroup[\expandafter\aftergroup\the\numexpr#1-1\aftergroup]\aftergroup#2%
  \fi
}
\begin{document}

    \begin{tikzpicture}[
        % Environment Cfg
        font=\Large,
        scale=0.5,
        % Styles
    ]
\tikzset{life wheel/.cd,
radius/.initial=10,
outer image radius/.initial=0.5,
inner image radius/.initial=1,
outer image parameters/.initial={width=1.25cm},
inner image parameters/.initial={width=2.5cm},
Separator/.style={thick, color=black!50},
Border/.style={line width=1pt,color=red!60,shading=color wheel},
colors/.initial={}
}    
% lifeweel from many codes arround TEX.SE
%Variables: 1:images, 2:image 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
\newcommand\LifeWeel[3][]{%
\def\imglst{{#2}}
\tikzset{life wheel/.cd,#1}
\edef\LstColors{\pgfkeysvalueof{/tikz/life wheel/colors}}
\edef\NumColors{0}
\foreach \X [count=\Y starting from 1] in \LstColors
{\edef\NumColors{\Y}
\smuggle[2]{\NumColors}}
\foreach \X [count=\Y starting from 0] in {#2}
{\edef\NumImages{\Y}
\smuggle[2]{\NumImages}}
\foreach \X [count=\Y] in {#3}
{\edef\NumFeatures{\Y}
\smuggle[2]{\NumFeatures}}
%Drawing the border
\draw[life wheel/Border] (0,0) circle [radius=\pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
\ifnum\NumColors>1
\foreach \m [count=\i] in {1,...,\NumFeatures}{
\pgfmathtruncatemacro{\myi}{mod(\i-1,\NumColors)}
\pgfmathsetmacro{\mycolor}{{\LstColors}[\myi]}
\draw[life wheel/Separator,top color=\mycolor!75!black,
bottom color=\mycolor,shading angle={-90+(360/\NumFeatures)*(\i-0.5)}] (0,0) -- (360/\NumFeatures*\i:\pgfkeysvalueof{/tikz/life wheel/radius})
arc({(360/\NumFeatures)*\i}:{(360/\NumFeatures)*(\i-1)}:\pgfkeysvalueof{/tikz/life wheel/radius})
-- cycle;}
\else
\foreach \m [count=\i] in {0,1,...,\NumFeatures}{
\draw[life wheel/Separator] (0,0) -- (360/\NumFeatures*\i:\pgfkeysvalueof{/tikz/life wheel/radius});}
\fi

%Drawing the names
    \foreach \o/\p [count=\j] in {#3}{
        \pgfmathtruncatemacro{\myint}{ifthenelse(sin(360/\NumFeatures*\j)<0,-1,1)} 
        \ifnum\myint<0% True
        \path[%Reverse
            decoration={
                raise = -0.4ex,
                text  along path,
                text = {|\huge|\o},
                text align = center,
                reverse path
            },
            decorate
        ]
        (360/\NumFeatures*\j:\pgfkeysvalueof{/tikz/life wheel/radius}+0.7) arc (360/\NumFeatures*\j:360/\NumFeatures*(\j-1):\pgfkeysvalueof{/tikz/life wheel/radius}+0.7);%\path
        \else%False
        \path[%Normal
            decoration={
                raise = -0.8ex,
                text  along path,
                text = {|\huge|\o},
                text align = center
                },
            decorate
        ]
        (360/\NumFeatures*\j:\pgfkeysvalueof{/tikz/life wheel/radius}+0.35) arc (360/\NumFeatures*\j:360/\NumFeatures*(\j-1):\pgfkeysvalueof{/tikz/life wheel/radius}+0.35); %Path
        \fi
    \foreach \X in {1,...,\NumImages}
    {\pgfmathsetmacro{\tmp}{360/\NumFeatures*\j+((1-2*\X)/(2*\NumImages))*360/\NumFeatures}
    \pgfmathsetmacro{\imgname}{\imglst[\X]}
    \begin{scope}
     \clip (\tmp:{\pgfkeysvalueof{/tikz/life
     wheel/radius}-1.1*\pgfkeysvalueof{/tikz/life wheel/outer image radius}}) 
     circle[radius=\pgfkeysvalueof{/tikz/life wheel/outer image radius}];
     \node[rotate={\tmp-\myint*90}] at 
     (\tmp:{\pgfkeysvalueof{/tikz/life wheel/radius}-1.1*\pgfkeysvalueof{/tikz/life wheel/outer image radius}})   
     {\edef\temp{\noexpand\includegraphics[\pgfkeysvalueof{/tikz/life wheel/outer image parameters}]{\imgname}}
     \temp};    
    \end{scope}
    }
}
\begin{scope}
    \pgfmathsetmacro{\imgname}{\imglst[0]}
    \clip (0,0) circle[radius=\pgfkeysvalueof{/tikz/life wheel/inner image radius}];
    \node at (0,0)
    {\edef\temp{\noexpand\includegraphics[\pgfkeysvalueof{/tikz/life wheel/inner image parameters}]{\imgname}}
     \temp}; 
\end{scope}
}


% This function draws the lifeweel
%\LifeWeel{figures}{list of features in the form feature_name/quantity}
\LifeWeel[radius=5,outer image radius=0.4,%
colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-a","example-image-a","example-image-b","example-image-c"}{%
        A/10,
        B/10,
        C/10,
        D/10,
        E/10,
        F/10,
        G/10,
        H/10}
        \end{tikzpicture} \begin{tikzpicture}[
        % Environment Cfg
        font=\Large,
        scale=1,
        % Styles
    ]
\tikzset{life wheel/.cd,
radius/.initial=10,
outer image radius/.initial=0.5,
inner image radius/.initial=1,
outer image parameters/.initial={width=1.25cm},
inner image parameters/.initial={width=2.5cm},
Separator/.style={thick, color=black!50},
Border/.style={line width=1pt,color=red!60,shading=color wheel},
colors/.initial={}
}    
% lifeweel from many codes arround TEX.SE
%Variables: 1:images, 2:image 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
\newcommand\LifeWeel[3][]{%
\def\imglst{{#2}}
\tikzset{life wheel/.cd,#1}
\edef\LstColors{\pgfkeysvalueof{/tikz/life wheel/colors}}
\edef\NumColors{0}
\foreach \X [count=\Y starting from 1] in \LstColors
{\edef\NumColors{\Y}
\smuggle[2]{\NumColors}}
\foreach \X [count=\Y starting from 0] in {#2}
{\edef\NumImages{\Y}
\smuggle[2]{\NumImages}}
\foreach \X [count=\Y] in {#3}
{\edef\NumFeatures{\Y}
\smuggle[2]{\NumFeatures}}
%Drawing the border
\draw[life wheel/Border] (0,0) circle [radius=\pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
\ifnum\NumColors>1
\foreach \m [count=\i] in {1,...,\NumFeatures}{
\pgfmathtruncatemacro{\myi}{mod(\i-1,\NumColors)}
\pgfmathsetmacro{\mycolor}{{\LstColors}[\myi]}
\draw[life wheel/Separator,top color=\mycolor!75!black,
bottom color=\mycolor,shading angle={-90+(360/\NumFeatures)*(\i-0.5)}] (0,0) -- (360/\NumFeatures*\i:\pgfkeysvalueof{/tikz/life wheel/radius})
arc({(360/\NumFeatures)*\i}:{(360/\NumFeatures)*(\i-1)}:\pgfkeysvalueof{/tikz/life wheel/radius})
-- cycle;}
\else
\foreach \m [count=\i] in {0,1,...,\NumFeatures}{
\draw[life wheel/Separator] (0,0) -- (360/\NumFeatures*\i:\pgfkeysvalueof{/tikz/life wheel/radius});}
\fi

%Drawing the names
    \foreach \o/\p [count=\j] in {#3}{
        \pgfmathtruncatemacro{\myint}{ifthenelse(sin(360/\NumFeatures*\j)<0,-1,1)} 
        \ifnum\myint<0% True
        \path[%Reverse
            decoration={
                raise = -0.4ex,
                text  along path,
                text = {|\huge|\o},
                text align = center,
                reverse path
            },
            decorate
        ]
        (360/\NumFeatures*\j:\pgfkeysvalueof{/tikz/life wheel/radius}+0.7) arc (360/\NumFeatures*\j:360/\NumFeatures*(\j-1):\pgfkeysvalueof{/tikz/life wheel/radius}+0.7);%\path
        \else%False
        \path[%Normal
            decoration={
                raise = -0.8ex,
                text  along path,
                text = {|\huge|\o},
                text align = center
                },
            decorate
        ]
        (360/\NumFeatures*\j:\pgfkeysvalueof{/tikz/life wheel/radius}+0.35) arc (360/\NumFeatures*\j:360/\NumFeatures*(\j-1):\pgfkeysvalueof{/tikz/life wheel/radius}+0.35); %Path
        \fi
    \foreach \X in {1,...,\NumImages}
    {\pgfmathsetmacro{\tmp}{360/\NumFeatures*\j+((1-2*\X)/(2*\NumImages))*360/\NumFeatures}
    \pgfmathsetmacro{\imgname}{\imglst[\X]}
    \begin{scope}
     \clip (\tmp:{\pgfkeysvalueof{/tikz/life
     wheel/radius}-1.1*\pgfkeysvalueof{/tikz/life wheel/outer image radius}}) 
     circle[radius=\pgfkeysvalueof{/tikz/life wheel/outer image radius}];
     \node[rotate={\tmp-\myint*90}] at 
     (\tmp:{\pgfkeysvalueof{/tikz/life wheel/radius}-1.1*\pgfkeysvalueof{/tikz/life wheel/outer image radius}})   
     {\edef\temp{\noexpand\includegraphics[\pgfkeysvalueof{/tikz/life wheel/outer image parameters}]{\imgname}}
     \temp};    
    \end{scope}
    }
}
\begin{scope}
    \pgfmathsetmacro{\imgname}{\imglst[0]}
    \clip (0,0) circle[radius=\pgfkeysvalueof{/tikz/life wheel/inner image radius}];
    \node at (0,0)
    {\edef\temp{\noexpand\includegraphics[\pgfkeysvalueof{/tikz/life wheel/inner image parameters}]{\imgname}}
     \temp}; 
\end{scope}
}


% This function draws the lifeweel
%\LifeWeel{figures}{list of features in the form feature_name/quantity}
\LifeWeel[radius=5,outer image radius=0.4,%
colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-a","example-image-a","example-image-b","example-image-c"}{%
        A/10,
        B/10,
        C/10,
        D/10,
        E/10,
        F/10,
        G/10,
        H/10}
        \end{tikzpicture}

\end{document}

enter image description here


Hmm, the text size of the smaller figure is not good. I think \scalebox is better

\documentclass{article}
\usepackage[a4paper,landscape,left=1.0cm,right=0.3cm,top=0.5cm,bottom=0.5cm]{geometry}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{decorations.text,shadings}
\renewcommand*\familydefault{\sfdefault} % Set font to serif family
% smuggling from https://tex.stackexchange.com/a/470979/121799
\newcounter{smuggle}
\DeclareRobustCommand\smuggleone[1]{%
  \stepcounter{smuggle}%
  \expandafter\global\expandafter\let\csname smuggle@\arabic{smuggle}\endcsname#1%
  \aftergroup\let\aftergroup#1\expandafter\aftergroup\csname smuggle@\arabic{smuggle}\endcsname
}
\DeclareRobustCommand\smuggle[2][1]{%
  \smuggleone{#2}%
  \ifnum#1>1
    \aftergroup\smuggle\aftergroup[\expandafter\aftergroup\the\numexpr#1-1\aftergroup]\aftergroup#2%
  \fi
}
\begin{document}

    \scalebox{0.5}{\begin{tikzpicture}[
        % Environment Cfg
        font=\Large,
        scale=1,
        % Styles
    ]
\tikzset{life wheel/.cd,
radius/.initial=10,
outer image radius/.initial=0.5,
inner image radius/.initial=1,
outer image parameters/.initial={width=1.25cm},
inner image parameters/.initial={width=2.5cm},
Separator/.style={thick, color=black!50},
Border/.style={line width=1pt,color=red!60,shading=color wheel},
colors/.initial={}
}    
% lifeweel from many codes arround TEX.SE
%Variables: 1:images, 2:image 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
\newcommand\LifeWeel[3][]{%
\def\imglst{{#2}}
\tikzset{life wheel/.cd,#1}
\edef\LstColors{\pgfkeysvalueof{/tikz/life wheel/colors}}
\edef\NumColors{0}
\foreach \X [count=\Y starting from 1] in \LstColors
{\edef\NumColors{\Y}
\smuggle[2]{\NumColors}}
\foreach \X [count=\Y starting from 0] in {#2}
{\edef\NumImages{\Y}
\smuggle[2]{\NumImages}}
\foreach \X [count=\Y] in {#3}
{\edef\NumFeatures{\Y}
\smuggle[2]{\NumFeatures}}
%Drawing the border
\draw[life wheel/Border] (0,0) circle [radius=\pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
\ifnum\NumColors>1
\foreach \m [count=\i] in {1,...,\NumFeatures}{
\pgfmathtruncatemacro{\myi}{mod(\i-1,\NumColors)}
\pgfmathsetmacro{\mycolor}{{\LstColors}[\myi]}
\draw[life wheel/Separator,top color=\mycolor!75!black,
bottom color=\mycolor,shading angle={-90+(360/\NumFeatures)*(\i-0.5)}] (0,0) -- (360/\NumFeatures*\i:\pgfkeysvalueof{/tikz/life wheel/radius})
arc({(360/\NumFeatures)*\i}:{(360/\NumFeatures)*(\i-1)}:\pgfkeysvalueof{/tikz/life wheel/radius})
-- cycle;}
\else
\foreach \m [count=\i] in {0,1,...,\NumFeatures}{
\draw[life wheel/Separator] (0,0) -- (360/\NumFeatures*\i:\pgfkeysvalueof{/tikz/life wheel/radius});}
\fi

%Drawing the names
    \foreach \o/\p [count=\j] in {#3}{
        \pgfmathtruncatemacro{\myint}{ifthenelse(sin(360/\NumFeatures*\j)<0,-1,1)} 
        \ifnum\myint<0% True
        \path[%Reverse
            decoration={
                raise = -0.4ex,
                text  along path,
                text = {|\huge|\o},
                text align = center,
                reverse path
            },
            decorate
        ]
        (360/\NumFeatures*\j:\pgfkeysvalueof{/tikz/life wheel/radius}+0.7) arc (360/\NumFeatures*\j:360/\NumFeatures*(\j-1):\pgfkeysvalueof{/tikz/life wheel/radius}+0.7);%\path
        \else%False
        \path[%Normal
            decoration={
                raise = -0.8ex,
                text  along path,
                text = {|\huge|\o},
                text align = center
                },
            decorate
        ]
        (360/\NumFeatures*\j:\pgfkeysvalueof{/tikz/life wheel/radius}+0.35) arc (360/\NumFeatures*\j:360/\NumFeatures*(\j-1):\pgfkeysvalueof{/tikz/life wheel/radius}+0.35); %Path
        \fi
    \foreach \X in {1,...,\NumImages}
    {\pgfmathsetmacro{\tmp}{360/\NumFeatures*\j+((1-2*\X)/(2*\NumImages))*360/\NumFeatures}
    \pgfmathsetmacro{\imgname}{\imglst[\X]}
    \begin{scope}
     \clip (\tmp:{\pgfkeysvalueof{/tikz/life
     wheel/radius}-1.1*\pgfkeysvalueof{/tikz/life wheel/outer image radius}}) 
     circle[radius=\pgfkeysvalueof{/tikz/life wheel/outer image radius}];
     \node[rotate={\tmp-\myint*90}] at 
     (\tmp:{\pgfkeysvalueof{/tikz/life wheel/radius}-1.1*\pgfkeysvalueof{/tikz/life wheel/outer image radius}})   
     {\edef\temp{\noexpand\includegraphics[\pgfkeysvalueof{/tikz/life wheel/outer image parameters}]{\imgname}}
     \temp};    
    \end{scope}
    }
}
\begin{scope}
    \pgfmathsetmacro{\imgname}{\imglst[0]}
    \clip (0,0) circle[radius=\pgfkeysvalueof{/tikz/life wheel/inner image radius}];
    \node at (0,0)
    {\edef\temp{\noexpand\includegraphics[\pgfkeysvalueof{/tikz/life wheel/inner image parameters}]{\imgname}}
     \temp}; 
\end{scope}
}


% This function draws the lifeweel
%\LifeWeel{figures}{list of features in the form feature_name/quantity}
\LifeWeel[radius=5,outer image radius=0.4,%
colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-a","example-image-a","example-image-b","example-image-c"}{%
        A/10,
        B/10,
        C/10,
        D/10,
        E/10,
        F/10,
        G/10,
        H/10}
        \end{tikzpicture}} \begin{tikzpicture}[
        % Environment Cfg
        font=\Large,
        scale=1,
        % Styles
    ]
\tikzset{life wheel/.cd,
radius/.initial=10,
outer image radius/.initial=0.5,
inner image radius/.initial=1,
outer image parameters/.initial={width=1.25cm},
inner image parameters/.initial={width=2.5cm},
Separator/.style={thick, color=black!50},
Border/.style={line width=1pt,color=red!60,shading=color wheel},
colors/.initial={}
}    
% lifeweel from many codes arround TEX.SE
%Variables: 1:images, 2:image 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
\newcommand\LifeWeel[3][]{%
\def\imglst{{#2}}
\tikzset{life wheel/.cd,#1}
\edef\LstColors{\pgfkeysvalueof{/tikz/life wheel/colors}}
\edef\NumColors{0}
\foreach \X [count=\Y starting from 1] in \LstColors
{\edef\NumColors{\Y}
\smuggle[2]{\NumColors}}
\foreach \X [count=\Y starting from 0] in {#2}
{\edef\NumImages{\Y}
\smuggle[2]{\NumImages}}
\foreach \X [count=\Y] in {#3}
{\edef\NumFeatures{\Y}
\smuggle[2]{\NumFeatures}}
%Drawing the border
\draw[life wheel/Border] (0,0) circle [radius=\pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
\ifnum\NumColors>1
\foreach \m [count=\i] in {1,...,\NumFeatures}{
\pgfmathtruncatemacro{\myi}{mod(\i-1,\NumColors)}
\pgfmathsetmacro{\mycolor}{{\LstColors}[\myi]}
\draw[life wheel/Separator,top color=\mycolor!75!black,
bottom color=\mycolor,shading angle={-90+(360/\NumFeatures)*(\i-0.5)}] (0,0) -- (360/\NumFeatures*\i:\pgfkeysvalueof{/tikz/life wheel/radius})
arc({(360/\NumFeatures)*\i}:{(360/\NumFeatures)*(\i-1)}:\pgfkeysvalueof{/tikz/life wheel/radius})
-- cycle;}
\else
\foreach \m [count=\i] in {0,1,...,\NumFeatures}{
\draw[life wheel/Separator] (0,0) -- (360/\NumFeatures*\i:\pgfkeysvalueof{/tikz/life wheel/radius});}
\fi

%Drawing the names
    \foreach \o/\p [count=\j] in {#3}{
        \pgfmathtruncatemacro{\myint}{ifthenelse(sin(360/\NumFeatures*\j)<0,-1,1)} 
        \ifnum\myint<0% True
        \path[%Reverse
            decoration={
                raise = -0.4ex,
                text  along path,
                text = {|\huge|\o},
                text align = center,
                reverse path
            },
            decorate
        ]
        (360/\NumFeatures*\j:\pgfkeysvalueof{/tikz/life wheel/radius}+0.7) arc (360/\NumFeatures*\j:360/\NumFeatures*(\j-1):\pgfkeysvalueof{/tikz/life wheel/radius}+0.7);%\path
        \else%False
        \path[%Normal
            decoration={
                raise = -0.8ex,
                text  along path,
                text = {|\huge|\o},
                text align = center
                },
            decorate
        ]
        (360/\NumFeatures*\j:\pgfkeysvalueof{/tikz/life wheel/radius}+0.35) arc (360/\NumFeatures*\j:360/\NumFeatures*(\j-1):\pgfkeysvalueof{/tikz/life wheel/radius}+0.35); %Path
        \fi
    \foreach \X in {1,...,\NumImages}
    {\pgfmathsetmacro{\tmp}{360/\NumFeatures*\j+((1-2*\X)/(2*\NumImages))*360/\NumFeatures}
    \pgfmathsetmacro{\imgname}{\imglst[\X]}
    \begin{scope}
     \clip (\tmp:{\pgfkeysvalueof{/tikz/life
     wheel/radius}-1.1*\pgfkeysvalueof{/tikz/life wheel/outer image radius}}) 
     circle[radius=\pgfkeysvalueof{/tikz/life wheel/outer image radius}];
     \node[rotate={\tmp-\myint*90}] at 
     (\tmp:{\pgfkeysvalueof{/tikz/life wheel/radius}-1.1*\pgfkeysvalueof{/tikz/life wheel/outer image radius}})   
     {\edef\temp{\noexpand\includegraphics[\pgfkeysvalueof{/tikz/life wheel/outer image parameters}]{\imgname}}
     \temp};    
    \end{scope}
    }
}
\begin{scope}
    \pgfmathsetmacro{\imgname}{\imglst[0]}
    \clip (0,0) circle[radius=\pgfkeysvalueof{/tikz/life wheel/inner image radius}];
    \node at (0,0)
    {\edef\temp{\noexpand\includegraphics[\pgfkeysvalueof{/tikz/life wheel/inner image parameters}]{\imgname}}
     \temp}; 
\end{scope}
}


% This function draws the lifeweel
%\LifeWeel{figures}{list of features in the form feature_name/quantity}
\LifeWeel[radius=5,outer image radius=0.4,%
colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-a","example-image-a","example-image-b","example-image-c"}{%
        A/10,
        B/10,
        C/10,
        D/10,
        E/10,
        F/10,
        G/10,
        H/10}
        \end{tikzpicture}

\end{document}

enter image description here


In case you need a macro

\documentclass{article}
\usepackage[a4paper,landscape,left=1.0cm,right=0.3cm,top=0.5cm,bottom=0.5cm]{geometry}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{decorations.text,shadings}
\renewcommand*\familydefault{\sfdefault} % Set font to serif family
% smuggling from https://tex.stackexchange.com/a/470979/121799
\newcounter{smuggle}
\DeclareRobustCommand\smuggleone[1]{%
  \stepcounter{smuggle}%
  \expandafter\global\expandafter\let\csname smuggle@\arabic{smuggle}\endcsname#1%
  \aftergroup\let\aftergroup#1\expandafter\aftergroup\csname smuggle@\arabic{smuggle}\endcsname
}
\DeclareRobustCommand\smuggle[2][1]{%
  \smuggleone{#2}%
  \ifnum#1>1
    \aftergroup\smuggle\aftergroup[\expandafter\aftergroup\the\numexpr#1-1\aftergroup]\aftergroup#2%
  \fi
}

\newcommand\LifeWeel[3][]{%
    \def\imglst{{#2}}
    \tikzset{life wheel/.cd,#1}
    \edef\LstColors{\pgfkeysvalueof{/tikz/life wheel/colors}}
    \edef\NumColors{0}
    \foreach \X [count=\Y starting from 1] in \LstColors {%
        \edef\NumColors{\Y}
        \smuggle[2]{\NumColors}}
    \foreach \X [count=\Y starting from 0] in {#2} {%
        \edef\NumImages{\Y}
        \smuggle[2]{\NumImages}}
    \foreach \X [count=\Y] in {#3} {%
        \edef\NumFeatures{\Y}
        \smuggle[2]{\NumFeatures}}
    %Drawing the border
    \draw[life wheel/Border] (0,0) circle [radius=\pgfkeysvalueof{/tikz/life wheel/radius}];
    %Drawing features separations.
    \ifnum\NumColors>1
        \foreach \m [count=\i] in {1,...,\NumFeatures}{
            \pgfmathtruncatemacro{\myi}{mod(\i-1,\NumColors)}
            \pgfmathsetmacro{\mycolor}{{\LstColors}[\myi]}
            \draw[life wheel/Separator,top color=\mycolor!75!black,
                bottom color=\mycolor,shading angle={-90+(360/\NumFeatures)*(\i-0.5)}] (0,0) -- (360/\NumFeatures*\i:\pgfkeysvalueof{/tikz/life wheel/radius})
                arc({(360/\NumFeatures)*\i}:{(360/\NumFeatures)*(\i-1)}:\pgfkeysvalueof{/tikz/life wheel/radius})
            -- cycle;}
    \else
        \foreach \m [count=\i] in {0,1,...,\NumFeatures}{
            \draw[life wheel/Separator] (0,0) -- (360/\NumFeatures*\i:\pgfkeysvalueof{/tikz/life wheel/radius});}
    \fi

%Drawing the names
    \foreach \o/\p [count=\j] in {#3}{
        \pgfmathtruncatemacro{\myint}{ifthenelse(sin(360/\NumFeatures*\j)<0,-1,1)} 
        \ifnum\myint<0% True
        \path[%Reverse
            decoration={
                raise = -0.4ex,
                text  along path,
                text = {|\huge|\o},
                text align = center,
                reverse path
            },
            decorate
        ]
        (360/\NumFeatures*\j:\pgfkeysvalueof{/tikz/life wheel/radius}+0.7) arc (360/\NumFeatures*\j:360/\NumFeatures*(\j-1):\pgfkeysvalueof{/tikz/life wheel/radius}+0.7);%\path
        \else%False
        \path[%Normal
            decoration={
                raise = -0.8ex,
                text  along path,
                text = {|\huge|\o},
                text align = center
                },
            decorate
        ]
        (360/\NumFeatures*\j:\pgfkeysvalueof{/tikz/life wheel/radius}+0.35) arc (360/\NumFeatures*\j:360/\NumFeatures*(\j-1):\pgfkeysvalueof{/tikz/life wheel/radius}+0.35); %Path
        \fi
    \foreach \X in {1,...,\NumImages}
    {\pgfmathsetmacro{\tmp}{360/\NumFeatures*\j+((1-2*\X)/(2*\NumImages))*360/\NumFeatures}
    \pgfmathsetmacro{\imgname}{\imglst[\X]}
    \begin{scope}
     \clip (\tmp:{\pgfkeysvalueof{/tikz/life
     wheel/radius}-1.1*\pgfkeysvalueof{/tikz/life wheel/outer image radius}}) 
     circle[radius=\pgfkeysvalueof{/tikz/life wheel/outer image radius}];
     \node[rotate={\tmp-\myint*90}] at 
     (\tmp:{\pgfkeysvalueof{/tikz/life wheel/radius}-1.1*\pgfkeysvalueof{/tikz/life wheel/outer image radius}})   
     {\edef\temp{\noexpand\includegraphics[\pgfkeysvalueof{/tikz/life wheel/outer image parameters}]{\imgname}}
     \temp};    
    \end{scope}
    }
}
\begin{scope}
    \pgfmathsetmacro{\imgname}{\imglst[0]}
    \clip (0,0) circle[radius=\pgfkeysvalueof{/tikz/life wheel/inner image radius}];
    \node at (0,0)
    {\edef\temp{\noexpand\includegraphics[\pgfkeysvalueof{/tikz/life wheel/inner image parameters}]{\imgname}}
     \temp}; 
\end{scope}
}

%%%%%%%%%%%%%%%%
\newcommand{\yourcmd}[4]{%
    \scalebox{#1}{\begin{tikzpicture}[
        % Environment Cfg
        font=\Large,
        scale=1,
        % Styles
    ]
\tikzset{life wheel/.cd,
radius/.initial=10,
outer image radius/.initial=0.5,
inner image radius/.initial=1,
outer image parameters/.initial={width=1.25cm},
inner image parameters/.initial={width=2.5cm},
Separator/.style={thick, color=black!50},
Border/.style={line width=1pt,color=red!60,shading=color wheel},
colors/.initial={}
}    
\LifeWeel[#2]{#3}{#4}
\end{tikzpicture}}
}
\begin{document}

\yourcmd
    {0.5}
    {radius=5,outer image radius=0.4,colors={"red","blue","magenta","purple","orange","green"}}
    {"example-image-a","example-image-a","example-image-b","example-image-c"}
    {A/10,B/10,C/10,D/10,E/10,F/10,G/10,H/10}

\yourcmd
    {1}
    {radius=5,outer image radius=0.4,colors={"red","blue","magenta","purple","orange","green"}}
    {"example-image-a","example-image-a","example-image-b","example-image-c"}
    {A/10,B/10,C/10,D/10,E/10,F/10,G/10,H/10}

\end{document}

enter image description here

  • thank so much. Can you edit and definition this wheel before begin{document} and in body you can call this definition and scale...if i copy and create 10 wheels in body so the code is very long,thanks – latexforti Mar 23 at 14:18
  • 1
    @latexforti See my edited answer. – JouleV Mar 23 at 14:35
  • 3
    The purpose of all that \tikzset stuff is precisely that you do not have to carry it around. You could (at least) simplify your command to \newcommand{\yourcmd}[4]{% \scalebox{#1}{\begin{tikzpicture}[font=\Large,scale=1] \LifeWeel[#2]{#3}{#4}\end{tikzpicture}} } and say \tikzset{life wheel/.cd, ...} only once. – marmot Mar 23 at 15:36

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.