custom colour wheel
I saw the "draw wheel code" in post:
Draw Life Wheel
and now I want to change something:
8 different colour for each segment and gradient fill.
insert 3 icons in each segment.
insert one image in the center of the wheel.
This is the changed code
% arara: pdflatex: {synctex: yes, action: nonstopmode}
% By J. Leon V. Share as Beerware philosophy
documentclass[border=20pt]{standalone}
usepackage{xcolor}
usepackage{tikz}
usepackage{pgfmath}
usepackage{xifthen}
usetikzlibrary{decorations.text, arrows.meta,calc,shadows.blur,shadings}
renewcommand*familydefault{sfdefault} % Set font to serif family
begin{document}
begin{tikzpicture}[
% Environment Cfg
font=Large,
scale=1,
% Styles
Grid/.style={
loosely dotted,
line width=1.5pt,
color=black
},
Separator/.style={
thick,
color=black!50
},
Border/.style={
line width=1pt,
color=red!60
},
Border2/.style={
line width=2pt,
color=red!60
},
Fill/.style={
fill=black,
opacity=0.1
}
]
% lifeweel from many codes arround TEX.SE
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
deflifeweel#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Decoration
foreach n in {0,#2,...,#1}{
draw[fill=black, opacity=0.1] (0,0) circle [radius=n];}
%Drawing the grid and numbers.
foreach n in {0,#2,...,#1}{
draw[Grid] (0,0) circle [radius=n];
node[anchor=#5] (A) at (#6:n+0.2){n};}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{ pgfmathresult >180}
{% True
path[%Reverse
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center,
reverse path
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7);%path
}
{%False
path[%Normal
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7); %Path
}
draw[Border2]
(360/#3*j:p) coordinate (#8aj)
arc (360/#3*j:360/#3*(j-1):p) coordinate (#8bj);
draw[fill=red, opacity=0.2]
(0,0) -- (360/#3*j:p) arc (360/#3*j:360/#3*(j-1):p);
}
pgfmathparse{int(#3+1)} % Principle of uroboro
coordinate (#8bpgfmathresult) at (#8b1);
foreach o/p [count=i, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ai) -- (#8bx);}
end{scope}
}
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8: ID
deflifeweelS#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Drawing the numbers.
foreach n [count=m] in {0,#2,...,#1}{
node[anchor=#5] (A) at (#6:n+0.2){n};
}
%Drawing the grid
foreach n in {0,#2,...,#1}{
foreach [count=i, evaluate=i as x using int(i+1)]m in {0,1,...,#3}{
draw[Grid](360/#3*i:n) -- (360/#3*x:n);
draw[Fill](360/#3*i:n) -- (0,0) -- (360/#3*x:n);
}
}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[fill=black, opacity=0.1] (0,0) circle [radius=#1];
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j from 0] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{pgfmathresult =90 OR pgfmathresult =270}
{%True
draw (360/#3*j:#1+0.7) node [anchor=center]{hugeo};
}
{%false
ifthenelse{pgfmathresult <90 OR pgfmathresult >270}
{% True
draw (360/#3*j:#1+0.7) node [anchor=west]{hugeo};
}
{%False
draw (360/#3*j:#1+0.7) node [anchor=east]{hugeo};
}
}
coordinate (#8cj) at (360/#3*j:p);
}
coordinate (#8c#3) at (#8c0);
foreach o/p [count=i from 0, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ci) -- (#8cx);
draw[fill=red, opacity=.2] (#8ci) --(0,0) -- (#8cx);
}
end{scope}
}
% This function draws the lifeweel
%lifeweel{levels}{grid}{number of features}{feature_name/quantity}[anchor angle][numbers direction in degrees][relative position](ID);
lifeweel{10}{10}{8}{
Money/10,
Entertainment/10,
Romance/10,
Presonal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10
}[45][180](0,0)(1);
end{tikzpicture}
end{document}
tikz-pgf
add a comment |
I saw the "draw wheel code" in post:
Draw Life Wheel
and now I want to change something:
8 different colour for each segment and gradient fill.
insert 3 icons in each segment.
insert one image in the center of the wheel.
This is the changed code
% arara: pdflatex: {synctex: yes, action: nonstopmode}
% By J. Leon V. Share as Beerware philosophy
documentclass[border=20pt]{standalone}
usepackage{xcolor}
usepackage{tikz}
usepackage{pgfmath}
usepackage{xifthen}
usetikzlibrary{decorations.text, arrows.meta,calc,shadows.blur,shadings}
renewcommand*familydefault{sfdefault} % Set font to serif family
begin{document}
begin{tikzpicture}[
% Environment Cfg
font=Large,
scale=1,
% Styles
Grid/.style={
loosely dotted,
line width=1.5pt,
color=black
},
Separator/.style={
thick,
color=black!50
},
Border/.style={
line width=1pt,
color=red!60
},
Border2/.style={
line width=2pt,
color=red!60
},
Fill/.style={
fill=black,
opacity=0.1
}
]
% lifeweel from many codes arround TEX.SE
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
deflifeweel#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Decoration
foreach n in {0,#2,...,#1}{
draw[fill=black, opacity=0.1] (0,0) circle [radius=n];}
%Drawing the grid and numbers.
foreach n in {0,#2,...,#1}{
draw[Grid] (0,0) circle [radius=n];
node[anchor=#5] (A) at (#6:n+0.2){n};}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{ pgfmathresult >180}
{% True
path[%Reverse
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center,
reverse path
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7);%path
}
{%False
path[%Normal
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7); %Path
}
draw[Border2]
(360/#3*j:p) coordinate (#8aj)
arc (360/#3*j:360/#3*(j-1):p) coordinate (#8bj);
draw[fill=red, opacity=0.2]
(0,0) -- (360/#3*j:p) arc (360/#3*j:360/#3*(j-1):p);
}
pgfmathparse{int(#3+1)} % Principle of uroboro
coordinate (#8bpgfmathresult) at (#8b1);
foreach o/p [count=i, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ai) -- (#8bx);}
end{scope}
}
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8: ID
deflifeweelS#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Drawing the numbers.
foreach n [count=m] in {0,#2,...,#1}{
node[anchor=#5] (A) at (#6:n+0.2){n};
}
%Drawing the grid
foreach n in {0,#2,...,#1}{
foreach [count=i, evaluate=i as x using int(i+1)]m in {0,1,...,#3}{
draw[Grid](360/#3*i:n) -- (360/#3*x:n);
draw[Fill](360/#3*i:n) -- (0,0) -- (360/#3*x:n);
}
}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[fill=black, opacity=0.1] (0,0) circle [radius=#1];
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j from 0] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{pgfmathresult =90 OR pgfmathresult =270}
{%True
draw (360/#3*j:#1+0.7) node [anchor=center]{hugeo};
}
{%false
ifthenelse{pgfmathresult <90 OR pgfmathresult >270}
{% True
draw (360/#3*j:#1+0.7) node [anchor=west]{hugeo};
}
{%False
draw (360/#3*j:#1+0.7) node [anchor=east]{hugeo};
}
}
coordinate (#8cj) at (360/#3*j:p);
}
coordinate (#8c#3) at (#8c0);
foreach o/p [count=i from 0, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ci) -- (#8cx);
draw[fill=red, opacity=.2] (#8ci) --(0,0) -- (#8cx);
}
end{scope}
}
% This function draws the lifeweel
%lifeweel{levels}{grid}{number of features}{feature_name/quantity}[anchor angle][numbers direction in degrees][relative position](ID);
lifeweel{10}{10}{8}{
Money/10,
Entertainment/10,
Romance/10,
Presonal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10
}[45][180](0,0)(1);
end{tikzpicture}
end{document}
tikz-pgf
add a comment |
I saw the "draw wheel code" in post:
Draw Life Wheel
and now I want to change something:
8 different colour for each segment and gradient fill.
insert 3 icons in each segment.
insert one image in the center of the wheel.
This is the changed code
% arara: pdflatex: {synctex: yes, action: nonstopmode}
% By J. Leon V. Share as Beerware philosophy
documentclass[border=20pt]{standalone}
usepackage{xcolor}
usepackage{tikz}
usepackage{pgfmath}
usepackage{xifthen}
usetikzlibrary{decorations.text, arrows.meta,calc,shadows.blur,shadings}
renewcommand*familydefault{sfdefault} % Set font to serif family
begin{document}
begin{tikzpicture}[
% Environment Cfg
font=Large,
scale=1,
% Styles
Grid/.style={
loosely dotted,
line width=1.5pt,
color=black
},
Separator/.style={
thick,
color=black!50
},
Border/.style={
line width=1pt,
color=red!60
},
Border2/.style={
line width=2pt,
color=red!60
},
Fill/.style={
fill=black,
opacity=0.1
}
]
% lifeweel from many codes arround TEX.SE
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
deflifeweel#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Decoration
foreach n in {0,#2,...,#1}{
draw[fill=black, opacity=0.1] (0,0) circle [radius=n];}
%Drawing the grid and numbers.
foreach n in {0,#2,...,#1}{
draw[Grid] (0,0) circle [radius=n];
node[anchor=#5] (A) at (#6:n+0.2){n};}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{ pgfmathresult >180}
{% True
path[%Reverse
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center,
reverse path
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7);%path
}
{%False
path[%Normal
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7); %Path
}
draw[Border2]
(360/#3*j:p) coordinate (#8aj)
arc (360/#3*j:360/#3*(j-1):p) coordinate (#8bj);
draw[fill=red, opacity=0.2]
(0,0) -- (360/#3*j:p) arc (360/#3*j:360/#3*(j-1):p);
}
pgfmathparse{int(#3+1)} % Principle of uroboro
coordinate (#8bpgfmathresult) at (#8b1);
foreach o/p [count=i, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ai) -- (#8bx);}
end{scope}
}
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8: ID
deflifeweelS#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Drawing the numbers.
foreach n [count=m] in {0,#2,...,#1}{
node[anchor=#5] (A) at (#6:n+0.2){n};
}
%Drawing the grid
foreach n in {0,#2,...,#1}{
foreach [count=i, evaluate=i as x using int(i+1)]m in {0,1,...,#3}{
draw[Grid](360/#3*i:n) -- (360/#3*x:n);
draw[Fill](360/#3*i:n) -- (0,0) -- (360/#3*x:n);
}
}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[fill=black, opacity=0.1] (0,0) circle [radius=#1];
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j from 0] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{pgfmathresult =90 OR pgfmathresult =270}
{%True
draw (360/#3*j:#1+0.7) node [anchor=center]{hugeo};
}
{%false
ifthenelse{pgfmathresult <90 OR pgfmathresult >270}
{% True
draw (360/#3*j:#1+0.7) node [anchor=west]{hugeo};
}
{%False
draw (360/#3*j:#1+0.7) node [anchor=east]{hugeo};
}
}
coordinate (#8cj) at (360/#3*j:p);
}
coordinate (#8c#3) at (#8c0);
foreach o/p [count=i from 0, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ci) -- (#8cx);
draw[fill=red, opacity=.2] (#8ci) --(0,0) -- (#8cx);
}
end{scope}
}
% This function draws the lifeweel
%lifeweel{levels}{grid}{number of features}{feature_name/quantity}[anchor angle][numbers direction in degrees][relative position](ID);
lifeweel{10}{10}{8}{
Money/10,
Entertainment/10,
Romance/10,
Presonal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10
}[45][180](0,0)(1);
end{tikzpicture}
end{document}
tikz-pgf
I saw the "draw wheel code" in post:
Draw Life Wheel
and now I want to change something:
8 different colour for each segment and gradient fill.
insert 3 icons in each segment.
insert one image in the center of the wheel.
This is the changed code
% arara: pdflatex: {synctex: yes, action: nonstopmode}
% By J. Leon V. Share as Beerware philosophy
documentclass[border=20pt]{standalone}
usepackage{xcolor}
usepackage{tikz}
usepackage{pgfmath}
usepackage{xifthen}
usetikzlibrary{decorations.text, arrows.meta,calc,shadows.blur,shadings}
renewcommand*familydefault{sfdefault} % Set font to serif family
begin{document}
begin{tikzpicture}[
% Environment Cfg
font=Large,
scale=1,
% Styles
Grid/.style={
loosely dotted,
line width=1.5pt,
color=black
},
Separator/.style={
thick,
color=black!50
},
Border/.style={
line width=1pt,
color=red!60
},
Border2/.style={
line width=2pt,
color=red!60
},
Fill/.style={
fill=black,
opacity=0.1
}
]
% lifeweel from many codes arround TEX.SE
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
deflifeweel#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Decoration
foreach n in {0,#2,...,#1}{
draw[fill=black, opacity=0.1] (0,0) circle [radius=n];}
%Drawing the grid and numbers.
foreach n in {0,#2,...,#1}{
draw[Grid] (0,0) circle [radius=n];
node[anchor=#5] (A) at (#6:n+0.2){n};}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{ pgfmathresult >180}
{% True
path[%Reverse
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center,
reverse path
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7);%path
}
{%False
path[%Normal
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7); %Path
}
draw[Border2]
(360/#3*j:p) coordinate (#8aj)
arc (360/#3*j:360/#3*(j-1):p) coordinate (#8bj);
draw[fill=red, opacity=0.2]
(0,0) -- (360/#3*j:p) arc (360/#3*j:360/#3*(j-1):p);
}
pgfmathparse{int(#3+1)} % Principle of uroboro
coordinate (#8bpgfmathresult) at (#8b1);
foreach o/p [count=i, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ai) -- (#8bx);}
end{scope}
}
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8: ID
deflifeweelS#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Drawing the numbers.
foreach n [count=m] in {0,#2,...,#1}{
node[anchor=#5] (A) at (#6:n+0.2){n};
}
%Drawing the grid
foreach n in {0,#2,...,#1}{
foreach [count=i, evaluate=i as x using int(i+1)]m in {0,1,...,#3}{
draw[Grid](360/#3*i:n) -- (360/#3*x:n);
draw[Fill](360/#3*i:n) -- (0,0) -- (360/#3*x:n);
}
}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[fill=black, opacity=0.1] (0,0) circle [radius=#1];
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j from 0] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{pgfmathresult =90 OR pgfmathresult =270}
{%True
draw (360/#3*j:#1+0.7) node [anchor=center]{hugeo};
}
{%false
ifthenelse{pgfmathresult <90 OR pgfmathresult >270}
{% True
draw (360/#3*j:#1+0.7) node [anchor=west]{hugeo};
}
{%False
draw (360/#3*j:#1+0.7) node [anchor=east]{hugeo};
}
}
coordinate (#8cj) at (360/#3*j:p);
}
coordinate (#8c#3) at (#8c0);
foreach o/p [count=i from 0, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ci) -- (#8cx);
draw[fill=red, opacity=.2] (#8ci) --(0,0) -- (#8cx);
}
end{scope}
}
% This function draws the lifeweel
%lifeweel{levels}{grid}{number of features}{feature_name/quantity}[anchor angle][numbers direction in degrees][relative position](ID);
lifeweel{10}{10}{8}{
Money/10,
Entertainment/10,
Romance/10,
Presonal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10
}[45][180](0,0)(1);
end{tikzpicture}
end{document}
tikz-pgf
tikz-pgf
edited Feb 7 at 15:11
user180639
2048
2048
asked Feb 7 at 14:38
tisaigontisaigon
1357
1357
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Different background color and gradient fill are from this answer.
Center imaging is from my recently answer, using pullquote
environment.
And the whole code is as follow:
documentclass[border=20pt]{standalone}
usepackage{xcolor}
usepackage{tikz,pgf,xparse}
usepackage{pgfmath}
usepackage{xifthen}
usetikzlibrary{decorations.text, arrows.meta,calc,shadows.blur,shadings}
renewcommand*familydefault{sfdefault} % Set font to serif family
%%%%%%%%%%%%%%%%% FOR COLOR TRANSITION %%%%%%%%%%%%%%%%%%%%%%%
newcommand{vardonut}[1]{
newcounter{num}
foreach content/size/colour in {#1}
stepcounter{num};
foreach content/size/colour [count=i] in {#1}{
draw[white,very thick,top color=colour!50!black, bottom color=colour, shading angle={-90+360/thenum/2+(i-1)*360/thenum}]
({2*cos((i-1)*360/thenum)},{2*sin((i-1)*360/thenum)}) arc[radius = 2, start angle={(i-1)*360/thenum}, delta angle=360/thenum] --
({(2+size)*cos(i*360/thenum)},{(2+size)*sin(i*360/thenum)}) arc[radius = {2+size}, start angle={i*360/thenum}, delta angle=-360/thenum] --
cycle;
% node[white,font=large] at ({(i-1)*360/thenum+360/thenum/2}:{size/2+2}) {content};
}
}
%%%%%%%%%%%%%%%%%%%%%END OF COLOR TRANSITION %%%%%%%%%%%%%%%%%%%
begin{document}
begin{tikzpicture}[
% Environment Cfg
font=Large,
scale=1,
% Styles
Grid/.style={
loosely dotted,
line width=1.5pt,
color=black
},
Separator/.style={
thick,
color=black!50
},
Border/.style={
line width=1pt,
color=red!60
},
Border2/.style={
line width=2pt,
color=red!60
},
Fill/.style={
fill=black,
opacity=0.1
}
]
% lifeweel from many codes arround TEX.SE
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
deflifeweel#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Decoration
foreach n in {0,#2,...,#1}{
draw[fill=black, opacity=0.1] (0,0) circle [radius=n];}
%Drawing the grid and numbers.
foreach n in {0,#2,...,#1}{
draw[Grid] (0,0) circle [radius=n];
node[anchor=#5] (A) at (#6:n+0.2){n};}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{ pgfmathresult >180}
{% True
path[%Reverse
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center,
reverse path
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7);%path
}
{%False
path[%Normal
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7); %Path
}
draw[Border2]
(360/#3*j:p) coordinate (#8aj)
arc (360/#3*j:360/#3*(j-1):p) coordinate (#8bj);
draw[fill=red, opacity=0.2]
(0,0) -- (360/#3*j:p) arc (360/#3*j:360/#3*(j-1):p);
}
pgfmathparse{int(#3+1)} % Principle of uroboro
coordinate (#8bpgfmathresult) at (#8b1);
foreach o/p [count=i, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ai) -- (#8bx);}
end{scope}
}
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8: ID
deflifeweelS#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Drawing the numbers.
foreach n [count=m] in {0,#2,...,#1}{
node[anchor=#5] (A) at (#6:n+0.2){n};
}
%Drawing the grid
foreach n in {0,#2,...,#1}{
foreach [count=i, evaluate=i as x using int(i+1)]m in {0,1,...,#3}{
draw[Grid](360/#3*i:n) -- (360/#3*x:n);
draw[Fill](360/#3*i:n) -- (0,0) -- (360/#3*x:n);
}
}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[fill=black, opacity=0.1] (0,0) circle [radius=#1];
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j from 0] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{pgfmathresult =90 OR pgfmathresult =270}
{%True
draw (360/#3*j:#1+0.7) node [anchor=center]{hugeo};
}
{%false
ifthenelse{pgfmathresult <90 OR pgfmathresult >270}
{% True
draw (360/#3*j:#1+0.7) node [anchor=west]{hugeo};
}
{%False
draw (360/#3*j:#1+0.7) node [anchor=east]{hugeo};
}
}
coordinate (#8cj) at (360/#3*j:p);
}
coordinate (#8c#3) at (#8c0);
foreach o/p [count=i from 0, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ci) -- (#8cx);
draw[fill=red, opacity=.2] (#8ci) --(0,0) -- (#8cx);
}
end{scope}
}
% This function draws the lifeweel
%lifeweel{levels}{grid}{number of features}{feature_name/quantity}[anchor angle][numbers direction in degrees][relative position](ID);
lifeweel{10}{10}{8}{
Money/10,
Entertainment/10,
Romance/10,
Presonal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10
}[45][180](0,0)(1);
ColourTransitionCircle[inner=0,outer=8,angle=40]{red,yellow,blue,blue,green}
draw (0,0)circle (8);
tikzset{
d1/.pic={
foreach t in {10,55,100,145,190,235,280,325} {
draw[fill, red,thick] (t:9) circle (0.5cm);
}
}
}
tikzset{
d2/.pic={
foreach t in {22.5,67.5,112.5,157.5,202.5,247.5,292.5,337.5} {
draw[fill, blue,thick] (t:9) circle (0.5cm);
}
}
}
tikzset{
d3/.pic={
foreach t in {35,80,125,170,215,260,305,350} {
draw[fill,orange,thick] (t:9) circle (0.5cm);
}
}
}
tikzset{
d4/.pic={node[circle,draw,minimum size=5cm,
text=white,
path picture={
node at (path picture bounding box.center){
includegraphics[scale=1]{example-image-a}
};
}]{};}
}
pic at (0,0) {d1};
pic at (0,0) {d2};
pic at (0,0) {d3};
pic at (0,0) {d4};
end{tikzpicture}
end{document}
and the output is:
add a comment |
Just for fun. An attempt to "reinvent the wheel". The purpose of this exercise is not to answer the question, i.e. I think the tick should go to ferahfeza's nice answer. The purpose here is to
- eliminate redundancies. E.g. the number of features is already determined by the number of entries of the feature list.
- making things more TikZy. Instead of defining a command with 8 arguments it might be more appropriate to focus on the relevant data only, and to store all the parameters in pgf keys. This has also the advantage that, if someone else is to customize this, something like
pgfkeysvalueof{/tikz/life wheel/radius}
may be easier to interpret than#1
, say. And it is easy to add more possibilities without changing the syntax of the command. - remove unnecessary packages. There is no need to load
xifthen
, TikZ allows on to distinguish all the cases with built in features. (Andusepackage{pgfmath}
does not have to be loaded.)
This answer cooks the command down to
LifeWeel[radius=9,outer image radius=0.8,%
colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-duck","example-image-a","example-image-b","example-image-c"}{%
Money/10,
Entertainment/10,
Romance/10,
Personal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10}
where the first argument is the list of the graphics that is to be included (the first one is the one in the middle), and the second argument is the list of features. Everything else can be controlled by options that are passed as zeroth argument.
documentclass[border=20pt]{standalone}
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=1,
inner image radius/.initial=2,
outer image parameters/.initial={width=2.5cm},
inner image parameters/.initial={width=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.8ex,
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.7) arc (360/NumFeatures*j:360/NumFeatures*(j-1):pgfkeysvalueof{/tikz/life wheel/radius}+0.7); %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=9,outer image radius=0.8,%
colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-duck","example-image-a","example-image-b","example-image-c"}{%
Money/10,
Entertainment/10,
Romance/10,
Personal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10}
end{tikzpicture}
end{document}
If you leave the color list out, i.e. do
LifeWeel[radius=9,outer image radius=0.8,%
%colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-duck","example-image-a","example-image-b","example-image-c"}{%
Money/10,
Entertainment/10,
Romance/10,
Personal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10}
what I originally thought the question was about
1
@Raaja Good point. (I focused on making the thingy more easy to customize in my update. The sheer number of arguments drove me almost crazy.) (The problem with inserting nicer images is that either one has to blow up the code because one draws them with TikZ, or include graphics that not everyone has on their machines.)
– marmot
Feb 7 at 19:16
1
I will try to plug in Falcons in the morn (CET;-)
). Lets see how far I go :D
– Raaja
Feb 7 at 19:20
1
@Raaja As long no duck nor marmot gets harmed, I'm fine with it. ;-)
– marmot
Feb 7 at 19:21
1
we will see :D I will post it in the chat (if I succeed ;D)
– Raaja
Feb 7 at 19:22
1
@tisaigon E.g.LifeWeel[radius=9,outer image radius=0.8]{"/Image/Wheelimage/wheel01.jpg","/Image/Wheelimage/wheel02.jpg","/Image/Wheelimage/wheel03.jpg","/Image/Wheelimage/wheel04.jpg"}{...
One can rewrite the code to take an arbitrary number of pictures or generalize it even further.
– marmot
Feb 8 at 1:25
|
show 14 more comments
Your Answer
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%2f473774%2fcustom-colour-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
Different background color and gradient fill are from this answer.
Center imaging is from my recently answer, using pullquote
environment.
And the whole code is as follow:
documentclass[border=20pt]{standalone}
usepackage{xcolor}
usepackage{tikz,pgf,xparse}
usepackage{pgfmath}
usepackage{xifthen}
usetikzlibrary{decorations.text, arrows.meta,calc,shadows.blur,shadings}
renewcommand*familydefault{sfdefault} % Set font to serif family
%%%%%%%%%%%%%%%%% FOR COLOR TRANSITION %%%%%%%%%%%%%%%%%%%%%%%
newcommand{vardonut}[1]{
newcounter{num}
foreach content/size/colour in {#1}
stepcounter{num};
foreach content/size/colour [count=i] in {#1}{
draw[white,very thick,top color=colour!50!black, bottom color=colour, shading angle={-90+360/thenum/2+(i-1)*360/thenum}]
({2*cos((i-1)*360/thenum)},{2*sin((i-1)*360/thenum)}) arc[radius = 2, start angle={(i-1)*360/thenum}, delta angle=360/thenum] --
({(2+size)*cos(i*360/thenum)},{(2+size)*sin(i*360/thenum)}) arc[radius = {2+size}, start angle={i*360/thenum}, delta angle=-360/thenum] --
cycle;
% node[white,font=large] at ({(i-1)*360/thenum+360/thenum/2}:{size/2+2}) {content};
}
}
%%%%%%%%%%%%%%%%%%%%%END OF COLOR TRANSITION %%%%%%%%%%%%%%%%%%%
begin{document}
begin{tikzpicture}[
% Environment Cfg
font=Large,
scale=1,
% Styles
Grid/.style={
loosely dotted,
line width=1.5pt,
color=black
},
Separator/.style={
thick,
color=black!50
},
Border/.style={
line width=1pt,
color=red!60
},
Border2/.style={
line width=2pt,
color=red!60
},
Fill/.style={
fill=black,
opacity=0.1
}
]
% lifeweel from many codes arround TEX.SE
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
deflifeweel#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Decoration
foreach n in {0,#2,...,#1}{
draw[fill=black, opacity=0.1] (0,0) circle [radius=n];}
%Drawing the grid and numbers.
foreach n in {0,#2,...,#1}{
draw[Grid] (0,0) circle [radius=n];
node[anchor=#5] (A) at (#6:n+0.2){n};}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{ pgfmathresult >180}
{% True
path[%Reverse
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center,
reverse path
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7);%path
}
{%False
path[%Normal
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7); %Path
}
draw[Border2]
(360/#3*j:p) coordinate (#8aj)
arc (360/#3*j:360/#3*(j-1):p) coordinate (#8bj);
draw[fill=red, opacity=0.2]
(0,0) -- (360/#3*j:p) arc (360/#3*j:360/#3*(j-1):p);
}
pgfmathparse{int(#3+1)} % Principle of uroboro
coordinate (#8bpgfmathresult) at (#8b1);
foreach o/p [count=i, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ai) -- (#8bx);}
end{scope}
}
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8: ID
deflifeweelS#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Drawing the numbers.
foreach n [count=m] in {0,#2,...,#1}{
node[anchor=#5] (A) at (#6:n+0.2){n};
}
%Drawing the grid
foreach n in {0,#2,...,#1}{
foreach [count=i, evaluate=i as x using int(i+1)]m in {0,1,...,#3}{
draw[Grid](360/#3*i:n) -- (360/#3*x:n);
draw[Fill](360/#3*i:n) -- (0,0) -- (360/#3*x:n);
}
}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[fill=black, opacity=0.1] (0,0) circle [radius=#1];
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j from 0] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{pgfmathresult =90 OR pgfmathresult =270}
{%True
draw (360/#3*j:#1+0.7) node [anchor=center]{hugeo};
}
{%false
ifthenelse{pgfmathresult <90 OR pgfmathresult >270}
{% True
draw (360/#3*j:#1+0.7) node [anchor=west]{hugeo};
}
{%False
draw (360/#3*j:#1+0.7) node [anchor=east]{hugeo};
}
}
coordinate (#8cj) at (360/#3*j:p);
}
coordinate (#8c#3) at (#8c0);
foreach o/p [count=i from 0, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ci) -- (#8cx);
draw[fill=red, opacity=.2] (#8ci) --(0,0) -- (#8cx);
}
end{scope}
}
% This function draws the lifeweel
%lifeweel{levels}{grid}{number of features}{feature_name/quantity}[anchor angle][numbers direction in degrees][relative position](ID);
lifeweel{10}{10}{8}{
Money/10,
Entertainment/10,
Romance/10,
Presonal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10
}[45][180](0,0)(1);
ColourTransitionCircle[inner=0,outer=8,angle=40]{red,yellow,blue,blue,green}
draw (0,0)circle (8);
tikzset{
d1/.pic={
foreach t in {10,55,100,145,190,235,280,325} {
draw[fill, red,thick] (t:9) circle (0.5cm);
}
}
}
tikzset{
d2/.pic={
foreach t in {22.5,67.5,112.5,157.5,202.5,247.5,292.5,337.5} {
draw[fill, blue,thick] (t:9) circle (0.5cm);
}
}
}
tikzset{
d3/.pic={
foreach t in {35,80,125,170,215,260,305,350} {
draw[fill,orange,thick] (t:9) circle (0.5cm);
}
}
}
tikzset{
d4/.pic={node[circle,draw,minimum size=5cm,
text=white,
path picture={
node at (path picture bounding box.center){
includegraphics[scale=1]{example-image-a}
};
}]{};}
}
pic at (0,0) {d1};
pic at (0,0) {d2};
pic at (0,0) {d3};
pic at (0,0) {d4};
end{tikzpicture}
end{document}
and the output is:
add a comment |
Different background color and gradient fill are from this answer.
Center imaging is from my recently answer, using pullquote
environment.
And the whole code is as follow:
documentclass[border=20pt]{standalone}
usepackage{xcolor}
usepackage{tikz,pgf,xparse}
usepackage{pgfmath}
usepackage{xifthen}
usetikzlibrary{decorations.text, arrows.meta,calc,shadows.blur,shadings}
renewcommand*familydefault{sfdefault} % Set font to serif family
%%%%%%%%%%%%%%%%% FOR COLOR TRANSITION %%%%%%%%%%%%%%%%%%%%%%%
newcommand{vardonut}[1]{
newcounter{num}
foreach content/size/colour in {#1}
stepcounter{num};
foreach content/size/colour [count=i] in {#1}{
draw[white,very thick,top color=colour!50!black, bottom color=colour, shading angle={-90+360/thenum/2+(i-1)*360/thenum}]
({2*cos((i-1)*360/thenum)},{2*sin((i-1)*360/thenum)}) arc[radius = 2, start angle={(i-1)*360/thenum}, delta angle=360/thenum] --
({(2+size)*cos(i*360/thenum)},{(2+size)*sin(i*360/thenum)}) arc[radius = {2+size}, start angle={i*360/thenum}, delta angle=-360/thenum] --
cycle;
% node[white,font=large] at ({(i-1)*360/thenum+360/thenum/2}:{size/2+2}) {content};
}
}
%%%%%%%%%%%%%%%%%%%%%END OF COLOR TRANSITION %%%%%%%%%%%%%%%%%%%
begin{document}
begin{tikzpicture}[
% Environment Cfg
font=Large,
scale=1,
% Styles
Grid/.style={
loosely dotted,
line width=1.5pt,
color=black
},
Separator/.style={
thick,
color=black!50
},
Border/.style={
line width=1pt,
color=red!60
},
Border2/.style={
line width=2pt,
color=red!60
},
Fill/.style={
fill=black,
opacity=0.1
}
]
% lifeweel from many codes arround TEX.SE
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
deflifeweel#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Decoration
foreach n in {0,#2,...,#1}{
draw[fill=black, opacity=0.1] (0,0) circle [radius=n];}
%Drawing the grid and numbers.
foreach n in {0,#2,...,#1}{
draw[Grid] (0,0) circle [radius=n];
node[anchor=#5] (A) at (#6:n+0.2){n};}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{ pgfmathresult >180}
{% True
path[%Reverse
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center,
reverse path
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7);%path
}
{%False
path[%Normal
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7); %Path
}
draw[Border2]
(360/#3*j:p) coordinate (#8aj)
arc (360/#3*j:360/#3*(j-1):p) coordinate (#8bj);
draw[fill=red, opacity=0.2]
(0,0) -- (360/#3*j:p) arc (360/#3*j:360/#3*(j-1):p);
}
pgfmathparse{int(#3+1)} % Principle of uroboro
coordinate (#8bpgfmathresult) at (#8b1);
foreach o/p [count=i, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ai) -- (#8bx);}
end{scope}
}
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8: ID
deflifeweelS#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Drawing the numbers.
foreach n [count=m] in {0,#2,...,#1}{
node[anchor=#5] (A) at (#6:n+0.2){n};
}
%Drawing the grid
foreach n in {0,#2,...,#1}{
foreach [count=i, evaluate=i as x using int(i+1)]m in {0,1,...,#3}{
draw[Grid](360/#3*i:n) -- (360/#3*x:n);
draw[Fill](360/#3*i:n) -- (0,0) -- (360/#3*x:n);
}
}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[fill=black, opacity=0.1] (0,0) circle [radius=#1];
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j from 0] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{pgfmathresult =90 OR pgfmathresult =270}
{%True
draw (360/#3*j:#1+0.7) node [anchor=center]{hugeo};
}
{%false
ifthenelse{pgfmathresult <90 OR pgfmathresult >270}
{% True
draw (360/#3*j:#1+0.7) node [anchor=west]{hugeo};
}
{%False
draw (360/#3*j:#1+0.7) node [anchor=east]{hugeo};
}
}
coordinate (#8cj) at (360/#3*j:p);
}
coordinate (#8c#3) at (#8c0);
foreach o/p [count=i from 0, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ci) -- (#8cx);
draw[fill=red, opacity=.2] (#8ci) --(0,0) -- (#8cx);
}
end{scope}
}
% This function draws the lifeweel
%lifeweel{levels}{grid}{number of features}{feature_name/quantity}[anchor angle][numbers direction in degrees][relative position](ID);
lifeweel{10}{10}{8}{
Money/10,
Entertainment/10,
Romance/10,
Presonal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10
}[45][180](0,0)(1);
ColourTransitionCircle[inner=0,outer=8,angle=40]{red,yellow,blue,blue,green}
draw (0,0)circle (8);
tikzset{
d1/.pic={
foreach t in {10,55,100,145,190,235,280,325} {
draw[fill, red,thick] (t:9) circle (0.5cm);
}
}
}
tikzset{
d2/.pic={
foreach t in {22.5,67.5,112.5,157.5,202.5,247.5,292.5,337.5} {
draw[fill, blue,thick] (t:9) circle (0.5cm);
}
}
}
tikzset{
d3/.pic={
foreach t in {35,80,125,170,215,260,305,350} {
draw[fill,orange,thick] (t:9) circle (0.5cm);
}
}
}
tikzset{
d4/.pic={node[circle,draw,minimum size=5cm,
text=white,
path picture={
node at (path picture bounding box.center){
includegraphics[scale=1]{example-image-a}
};
}]{};}
}
pic at (0,0) {d1};
pic at (0,0) {d2};
pic at (0,0) {d3};
pic at (0,0) {d4};
end{tikzpicture}
end{document}
and the output is:
add a comment |
Different background color and gradient fill are from this answer.
Center imaging is from my recently answer, using pullquote
environment.
And the whole code is as follow:
documentclass[border=20pt]{standalone}
usepackage{xcolor}
usepackage{tikz,pgf,xparse}
usepackage{pgfmath}
usepackage{xifthen}
usetikzlibrary{decorations.text, arrows.meta,calc,shadows.blur,shadings}
renewcommand*familydefault{sfdefault} % Set font to serif family
%%%%%%%%%%%%%%%%% FOR COLOR TRANSITION %%%%%%%%%%%%%%%%%%%%%%%
newcommand{vardonut}[1]{
newcounter{num}
foreach content/size/colour in {#1}
stepcounter{num};
foreach content/size/colour [count=i] in {#1}{
draw[white,very thick,top color=colour!50!black, bottom color=colour, shading angle={-90+360/thenum/2+(i-1)*360/thenum}]
({2*cos((i-1)*360/thenum)},{2*sin((i-1)*360/thenum)}) arc[radius = 2, start angle={(i-1)*360/thenum}, delta angle=360/thenum] --
({(2+size)*cos(i*360/thenum)},{(2+size)*sin(i*360/thenum)}) arc[radius = {2+size}, start angle={i*360/thenum}, delta angle=-360/thenum] --
cycle;
% node[white,font=large] at ({(i-1)*360/thenum+360/thenum/2}:{size/2+2}) {content};
}
}
%%%%%%%%%%%%%%%%%%%%%END OF COLOR TRANSITION %%%%%%%%%%%%%%%%%%%
begin{document}
begin{tikzpicture}[
% Environment Cfg
font=Large,
scale=1,
% Styles
Grid/.style={
loosely dotted,
line width=1.5pt,
color=black
},
Separator/.style={
thick,
color=black!50
},
Border/.style={
line width=1pt,
color=red!60
},
Border2/.style={
line width=2pt,
color=red!60
},
Fill/.style={
fill=black,
opacity=0.1
}
]
% lifeweel from many codes arround TEX.SE
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
deflifeweel#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Decoration
foreach n in {0,#2,...,#1}{
draw[fill=black, opacity=0.1] (0,0) circle [radius=n];}
%Drawing the grid and numbers.
foreach n in {0,#2,...,#1}{
draw[Grid] (0,0) circle [radius=n];
node[anchor=#5] (A) at (#6:n+0.2){n};}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{ pgfmathresult >180}
{% True
path[%Reverse
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center,
reverse path
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7);%path
}
{%False
path[%Normal
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7); %Path
}
draw[Border2]
(360/#3*j:p) coordinate (#8aj)
arc (360/#3*j:360/#3*(j-1):p) coordinate (#8bj);
draw[fill=red, opacity=0.2]
(0,0) -- (360/#3*j:p) arc (360/#3*j:360/#3*(j-1):p);
}
pgfmathparse{int(#3+1)} % Principle of uroboro
coordinate (#8bpgfmathresult) at (#8b1);
foreach o/p [count=i, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ai) -- (#8bx);}
end{scope}
}
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8: ID
deflifeweelS#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Drawing the numbers.
foreach n [count=m] in {0,#2,...,#1}{
node[anchor=#5] (A) at (#6:n+0.2){n};
}
%Drawing the grid
foreach n in {0,#2,...,#1}{
foreach [count=i, evaluate=i as x using int(i+1)]m in {0,1,...,#3}{
draw[Grid](360/#3*i:n) -- (360/#3*x:n);
draw[Fill](360/#3*i:n) -- (0,0) -- (360/#3*x:n);
}
}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[fill=black, opacity=0.1] (0,0) circle [radius=#1];
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j from 0] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{pgfmathresult =90 OR pgfmathresult =270}
{%True
draw (360/#3*j:#1+0.7) node [anchor=center]{hugeo};
}
{%false
ifthenelse{pgfmathresult <90 OR pgfmathresult >270}
{% True
draw (360/#3*j:#1+0.7) node [anchor=west]{hugeo};
}
{%False
draw (360/#3*j:#1+0.7) node [anchor=east]{hugeo};
}
}
coordinate (#8cj) at (360/#3*j:p);
}
coordinate (#8c#3) at (#8c0);
foreach o/p [count=i from 0, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ci) -- (#8cx);
draw[fill=red, opacity=.2] (#8ci) --(0,0) -- (#8cx);
}
end{scope}
}
% This function draws the lifeweel
%lifeweel{levels}{grid}{number of features}{feature_name/quantity}[anchor angle][numbers direction in degrees][relative position](ID);
lifeweel{10}{10}{8}{
Money/10,
Entertainment/10,
Romance/10,
Presonal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10
}[45][180](0,0)(1);
ColourTransitionCircle[inner=0,outer=8,angle=40]{red,yellow,blue,blue,green}
draw (0,0)circle (8);
tikzset{
d1/.pic={
foreach t in {10,55,100,145,190,235,280,325} {
draw[fill, red,thick] (t:9) circle (0.5cm);
}
}
}
tikzset{
d2/.pic={
foreach t in {22.5,67.5,112.5,157.5,202.5,247.5,292.5,337.5} {
draw[fill, blue,thick] (t:9) circle (0.5cm);
}
}
}
tikzset{
d3/.pic={
foreach t in {35,80,125,170,215,260,305,350} {
draw[fill,orange,thick] (t:9) circle (0.5cm);
}
}
}
tikzset{
d4/.pic={node[circle,draw,minimum size=5cm,
text=white,
path picture={
node at (path picture bounding box.center){
includegraphics[scale=1]{example-image-a}
};
}]{};}
}
pic at (0,0) {d1};
pic at (0,0) {d2};
pic at (0,0) {d3};
pic at (0,0) {d4};
end{tikzpicture}
end{document}
and the output is:
Different background color and gradient fill are from this answer.
Center imaging is from my recently answer, using pullquote
environment.
And the whole code is as follow:
documentclass[border=20pt]{standalone}
usepackage{xcolor}
usepackage{tikz,pgf,xparse}
usepackage{pgfmath}
usepackage{xifthen}
usetikzlibrary{decorations.text, arrows.meta,calc,shadows.blur,shadings}
renewcommand*familydefault{sfdefault} % Set font to serif family
%%%%%%%%%%%%%%%%% FOR COLOR TRANSITION %%%%%%%%%%%%%%%%%%%%%%%
newcommand{vardonut}[1]{
newcounter{num}
foreach content/size/colour in {#1}
stepcounter{num};
foreach content/size/colour [count=i] in {#1}{
draw[white,very thick,top color=colour!50!black, bottom color=colour, shading angle={-90+360/thenum/2+(i-1)*360/thenum}]
({2*cos((i-1)*360/thenum)},{2*sin((i-1)*360/thenum)}) arc[radius = 2, start angle={(i-1)*360/thenum}, delta angle=360/thenum] --
({(2+size)*cos(i*360/thenum)},{(2+size)*sin(i*360/thenum)}) arc[radius = {2+size}, start angle={i*360/thenum}, delta angle=-360/thenum] --
cycle;
% node[white,font=large] at ({(i-1)*360/thenum+360/thenum/2}:{size/2+2}) {content};
}
}
%%%%%%%%%%%%%%%%%%%%%END OF COLOR TRANSITION %%%%%%%%%%%%%%%%%%%
begin{document}
begin{tikzpicture}[
% Environment Cfg
font=Large,
scale=1,
% Styles
Grid/.style={
loosely dotted,
line width=1.5pt,
color=black
},
Separator/.style={
thick,
color=black!50
},
Border/.style={
line width=1pt,
color=red!60
},
Border2/.style={
line width=2pt,
color=red!60
},
Fill/.style={
fill=black,
opacity=0.1
}
]
% lifeweel from many codes arround TEX.SE
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8:ID
deflifeweel#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Decoration
foreach n in {0,#2,...,#1}{
draw[fill=black, opacity=0.1] (0,0) circle [radius=n];}
%Drawing the grid and numbers.
foreach n in {0,#2,...,#1}{
draw[Grid] (0,0) circle [radius=n];
node[anchor=#5] (A) at (#6:n+0.2){n};}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{ pgfmathresult >180}
{% True
path[%Reverse
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center,
reverse path
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7);%path
}
{%False
path[%Normal
decoration={
raise = -0.8ex,
text along path,
text = {|huge|o},
text align = center
},
decorate
]
(360/#3*j:#1+0.7) arc (360/#3*j:360/#3*(j-1):#1+0.7); %Path
}
draw[Border2]
(360/#3*j:p) coordinate (#8aj)
arc (360/#3*j:360/#3*(j-1):p) coordinate (#8bj);
draw[fill=red, opacity=0.2]
(0,0) -- (360/#3*j:p) arc (360/#3*j:360/#3*(j-1):p);
}
pgfmathparse{int(#3+1)} % Principle of uroboro
coordinate (#8bpgfmathresult) at (#8b1);
foreach o/p [count=i, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ai) -- (#8bx);}
end{scope}
}
%Variables: 1:levels, 2:grid 3:number of features 4: Feature_name/quantity
% 5: anchor aling 6: numbers position 7:Relative position 8: ID
deflifeweelS#1#2#3#4[#5][#6](#7)(#8){%
begin{scope}[shift={(#7)}]
%Drawing the numbers.
foreach n [count=m] in {0,#2,...,#1}{
node[anchor=#5] (A) at (#6:n+0.2){n};
}
%Drawing the grid
foreach n in {0,#2,...,#1}{
foreach [count=i, evaluate=i as x using int(i+1)]m in {0,1,...,#3}{
draw[Grid](360/#3*i:n) -- (360/#3*x:n);
draw[Fill](360/#3*i:n) -- (0,0) -- (360/#3*x:n);
}
}
%Drawing features separations.
foreach m [count=i] in {0,1,...,#3}{
draw[Separator] (0,0) -- (360/#3*i: #1);}
%Drawing the border
draw[fill=black, opacity=0.1] (0,0) circle [radius=#1];
draw[Border] (0,0) circle [radius=#1];
%Drawing the names
foreach o/p [count=j from 0] in {#4}{
pgfmathparse{int(360/#3*j)}
ifthenelse{pgfmathresult =90 OR pgfmathresult =270}
{%True
draw (360/#3*j:#1+0.7) node [anchor=center]{hugeo};
}
{%false
ifthenelse{pgfmathresult <90 OR pgfmathresult >270}
{% True
draw (360/#3*j:#1+0.7) node [anchor=west]{hugeo};
}
{%False
draw (360/#3*j:#1+0.7) node [anchor=east]{hugeo};
}
}
coordinate (#8cj) at (360/#3*j:p);
}
coordinate (#8c#3) at (#8c0);
foreach o/p [count=i from 0, evaluate=i as x using int(i+1)] in {#4}{%Close the perimete
draw[Border2] (#8ci) -- (#8cx);
draw[fill=red, opacity=.2] (#8ci) --(0,0) -- (#8cx);
}
end{scope}
}
% This function draws the lifeweel
%lifeweel{levels}{grid}{number of features}{feature_name/quantity}[anchor angle][numbers direction in degrees][relative position](ID);
lifeweel{10}{10}{8}{
Money/10,
Entertainment/10,
Romance/10,
Presonal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10
}[45][180](0,0)(1);
ColourTransitionCircle[inner=0,outer=8,angle=40]{red,yellow,blue,blue,green}
draw (0,0)circle (8);
tikzset{
d1/.pic={
foreach t in {10,55,100,145,190,235,280,325} {
draw[fill, red,thick] (t:9) circle (0.5cm);
}
}
}
tikzset{
d2/.pic={
foreach t in {22.5,67.5,112.5,157.5,202.5,247.5,292.5,337.5} {
draw[fill, blue,thick] (t:9) circle (0.5cm);
}
}
}
tikzset{
d3/.pic={
foreach t in {35,80,125,170,215,260,305,350} {
draw[fill,orange,thick] (t:9) circle (0.5cm);
}
}
}
tikzset{
d4/.pic={node[circle,draw,minimum size=5cm,
text=white,
path picture={
node at (path picture bounding box.center){
includegraphics[scale=1]{example-image-a}
};
}]{};}
}
pic at (0,0) {d1};
pic at (0,0) {d2};
pic at (0,0) {d3};
pic at (0,0) {d4};
end{tikzpicture}
end{document}
and the output is:
edited Feb 7 at 17:22
answered Feb 7 at 16:43
ferahfezaferahfeza
6,05611932
6,05611932
add a comment |
add a comment |
Just for fun. An attempt to "reinvent the wheel". The purpose of this exercise is not to answer the question, i.e. I think the tick should go to ferahfeza's nice answer. The purpose here is to
- eliminate redundancies. E.g. the number of features is already determined by the number of entries of the feature list.
- making things more TikZy. Instead of defining a command with 8 arguments it might be more appropriate to focus on the relevant data only, and to store all the parameters in pgf keys. This has also the advantage that, if someone else is to customize this, something like
pgfkeysvalueof{/tikz/life wheel/radius}
may be easier to interpret than#1
, say. And it is easy to add more possibilities without changing the syntax of the command. - remove unnecessary packages. There is no need to load
xifthen
, TikZ allows on to distinguish all the cases with built in features. (Andusepackage{pgfmath}
does not have to be loaded.)
This answer cooks the command down to
LifeWeel[radius=9,outer image radius=0.8,%
colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-duck","example-image-a","example-image-b","example-image-c"}{%
Money/10,
Entertainment/10,
Romance/10,
Personal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10}
where the first argument is the list of the graphics that is to be included (the first one is the one in the middle), and the second argument is the list of features. Everything else can be controlled by options that are passed as zeroth argument.
documentclass[border=20pt]{standalone}
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=1,
inner image radius/.initial=2,
outer image parameters/.initial={width=2.5cm},
inner image parameters/.initial={width=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.8ex,
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.7) arc (360/NumFeatures*j:360/NumFeatures*(j-1):pgfkeysvalueof{/tikz/life wheel/radius}+0.7); %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=9,outer image radius=0.8,%
colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-duck","example-image-a","example-image-b","example-image-c"}{%
Money/10,
Entertainment/10,
Romance/10,
Personal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10}
end{tikzpicture}
end{document}
If you leave the color list out, i.e. do
LifeWeel[radius=9,outer image radius=0.8,%
%colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-duck","example-image-a","example-image-b","example-image-c"}{%
Money/10,
Entertainment/10,
Romance/10,
Personal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10}
what I originally thought the question was about
1
@Raaja Good point. (I focused on making the thingy more easy to customize in my update. The sheer number of arguments drove me almost crazy.) (The problem with inserting nicer images is that either one has to blow up the code because one draws them with TikZ, or include graphics that not everyone has on their machines.)
– marmot
Feb 7 at 19:16
1
I will try to plug in Falcons in the morn (CET;-)
). Lets see how far I go :D
– Raaja
Feb 7 at 19:20
1
@Raaja As long no duck nor marmot gets harmed, I'm fine with it. ;-)
– marmot
Feb 7 at 19:21
1
we will see :D I will post it in the chat (if I succeed ;D)
– Raaja
Feb 7 at 19:22
1
@tisaigon E.g.LifeWeel[radius=9,outer image radius=0.8]{"/Image/Wheelimage/wheel01.jpg","/Image/Wheelimage/wheel02.jpg","/Image/Wheelimage/wheel03.jpg","/Image/Wheelimage/wheel04.jpg"}{...
One can rewrite the code to take an arbitrary number of pictures or generalize it even further.
– marmot
Feb 8 at 1:25
|
show 14 more comments
Just for fun. An attempt to "reinvent the wheel". The purpose of this exercise is not to answer the question, i.e. I think the tick should go to ferahfeza's nice answer. The purpose here is to
- eliminate redundancies. E.g. the number of features is already determined by the number of entries of the feature list.
- making things more TikZy. Instead of defining a command with 8 arguments it might be more appropriate to focus on the relevant data only, and to store all the parameters in pgf keys. This has also the advantage that, if someone else is to customize this, something like
pgfkeysvalueof{/tikz/life wheel/radius}
may be easier to interpret than#1
, say. And it is easy to add more possibilities without changing the syntax of the command. - remove unnecessary packages. There is no need to load
xifthen
, TikZ allows on to distinguish all the cases with built in features. (Andusepackage{pgfmath}
does not have to be loaded.)
This answer cooks the command down to
LifeWeel[radius=9,outer image radius=0.8,%
colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-duck","example-image-a","example-image-b","example-image-c"}{%
Money/10,
Entertainment/10,
Romance/10,
Personal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10}
where the first argument is the list of the graphics that is to be included (the first one is the one in the middle), and the second argument is the list of features. Everything else can be controlled by options that are passed as zeroth argument.
documentclass[border=20pt]{standalone}
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=1,
inner image radius/.initial=2,
outer image parameters/.initial={width=2.5cm},
inner image parameters/.initial={width=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.8ex,
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.7) arc (360/NumFeatures*j:360/NumFeatures*(j-1):pgfkeysvalueof{/tikz/life wheel/radius}+0.7); %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=9,outer image radius=0.8,%
colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-duck","example-image-a","example-image-b","example-image-c"}{%
Money/10,
Entertainment/10,
Romance/10,
Personal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10}
end{tikzpicture}
end{document}
If you leave the color list out, i.e. do
LifeWeel[radius=9,outer image radius=0.8,%
%colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-duck","example-image-a","example-image-b","example-image-c"}{%
Money/10,
Entertainment/10,
Romance/10,
Personal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10}
what I originally thought the question was about
1
@Raaja Good point. (I focused on making the thingy more easy to customize in my update. The sheer number of arguments drove me almost crazy.) (The problem with inserting nicer images is that either one has to blow up the code because one draws them with TikZ, or include graphics that not everyone has on their machines.)
– marmot
Feb 7 at 19:16
1
I will try to plug in Falcons in the morn (CET;-)
). Lets see how far I go :D
– Raaja
Feb 7 at 19:20
1
@Raaja As long no duck nor marmot gets harmed, I'm fine with it. ;-)
– marmot
Feb 7 at 19:21
1
we will see :D I will post it in the chat (if I succeed ;D)
– Raaja
Feb 7 at 19:22
1
@tisaigon E.g.LifeWeel[radius=9,outer image radius=0.8]{"/Image/Wheelimage/wheel01.jpg","/Image/Wheelimage/wheel02.jpg","/Image/Wheelimage/wheel03.jpg","/Image/Wheelimage/wheel04.jpg"}{...
One can rewrite the code to take an arbitrary number of pictures or generalize it even further.
– marmot
Feb 8 at 1:25
|
show 14 more comments
Just for fun. An attempt to "reinvent the wheel". The purpose of this exercise is not to answer the question, i.e. I think the tick should go to ferahfeza's nice answer. The purpose here is to
- eliminate redundancies. E.g. the number of features is already determined by the number of entries of the feature list.
- making things more TikZy. Instead of defining a command with 8 arguments it might be more appropriate to focus on the relevant data only, and to store all the parameters in pgf keys. This has also the advantage that, if someone else is to customize this, something like
pgfkeysvalueof{/tikz/life wheel/radius}
may be easier to interpret than#1
, say. And it is easy to add more possibilities without changing the syntax of the command. - remove unnecessary packages. There is no need to load
xifthen
, TikZ allows on to distinguish all the cases with built in features. (Andusepackage{pgfmath}
does not have to be loaded.)
This answer cooks the command down to
LifeWeel[radius=9,outer image radius=0.8,%
colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-duck","example-image-a","example-image-b","example-image-c"}{%
Money/10,
Entertainment/10,
Romance/10,
Personal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10}
where the first argument is the list of the graphics that is to be included (the first one is the one in the middle), and the second argument is the list of features. Everything else can be controlled by options that are passed as zeroth argument.
documentclass[border=20pt]{standalone}
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=1,
inner image radius/.initial=2,
outer image parameters/.initial={width=2.5cm},
inner image parameters/.initial={width=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.8ex,
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.7) arc (360/NumFeatures*j:360/NumFeatures*(j-1):pgfkeysvalueof{/tikz/life wheel/radius}+0.7); %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=9,outer image radius=0.8,%
colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-duck","example-image-a","example-image-b","example-image-c"}{%
Money/10,
Entertainment/10,
Romance/10,
Personal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10}
end{tikzpicture}
end{document}
If you leave the color list out, i.e. do
LifeWeel[radius=9,outer image radius=0.8,%
%colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-duck","example-image-a","example-image-b","example-image-c"}{%
Money/10,
Entertainment/10,
Romance/10,
Personal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10}
what I originally thought the question was about
Just for fun. An attempt to "reinvent the wheel". The purpose of this exercise is not to answer the question, i.e. I think the tick should go to ferahfeza's nice answer. The purpose here is to
- eliminate redundancies. E.g. the number of features is already determined by the number of entries of the feature list.
- making things more TikZy. Instead of defining a command with 8 arguments it might be more appropriate to focus on the relevant data only, and to store all the parameters in pgf keys. This has also the advantage that, if someone else is to customize this, something like
pgfkeysvalueof{/tikz/life wheel/radius}
may be easier to interpret than#1
, say. And it is easy to add more possibilities without changing the syntax of the command. - remove unnecessary packages. There is no need to load
xifthen
, TikZ allows on to distinguish all the cases with built in features. (Andusepackage{pgfmath}
does not have to be loaded.)
This answer cooks the command down to
LifeWeel[radius=9,outer image radius=0.8,%
colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-duck","example-image-a","example-image-b","example-image-c"}{%
Money/10,
Entertainment/10,
Romance/10,
Personal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10}
where the first argument is the list of the graphics that is to be included (the first one is the one in the middle), and the second argument is the list of features. Everything else can be controlled by options that are passed as zeroth argument.
documentclass[border=20pt]{standalone}
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=1,
inner image radius/.initial=2,
outer image parameters/.initial={width=2.5cm},
inner image parameters/.initial={width=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.8ex,
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.7) arc (360/NumFeatures*j:360/NumFeatures*(j-1):pgfkeysvalueof{/tikz/life wheel/radius}+0.7); %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=9,outer image radius=0.8,%
colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-duck","example-image-a","example-image-b","example-image-c"}{%
Money/10,
Entertainment/10,
Romance/10,
Personal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10}
end{tikzpicture}
end{document}
If you leave the color list out, i.e. do
LifeWeel[radius=9,outer image radius=0.8,%
%colors={"red","blue","magenta","purple","orange","green"}
]{"example-image-duck","example-image-a","example-image-b","example-image-c"}{%
Money/10,
Entertainment/10,
Romance/10,
Personal Growth/10,
Friends {&} Family/10,
Financial/10,
Spiritual/10,
Health/10}
what I originally thought the question was about
edited Feb 10 at 23:53
answered Feb 7 at 17:07
marmotmarmot
100k4115222
100k4115222
1
@Raaja Good point. (I focused on making the thingy more easy to customize in my update. The sheer number of arguments drove me almost crazy.) (The problem with inserting nicer images is that either one has to blow up the code because one draws them with TikZ, or include graphics that not everyone has on their machines.)
– marmot
Feb 7 at 19:16
1
I will try to plug in Falcons in the morn (CET;-)
). Lets see how far I go :D
– Raaja
Feb 7 at 19:20
1
@Raaja As long no duck nor marmot gets harmed, I'm fine with it. ;-)
– marmot
Feb 7 at 19:21
1
we will see :D I will post it in the chat (if I succeed ;D)
– Raaja
Feb 7 at 19:22
1
@tisaigon E.g.LifeWeel[radius=9,outer image radius=0.8]{"/Image/Wheelimage/wheel01.jpg","/Image/Wheelimage/wheel02.jpg","/Image/Wheelimage/wheel03.jpg","/Image/Wheelimage/wheel04.jpg"}{...
One can rewrite the code to take an arbitrary number of pictures or generalize it even further.
– marmot
Feb 8 at 1:25
|
show 14 more comments
1
@Raaja Good point. (I focused on making the thingy more easy to customize in my update. The sheer number of arguments drove me almost crazy.) (The problem with inserting nicer images is that either one has to blow up the code because one draws them with TikZ, or include graphics that not everyone has on their machines.)
– marmot
Feb 7 at 19:16
1
I will try to plug in Falcons in the morn (CET;-)
). Lets see how far I go :D
– Raaja
Feb 7 at 19:20
1
@Raaja As long no duck nor marmot gets harmed, I'm fine with it. ;-)
– marmot
Feb 7 at 19:21
1
we will see :D I will post it in the chat (if I succeed ;D)
– Raaja
Feb 7 at 19:22
1
@tisaigon E.g.LifeWeel[radius=9,outer image radius=0.8]{"/Image/Wheelimage/wheel01.jpg","/Image/Wheelimage/wheel02.jpg","/Image/Wheelimage/wheel03.jpg","/Image/Wheelimage/wheel04.jpg"}{...
One can rewrite the code to take an arbitrary number of pictures or generalize it even further.
– marmot
Feb 8 at 1:25
1
1
@Raaja Good point. (I focused on making the thingy more easy to customize in my update. The sheer number of arguments drove me almost crazy.) (The problem with inserting nicer images is that either one has to blow up the code because one draws them with TikZ, or include graphics that not everyone has on their machines.)
– marmot
Feb 7 at 19:16
@Raaja Good point. (I focused on making the thingy more easy to customize in my update. The sheer number of arguments drove me almost crazy.) (The problem with inserting nicer images is that either one has to blow up the code because one draws them with TikZ, or include graphics that not everyone has on their machines.)
– marmot
Feb 7 at 19:16
1
1
I will try to plug in Falcons in the morn (CET
;-)
). Lets see how far I go :D– Raaja
Feb 7 at 19:20
I will try to plug in Falcons in the morn (CET
;-)
). Lets see how far I go :D– Raaja
Feb 7 at 19:20
1
1
@Raaja As long no duck nor marmot gets harmed, I'm fine with it. ;-)
– marmot
Feb 7 at 19:21
@Raaja As long no duck nor marmot gets harmed, I'm fine with it. ;-)
– marmot
Feb 7 at 19:21
1
1
we will see :D I will post it in the chat (if I succeed ;D)
– Raaja
Feb 7 at 19:22
we will see :D I will post it in the chat (if I succeed ;D)
– Raaja
Feb 7 at 19:22
1
1
@tisaigon E.g.
LifeWeel[radius=9,outer image radius=0.8]{"/Image/Wheelimage/wheel01.jpg","/Image/Wheelimage/wheel02.jpg","/Image/Wheelimage/wheel03.jpg","/Image/Wheelimage/wheel04.jpg"}{...
One can rewrite the code to take an arbitrary number of pictures or generalize it even further.– marmot
Feb 8 at 1:25
@tisaigon E.g.
LifeWeel[radius=9,outer image radius=0.8]{"/Image/Wheelimage/wheel01.jpg","/Image/Wheelimage/wheel02.jpg","/Image/Wheelimage/wheel03.jpg","/Image/Wheelimage/wheel04.jpg"}{...
One can rewrite the code to take an arbitrary number of pictures or generalize it even further.– marmot
Feb 8 at 1:25
|
show 14 more comments
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%2f473774%2fcustom-colour-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