复制并缩放一个图形(车轮)

复制并缩放一个图形(车轮)

我想继续之前的帖子:定制色轮

这个最小代码:

\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}

我如何复制和缩放此轮子(变大/变小)并将副本与其他图像/文本放在同一页中?谢谢

答案1

当我写的时候我的生命之轮答案,你在这里使用但没有链接到,我这样做正是为了消除大量参数赞成使用 pgf 键。唯一没有移至 pgf 键的是图像列表和文本。除此之外,没有什么可以阻止您使用\LifeWheel带有最少参数的命令,您可以在 pgf 键中设置所有默认值。

为了进一步简化问题,

  1. 我还把图像列表移到了 pgf 键,然后
  2. 使其decorations.text容易受到周围环境的影响tikzpicture,否则,焦耳 V 指出,这些文本无法正确缩放。

通过这些改变,绘制一个简单的生命轮可以归结为

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

但我强调,在此之前,您需要做的就是添加图形列表,因此命令不会太长。通过上述更改,现在可以正确缩放,即您可以执行类似

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

设置默认值非常简单,只需说

\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"}}

我要说的是,虽然 没有什么错\scalebox,但我不太喜欢它,例如这里了解更多详情。当然,如果您绝对确定以后不想访问这些节点,那就没问题。

\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}

在此处输入图片描述

答案2

像这样 - 当我改为scale=1scale=0.5(我改为a4paper以便有更多空间容纳大数字。)

\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}

在此处输入图片描述


嗯,小图的文字大小不太好。我觉得\scalebox比较好

\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}

在此处输入图片描述


如果你需要宏

\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}

在此处输入图片描述

相关内容