copy and scale one figure (wheel)
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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
tikz-pgf
add a comment |
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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
tikz-pgf
add a comment |
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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
tikz-pgf
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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
tikz-pgf
tikz-pgf
edited Mar 23 at 14:10
latexforti
asked Mar 23 at 14:05
latexfortilatexforti
4347
4347
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
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,
- I moved the list of images also to the pgf keys, and
- made the
decorations.text
susceptible to the scale of the ambienttikzpicture
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[2]{%pgfkeys{/tikz/life wheel/img list=#2}%defimglst{{#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
edefimglst{pgfkeysvalueof{/tikz/life wheel/img list}}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in imglst
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#2}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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 theLifeWheel
versions. This is because these texts are passed todecorations.text
. So what you can do is to sayLifeWeel{{|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 todecorations.text
. Probablysmall
is too small and you want to do something likeLifeWeel{{|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
add a comment |
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]aftergroup#2%
fi
}
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors {%
edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2} {%
edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3} {%
edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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 thattikzset
stuff is precisely that you do not have to carry it around. You could (at least) simplify your command tonewcommand{yourcmd}[4]{% scalebox{#1}{begin{tikzpicture}[font=Large,scale=1] LifeWeel[#2]{#3}{#4}end{tikzpicture}} }
and saytikzset{life wheel/.cd, ...}
only once.
– marmot
Mar 23 at 15:36
add a comment |
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f481071%2fcopy-and-scale-one-figure-wheel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
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,
- I moved the list of images also to the pgf keys, and
- made the
decorations.text
susceptible to the scale of the ambienttikzpicture
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[2]{%pgfkeys{/tikz/life wheel/img list=#2}%defimglst{{#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
edefimglst{pgfkeysvalueof{/tikz/life wheel/img list}}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in imglst
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#2}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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 theLifeWheel
versions. This is because these texts are passed todecorations.text
. So what you can do is to sayLifeWeel{{|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 todecorations.text
. Probablysmall
is too small and you want to do something likeLifeWeel{{|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
add a comment |
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,
- I moved the list of images also to the pgf keys, and
- made the
decorations.text
susceptible to the scale of the ambienttikzpicture
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[2]{%pgfkeys{/tikz/life wheel/img list=#2}%defimglst{{#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
edefimglst{pgfkeysvalueof{/tikz/life wheel/img list}}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in imglst
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#2}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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 theLifeWheel
versions. This is because these texts are passed todecorations.text
. So what you can do is to sayLifeWeel{{|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 todecorations.text
. Probablysmall
is too small and you want to do something likeLifeWeel{{|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
add a comment |
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,
- I moved the list of images also to the pgf keys, and
- made the
decorations.text
susceptible to the scale of the ambienttikzpicture
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[2]{%pgfkeys{/tikz/life wheel/img list=#2}%defimglst{{#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
edefimglst{pgfkeysvalueof{/tikz/life wheel/img list}}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in imglst
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#2}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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,
- I moved the list of images also to the pgf keys, and
- made the
decorations.text
susceptible to the scale of the ambienttikzpicture
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[2]{%pgfkeys{/tikz/life wheel/img list=#2}%defimglst{{#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
edefimglst{pgfkeysvalueof{/tikz/life wheel/img list}}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in imglst
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#2}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
answered Mar 23 at 18:34
marmotmarmot
113k5145275
113k5145275
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 theLifeWheel
versions. This is because these texts are passed todecorations.text
. So what you can do is to sayLifeWeel{{|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 todecorations.text
. Probablysmall
is too small and you want to do something likeLifeWeel{{|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
add a comment |
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 theLifeWheel
versions. This is because these texts are passed todecorations.text
. So what you can do is to sayLifeWeel{{|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 todecorations.text
. Probablysmall
is too small and you want to do something likeLifeWeel{{|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
1
1
thank so much. in my above post is linked to old topic that use your code. thanks
– latexforti
Mar 23 at 18:55
thank so much. in my above post is linked to old topic that use your code. thanks
– latexforti
Mar 23 at 18:55
1
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
@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
add a comment |
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]aftergroup#2%
fi
}
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors {%
edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2} {%
edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3} {%
edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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 thattikzset
stuff is precisely that you do not have to carry it around. You could (at least) simplify your command tonewcommand{yourcmd}[4]{% scalebox{#1}{begin{tikzpicture}[font=Large,scale=1] LifeWeel[#2]{#3}{#4}end{tikzpicture}} }
and saytikzset{life wheel/.cd, ...}
only once.
– marmot
Mar 23 at 15:36
add a comment |
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]aftergroup#2%
fi
}
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors {%
edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2} {%
edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3} {%
edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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 thattikzset
stuff is precisely that you do not have to carry it around. You could (at least) simplify your command tonewcommand{yourcmd}[4]{% scalebox{#1}{begin{tikzpicture}[font=Large,scale=1] LifeWeel[#2]{#3}{#4}end{tikzpicture}} }
and saytikzset{life wheel/.cd, ...}
only once.
– marmot
Mar 23 at 15:36
add a comment |
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]aftergroup#2%
fi
}
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors {%
edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2} {%
edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3} {%
edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors
{edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2}
{edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3}
{edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
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}
DeclareRobustCommandsmuggleone[1]{%
stepcounter{smuggle}%
expandafterglobalexpandafterletcsname smuggle@arabic{smuggle}endcsname#1%
aftergroupletaftergroup#1expandafteraftergroupcsname smuggle@arabic{smuggle}endcsname
}
DeclareRobustCommandsmuggle[2][1]{%
smuggleone{#2}%
ifnum#1>1
aftergroupsmuggleaftergroup[expandafteraftergroupthenumexpr#1-1aftergroup]aftergroup#2%
fi
}
newcommandLifeWeel[3]{%
defimglst{{#2}}
tikzset{life wheel/.cd,#1}
edefLstColors{pgfkeysvalueof{/tikz/life wheel/colors}}
edefNumColors{0}
foreach X [count=Y starting from 1] in LstColors {%
edefNumColors{Y}
smuggle[2]{NumColors}}
foreach X [count=Y starting from 0] in {#2} {%
edefNumImages{Y}
smuggle[2]{NumImages}}
foreach X [count=Y] in {#3} {%
edefNumFeatures{Y}
smuggle[2]{NumFeatures}}
%Drawing the border
draw[life wheel/Border] (0,0) circle [radius=pgfkeysvalueof{/tikz/life wheel/radius}];
%Drawing features separations.
ifnumNumColors>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)}
ifnummyint<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}})
{edeftemp{noexpandincludegraphics[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)
{edeftemp{noexpandincludegraphics[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}
edited Mar 23 at 14:35
answered Mar 23 at 14:14
JouleVJouleV
9,39322256
9,39322256
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 thattikzset
stuff is precisely that you do not have to carry it around. You could (at least) simplify your command tonewcommand{yourcmd}[4]{% scalebox{#1}{begin{tikzpicture}[font=Large,scale=1] LifeWeel[#2]{#3}{#4}end{tikzpicture}} }
and saytikzset{life wheel/.cd, ...}
only once.
– marmot
Mar 23 at 15:36
add a comment |
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 thattikzset
stuff is precisely that you do not have to carry it around. You could (at least) simplify your command tonewcommand{yourcmd}[4]{% scalebox{#1}{begin{tikzpicture}[font=Large,scale=1] LifeWeel[#2]{#3}{#4}end{tikzpicture}} }
and saytikzset{life wheel/.cd, ...}
only once.
– marmot
Mar 23 at 15:36
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
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
1
@latexforti See my edited answer.
– JouleV
Mar 23 at 14:35
@latexforti See my edited answer.
– JouleV
Mar 23 at 14:35
3
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
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
add a comment |
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f481071%2fcopy-and-scale-one-figure-wheel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown