答案1
脚步:
- 背景颜色:在背景中绘制彩色轮子
- 构造轮子:在上面画线和圆圈
- 添加文字:输入文字定位
染色:绘制不同部分的路径。\usepackage{xcolor}
您可以使用自己的颜色\definecolor{darkbrown}{RGB}{108,86,0}, \definecolor{darkred}{RGB}{183,0,19}
。您也可以使用选项opacity
。
内部:半径 0 至 3,单个部分/颜色 =>\path
\path[fill,darkbrown,opacity=0.7] (10:0) -- (10:3) -- ([shift=(10:3cm)]0,0)arc (10:50:3cm) -- (50:3) -- (50:0); ...
中间:半径 3 至 6,多个部分/颜色 =>\foreach
循环
\foreach[evaluate=\xi using int(\ang+10)] \ang in {10,20,...,40}{
\path[fill,brown,opacity=0.5] (\ang:3) -- (\ang:6) -- ([shift=(\ang:6cm)]0,0)arc (\ang:\xi:6cm) -- (\xi:6) -- (\xi:3);
}
每个部分都有一个角度10
-> evaluate=\xi using int(\ang+10)
。因此\xi
定义为\ang+10
,表示单个元素的结束。
外部:半径 6 到 9,多个部分/颜色 => 也\foreach
使用循环,如上所示。
构造轮子:使用预设角度10,50,130,190,230,310
(内部,#6 个元素)、0,10,...,350
(中间,#36 个元素)和5,10,...,360
(外部,#72 个元素),您可以创建自己的轮子。
% inner
\foreach \ang in {10,50,130,190,230,310}{
\draw [black,thick] (\ang:0) -- (\ang:3);
}
\draw[thick] (0,0) circle (3cm);
% middle
\foreach \ang in {0,10,...,350} {
\draw [black,thick] (\ang:3) -- (\ang:6);
}
\draw[thick] (0,0) circle (6cm);
% outer
\foreach \ang in {5,10,...,360} {
\draw [black,thick] (\ang:6) -- (\ang:9);
}
\draw[thick] (0,0) circle (9cm);
文本:使用(\usepackage{pgfmath}
你可以为每个环定义一个数据数组,就像这样:
\def\namesInner{{"string A","string B","string C"}
然后你可以添加如下文本:
\draw [style01] (\ang:1.5) node[rotate=\ang]
{\pgfmathparse{\names[\xi]}\pgfmathresult};
这可能发生在循环内,旋转取决于文本位置->如果条件(如\ifnum\ang<271
)有帮助。
梅威瑟:
\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\tikzset{style01/.style={ font=\bfseries\normalsize\sffamily}}
\def\names{{"DISGUST","ANGER","FEAR","SURPRISE","HAPPY","SAD"}}
\def\namesTwo{{"GUILTY","AVOIANCE","AWFUL","DISAPPOINTED","DISAPPROVAL","CRITICAL","DISTANT","FRUSTRATED",
"AGGRESIVE","MAD","HATEFUL","THREATENED","HURT","HUMILIATED","REJECTED","SUBMISSIVE",
"INSECURE","ANXIOUS","SCARED","STARTLED","CONFUSED","AMAZED","EXCITED","JOYFUL",
"INTERESTED","PROUD","ACCEPTED","POWERFUL","PEACEFUL","INTIMATE","OPTIMISTIC","BORED",
"LONELY","DEPRESSED","DESPAIR","ABANDONED"}}
\def\namesThree{{"ASHAMED","REMORESFUL","HESITANT","AVERSION","DETESTABLE","REVULSION","REVOLTED","REPUGNANT",
"LOATHING","JUDGMENTAL","SARCASTIC","SKEPTICAL","SUSPICIOUS","WITHDRAWN","IRRITATED","INFURIATED",
"HOSTILE","PROVOKED","ENRAGED","FURIOUS","VIOLATED","RESENTFUL","JEALOUS","INSECURE",
"DEVASTATED","EMBARRASSED","RIDICULED","DISRESPECTED","ALIENATED","INADEQUATE","INSIGNIFICANT","WORTHLESS",
"INFERIOR","INADEQUATE","WORRIED","OVERWHELMED","FERIGHTENED","TERRIFIED","SHOCKED","DISMAYED","DISILLUSONED",
"PERPLEXED","ASTONISHED","AWE","EAGER","ENERGETIC","LIBERATED","ESTATIC","AMUSED","INQUISITIVE",
"IMPORTANT","CONFIDENT","RESPECTED","FULLFILLED","COURAGEOUS","PROVOCATIVE","LOVING","HOPEFUL","SENSITIVE",
"PLAYFUL","OPEN","INSPIRED","INDIFFERENT","APATHETIC","ISOLATED","ABANDONED","EMPTY","INFERIOR",
"VULNERABLE","POWERLESS","VICTIMIZED","IGNORED"}}
\usepackage{xcolor}
\definecolor{darkbrown}{RGB}{108,86,0}
\definecolor{darkred}{RGB}{183,0,19}
\definecolor{darkgreen}{RGB}{0,154,0}
\definecolor{darkorange}{RGB}{224,85,0}
\definecolor{darkyellow}{RGB}{255,255,0}
\definecolor{darkblue}{RGB}{0,29,207}
%\usepackage{pgfmath,pgffor}
\begin{document}
\begin{tikzpicture}[scale=1.0]
%%%%%%%%%%%%%%%%%%%%%
% Coloring: Background
%%%%%%%%%%%%%%%%%%%%%
%\foreach[evaluate=\xi using int(\ang+10)] \ang in {230,240,...,300}{ % OR
%\foreach \ang [count=\i from 24, evaluate=\i as \xi using int(\i*10)] in {230,240,...,300}{
% inner
\path[fill,darkbrown,opacity=0.7] (10:0) -- (10:3) -- ([shift=(10:3cm)]0,0)arc (10:50:3cm) -- (50:3) -- (50:0);
\path[fill,darkred,opacity=1] (50:0) -- (50:3) -- ([shift=(50:3cm)]0,0)arc (50:130:3cm) -- (130:3) -- (130:0);
\path[fill,darkgreen,opacity=1] (130:0) -- (130:3) -- ([shift=(130:3cm)]0,0)arc (130:190:3cm) -- (190:3) -- (190:0);
\path[fill,darkorange,opacity=0.7] (190:0) -- (190:3) -- ([shift=(190:3cm)]0,0)arc (190:230:3cm) -- (230:3) -- (230:0);
\path[fill,darkyellow,opacity=0.7] (230:0) -- (230:3) -- ([shift=(230:3cm)]0,0)arc (230:310:3cm) -- (310:3) -- (310:0);
\path[fill,darkblue,opacity=0.7] (310:0) -- (310:3) -- ([shift=(310:3cm)]0,0)arc (310:370:3cm) -- (370:3) -- (370:0);
% middle (Parts:36)
\foreach[evaluate=\xi using int(\ang+10)] \ang in {10,20,...,40}{
\path[fill,brown,opacity=0.5] (\ang:3) -- (\ang:6) -- ([shift=(\ang:6cm)]0,0)arc (\ang:\xi:6cm) -- (\xi:6) -- (\xi:3);
}
\foreach[evaluate=\xi using int(\ang+10)] \ang in {50,60,...,120}{
\path[fill,red,opacity=0.5] (\ang:3) -- (\ang:6) -- ([shift=(\ang:6cm)]0,0)arc (\ang:\xi:6cm) -- (\xi:6) -- (\xi:3);
}
\foreach[evaluate=\xi using int(\ang+10)] \ang in {130,140,...,180}{
\path[fill,green,opacity=0.5] (\ang:3) -- (\ang:6) -- ([shift=(\ang:6cm)]0,0)arc (\ang:\xi:6cm) -- (\xi:6) -- (\xi:3);
}
\foreach[evaluate=\xi using int(\ang+10)] \ang in {190,200,...,220}{
\path[fill,orange,opacity=0.5] (\ang:3) -- (\ang:6) -- ([shift=(\ang:6cm)]0,0)arc (\ang:\xi:6cm) -- (\xi:6) -- (\xi:3);
}
\foreach[evaluate=\xi using int(\ang+10)] \ang in {230,240,...,300}{
\path[fill,yellow,opacity=0.5] (\ang:3) -- (\ang:6) -- ([shift=(\ang:6cm)]0,0)arc (\ang:\xi:6cm) -- (\xi:6) -- (\xi:3);
}
\foreach[evaluate=\xi using int(\ang+10)] \ang in {310,320,...,360}{
\path[fill,blue,opacity=0.5] (\ang:3) -- (\ang:6) -- ([shift=(\ang:6cm)]0,0)arc (\ang:\xi:6cm) -- (\xi:6) -- (\xi:3);
}
% outer
\foreach[evaluate=\xi using int(\ang+5)] \ang in {10,15,...,45}{
\path[fill,brown,opacity=0.3] (\ang:6) -- (\ang:9) -- ([shift=(\ang:9cm)]0,0)arc (\ang:\xi:9cm) -- (\xi:9) -- (\xi:6);
}
\foreach[evaluate=\xi using int(\ang+5)] \ang in {50,55,...,125}{
\path[fill,red,opacity=0.3] (\ang:6) -- (\ang:9) -- ([shift=(\ang:9cm)]0,0)arc (\ang:\xi:9cm) -- (\xi:9) -- (\xi:6);
}
\foreach[evaluate=\xi using int(\ang+5)] \ang in {130,135,...,185}{
\path[fill,green,opacity=0.3] (\ang:6) -- (\ang:9) -- ([shift=(\ang:9cm)]0,0)arc (\ang:\xi:9cm) -- (\xi:9) -- (\xi:6);
}
\foreach[evaluate=\xi using int(\ang+5)] \ang in {190,195,...,225}{
\path[fill,orange,opacity=0.3] (\ang:6) -- (\ang:9) -- ([shift=(\ang:9cm)]0,0)arc (\ang:\xi:9cm) -- (\xi:9) -- (\xi:6);
}
\foreach[evaluate=\xi using int(\ang+5)] \ang in {230,235,...,305}{
\path[fill,yellow,opacity=0.3] (\ang:6) -- (\ang:9) -- ([shift=(\ang:9cm)]0,0)arc (\ang:\xi:9cm) -- (\xi:9) -- (\xi:6);
}
\foreach[evaluate=\xi using int(\ang+5)] \ang in {310,315,...,365}{
\path[fill,blue,opacity=0.3] (\ang:6) -- (\ang:9) -- ([shift=(\ang:9cm)]0,0)arc (\ang:\xi:9cm) -- (\xi:9) -- (\xi:6);
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Draw a lines and circle:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% inner
\foreach \ang in {10,50,130,190,230,310}{
\draw [black,thick] (\ang:0) -- (\ang:3);
}
\draw[thick] (0,0) circle (3cm);
% middle
\foreach \ang in {0,10,...,350} {
\draw [black,thick] (\ang:3) -- (\ang:6);
}
\draw[thick] (0,0) circle (6cm);
% outer
\foreach \ang in {5,10,...,360} {
\draw [black,thick] (\ang:6) -- (\ang:9);
}
\draw[thick] (0,0) circle (9cm);
%%%%%%%%%%%%%
%% Add text:
%%%%%%%%%%%%%
%% inner
\foreach \ang [count=\i from 1, evaluate=\i as \xi using int(\i-1)] in {30,90,160,210,270,340}{%{-20,30,90,160,210,270}{
\ifnum\ang<91
\draw [style01] (\ang:1.5) node[rotate=\ang]
{\pgfmathparse{\names[\xi]}\pgfmathresult};
\else
\ifnum\ang<271
\draw [style01] (\ang:1.5) node[rotate=\ang-180]
{\pgfmathparse{\names[\xi]}\pgfmathresult};
\else
\draw [style01] (\ang:1.5) node[rotate=\ang-360]
{\pgfmathparse{\names[\xi]}\pgfmathresult};
\fi
\fi
}
%% middle
\foreach \ang [count=\i from 1, evaluate=\i as \xi using int(\i-1)] in {5,15,...,355}{
\ifnum\ang<91
\draw [style01] (\ang:4.5) node[rotate=\ang]
{\pgfmathparse{\namesTwo[\xi]}\pgfmathresult};
\else
\ifnum\ang<271
\draw [style01] (\ang:4.5) node[rotate=\ang-180]
{\pgfmathparse{\namesTwo[\xi]}\pgfmathresult};
\else
\draw [style01] (\ang:4.5) node[rotate=\ang-360]
{\pgfmathparse{\namesTwo[\xi]}\pgfmathresult};
\fi
\fi
}
% outer
\foreach \ang [count=\i from 1, evaluate=\i as \xi using int(\i-1)] in {2,7,...,357}{
\ifnum\ang<90
\draw [style01] (\ang+0.5:7.5) node[rotate=\ang+0.5]
{\pgfmathparse{\namesThree[\xi]}\pgfmathresult};
\else
\ifnum\ang<270
\draw [style01] (\ang+0.5:7.5) node[rotate=\ang+0.5-180]
{\pgfmathparse{\namesThree[\xi]}\pgfmathresult};
\else
\draw [style01] (\ang+0.5:7.5) node[rotate=\ang+0.5-360]
{\pgfmathparse{\namesThree[\xi]}\pgfmathresult};
\fi
\fi
}
\end{tikzpicture}
\end{document}
答案2
键入可能是最简单的方法。在背景中绘制彩色轮子transform shape
,tikz
然后添加文字:
\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}[every node/.style={transform shape}]
\draw[rotate=10] (1,0) node{disgust};
\draw[rotate=70] (1,0) node{Anger};
\draw[rotate=130] (1,0) node[rotate=180] {Fear};
\draw[rotate=190] (1,0) node[rotate=180] {Surprise};
\draw[rotate=250] (1,0) node {Happy};
\draw[rotate=310] (1,0) node {Sad};
\end{tikzpicture}
\end{document}
在这个框架中,你需要用rotate=
键旋转,否则节点将保持不变。这应该为完成你的图片提供足够的启动。
答案3
这轮图我写的包,可以使用。
\WCcolors
首先,使用包将颜色存储在列表中物品清单。
颜色由 给出的角度决定\WCmidangle
。在键 中slices style
,根据此角度确定一个数字。然后\WCcolor
将 定义为列表 的对应元素\WCcolors
。
车轮转动的数据通过 键来确定wheel data style
。
每个环都放置在单独的 中\wheelchart
。
对于第一个\wheelchart
,值由第一个变量给出。对于第二个和第三个\wheelchart
,使用键value=1
以使每个切片的角度相同。
\documentclass[border=6pt]{standalone}
\usepackage{listofitems}
\readlist\WCcolors{darkbrown,darkred,darkgreen,darkorange,darkyellow,darkblue}
\usepackage{wheelchart}
\definecolor{darkbrown}{RGB}{108,86,0}
\definecolor{darkred}{RGB}{183,0,19}
\definecolor{darkgreen}{RGB}{0,154,0}
\definecolor{darkorange}{RGB}{224,85,0}
\definecolor{darkyellow}{RGB}{255,255,0}
\definecolor{darkblue}{RGB}{0,29,207}
\begin{document}
\begin{tikzpicture}
\sffamily
\pgfkeys{
/wheelchart,
counterclockwise,
data=,
slices style={
/utils/exec={
\pgfmathparse{
\WCmidangle<10?6:
(\WCmidangle<50?1:
(\WCmidangle<130?2:
(\WCmidangle<190?3:
(\WCmidangle<230?4:
(\WCmidangle<310?5:
6
)))))
}
\edef\WCcolor{\WCcolors[\pgfmathresult]}
},
\WCcolor!\opacity,
draw=black
},
start angle=10,
wheel data pos=0.5,
wheel data style={rotate={(1-int(Mod({1.5-\WCmidangle/180},2)))*180+\WCmidangle}}
}
\def\opacity{70}
\wheelchart[
radius={0}{3},
wheel data=\WCvarB
]{4/DISGUST,8/ANGER,6/FEAR,4/SURPRISE,8/HAPPY,6/SAD}
\def\opacity{50}
\wheelchart[
radius={3}{6},
value=1,
wheel data=\WCvarA
]{AVOIANCE,AWFUL,DISAPPOINTED,DISAPPROVAL,CRITICAL,DISTANT,FRUSTRATED,AGGRESIVE,MAD,HATEFUL,THREATENED,HURT,HUMILIATED,REJECTED,SUBMISSIVE,INSECURE,ANXIOUS,SCARED,STARTLED,CONFUSED,AMAZED,EXCITED,JOYFUL,INTERESTED,PROUD,ACCEPTED,POWERFUL,PEACEFUL,INTIMATE,OPTIMISTIC,BORED,LONELY,DEPRESSED,DESPAIR,ABANDONED,GUILTY}
\def\opacity{30}
\wheelchart[
radius={6}{9},
value=1,
wheel data=\WCvarA
]{HESITANT,AVERSION,DETESTABLE,REVULSION,REVOLTED,REPUGNANT,LOATHING,JUDGMENTAL,SARCASTIC,SKEPTICAL,SUSPICIOUS,WITHDRAWN,IRRITATED,INFURIATED,HOSTILE,PROVOKED,ENRAGED,FURIOUS,VIOLATED,RESENTFUL,JEALOUS,INSECURE,DEVASTATED,EMBARRASSED,RIDICULED,DISRESPECTED,ALIENATED,INADEQUATE,INSIGNIFICANT,WORTHLESS,INFERIOR,INADEQUATE,WORRIED,OVERWHELMED,FERIGHTENED,TERRIFIED,SHOCKED,DISMAYED,DISILLUSONED,PERPLEXED,ASTONISHED,AWE,EAGER,ENERGETIC,LIBERATED,ESTATIC,AMUSED,INQUISITIVE,IMPORTANT,CONFIDENT,RESPECTED,FULLFILLED,COURAGEOUS,PROVOCATIVE,LOVING,HOPEFUL,SENSITIVE,PLAYFUL,OPEN,INSPIRED,INDIFFERENT,APATHETIC,ISOLATED,ABANDONED,EMPTY,INFERIOR,VULNERABLE,POWERLESS,VICTIMIZED,IGNORED,ASHAMED,REMORESFUL}
\end{tikzpicture}
\end{document}