
나는 다음의 도움을 이용했습니다.Latex에서 선버스트 차트를 만드는 방법은 무엇입니까?선버스트 차트를 만드는 데 필요한 사항에 맞게 사용자 정의했습니다. 그 안의 모든 텍스트를 굵게 표시해야 하며, 가능하다면 그 안에 있는 텍스트의 크기를 늘려야 합니다. 여기 내 MWE가 있습니다.
\documentclass[border=0.05in]{standalone}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{xparse}
\usepackage{tikz}
\definecolor{pear}{rgb}{0.82, 0.89, 0.19}
\definecolor{lavender}{rgb}{0.71, 0.49, 0.86}
\usetikzlibrary{calc,positioning}
\usetikzlibrary{decorations, decorations.text}
\newlength{\layerwd}
\newcounter{outermost}
\NewDocumentEnvironment{onion}{sm}{%*= draw axes; #1: thickness of each annulus
\begin{tikzpicture}
\setlength{\layerwd}{#2}%
\setcounter{outermost}{0}
}{%
\foreach \A in {0,...,\theoutermost}{\draw[thick,] (0,0) circle (\A*\layerwd+\layerwd);}
\end{tikzpicture}
}
% *=text on a circular path; [optional fill color]; #3 layer;
% #4 start angle; #5 stop angle; #6 [optional text]
%% angles are counterclockwise in degrees
\NewDocumentCommand{\annulus}{sO{lightgray}mmmo}{%
\filldraw[thick,fill=#2,] (#4:#3*\layerwd) %% start here
arc [radius=#3*\layerwd, start angle=#4, delta angle=#5-#4] %% inner arc
-- (#5:#3*\layerwd+\layerwd) %% move out
arc [radius=#3*\layerwd+\layerwd, start angle=#5, delta angle=#4-#5,] %% outer arc
-- cycle; %% Back to the beginnning
\pgfmathsetmacro{\tmp}{(#5-#4)/2 +#4} %% Locate the middle of the arc
\IfNoValueF{#6}{%
\IfBooleanTF{#1}
{%
\begingroup
%% text is always rightside-up:
\pgfmathsetmacro{\rpTF}{ifthenelse(\tmp>180,"false","true")}
\def\\{\space} %% A safety precaution, \\ = space on decorated text
\path[rotate=\tmp-180,postaction={
decorate,
decoration={
text along path,
raise=-3pt,
text align={align=center},
reverse path=\rpTF,
text=#6
}
}] (0,0) circle (#3*\layerwd+0.5*\layerwd);
\endgroup
}%%
{%
\pgfmathsetmacro{\rpTF}{ifthenelse(\tmp>180,\tmp+90,\tmp-90)}
\node[inner sep=0pt, %%% If there is text, print it
text width=#3*\layerwd*3+\layerwd,
align=center,
rotate=\rpTF,
font=\normalsize] at (\tmp:#3*\layerwd+0.5*\layerwd)
{#6};
}%
}%
\ifnum\theoutermost<#3\setcounter{outermost}{#3}\fi
}
\begin{document}
\begin{onion}*{0.6in}
\draw[fill=red!20,thick] (0,0) circle (1.53cm);
\node[color=red,thick,font=\bfseries] at (0,0) {My research};
\annulus*[pear]{1}{0}{180}[Materials for composites]
\annulus*[pear!80]{2}{0}{180}[Working through trial and errors to find parameters]
\annulus*[pear!60]{3}{0}{180}[Conditions associated with pre and post heat treatment]
\annulus*[pear!40]{4}{20}{70}[Mechanical]
\annulus*[pear!40]{4}{0}{20}[Physical]
\annulus*[pear!40]{4}{70}{100}[Tribological]
\annulus*[pear!40]{4}{100}{150}[Microstructure(OM/SEM/TEM)]
\annulus*[pear!40]{4}{150}{180}[XRD]
\annulus[pear!25]{5}{150}{180}[2($\theta$) and \\Bulk texture]
\annulus[pear!25]{5}{100}{150}[Composites{,}\\Fracture{,}\\Wear track/debris]
\annulus*[pear!25]{5}{70}{100}[Wear rate/COF]
\annulus[pear!25]{5}{20}{40}[Hardness (Hv)]
\annulus[pear!25]{5}{0}{20}[Density]
\annulus[pear!25]{5}{40}{70}[Tensile (MPa)\\Yield (MPa)\\Elongation ($\delta$)]
\annulus*[lavender!65]{1}{180}{360}[Materials for composites]
\annulus*[lavender!55]{2}{180}{360}[Working through trial and errors to find parameters]
\annulus*[lavender!45]{3}{180}{360}[Conditions associated with pre and post heat treatment]
\annulus*[lavender!35]{4}{180}{200}[Physical]
\annulus*[lavender!35]{4}{200}{250}[Mechanical]
\annulus*[lavender!35]{4}{250}{280}[Tribological]
\annulus*[lavender!35]{4}{280}{330}[Microstructure(OM/SEM/TEM)]
\annulus*[lavender!35]{4}{330}{360}[XRD]
\annulus[lavender!25]{5}{180}{200}[Density]
\annulus[lavender!25]{5}{200}{220}[Hardness (Hv)]
\annulus[lavender!25]{5}{220}{250}[Tensile (MPa)\\Yield (MPa)\\Elongation ($\delta$)]
\annulus*[lavender!25]{5}{250}{280}[Wear rate/COF]
\annulus[lavender!25]{5}{280}{330}[Composites{,}\\Fracture{,}\\Wear track/debris]
\annulus[lavender!25]{5}{330}{360}[2($\theta$) and \\Bulk texture]
\end{onion}
\end{document}
다음과 같은 출력이 생성됩니다.
답변1
글꼴 스타일을 변경하려면텍스트내부의 재산\환정의. 구체적으로 다음을 변경해야 합니다.
decoration={
text along path,
raise=-3pt,
text align={align=center},
reverse path=\rpTF,
text=#6 % <-------------- HERE!
}
이에:
text={|\customannfont|#6}
이:
\node[inner sep=0pt, %%% If there is text, print it
text width=#3*\layerwd*3+\layerwd,
align=center,
rotate=\rpTF,
font=\normalsize] at (\tmp:#3*\layerwd+0.5*\layerwd) % <-------------- HERE!
{#6};
이에:
font=\customannfont] at (\tmp:#3*\layerwd+0.5*\layerwd)
참고: \customannfont를 사용하는 대신 다음과 같이 글꼴 스타일을 간단히 작성할 수 있습니다.
%%% code before
text={|\bfseries\fontsize{10}{0}\selectfont|#6}
%%% other code
font=\fontsize{10}{0}\selectfont
글꼴을 10pt로 굵게 만듭니다. 하지만 스타일을 정의하기 전에 스타일을 정의하는 것이 좋습니다.\환정의이므로 다음과 같이 한 번만 수정하여 코드의 두 위치에서 모두 변경할 수 있습니다.
\newcommand{\customannfont}{\fontsize{10}{0}\selectfont}
글꼴을 굵고 크게 만드는 전체 코드는 다음과 같습니다.
\documentclass[border=0.05in]{standalone}
\usepackage{amsmath}
\usepackage{xcolor}
\usepackage{xparse}
\usepackage{tikz}
\definecolor{pear}{rgb}{0.82, 0.89, 0.19}
\definecolor{lavender}{rgb}{0.71, 0.49, 0.86}
\usetikzlibrary{calc,positioning}
\usetikzlibrary{decorations, decorations.text}
\newlength{\layerwd}
\newcounter{outermost}
\NewDocumentEnvironment{onion}{sm}{%*= draw axes; #1: thickness of each annulus
\begin{tikzpicture}
\setlength{\layerwd}{#2}%
\setcounter{outermost}{0}
}{%
\foreach \A in {0,...,\theoutermost}{\draw[thick,] (0,0) circle (\A*\layerwd+\layerwd);}
\end{tikzpicture}
}
% define your custom font style
\newcommand{\customannfont}{\bfseries\fontsize{10}{0}\selectfont}
% *=text on a circular path; [optional fill color]; #3 layer;
% #4 start angle; #5 stop angle; #6 [optional text]
%% angles are counterclockwise in degrees
\NewDocumentCommand{\annulus}{sO{lightgray}mmmo}{%
\filldraw[thick,fill=#2,] (#4:#3*\layerwd) %% start here
arc [radius=#3*\layerwd, start angle=#4, delta angle=#5-#4] %% inner arc
-- (#5:#3*\layerwd+\layerwd) %% move out
arc [radius=#3*\layerwd+\layerwd, start angle=#5, delta angle=#4-#5,] %% outer arc
-- cycle; %% Back to the beginnning
\pgfmathsetmacro{\tmp}{(#5-#4)/2 +#4} %% Locate the middle of the arc
\IfNoValueF{#6}{%
\IfBooleanTF{#1}
{%
\begingroup
%% text is always rightside-up:
\pgfmathsetmacro{\rpTF}{ifthenelse(\tmp>180,"false","true")}
\def\\{\space} %% A safety precaution, \\ = space on decorated text
\path[rotate=\tmp-180,postaction={
decorate,
decoration={
text along path,
raise=-3pt,
text align={align=center},
reverse path=\rpTF,
text={|\customannfont|#6}
}
}] (0,0) circle (#3*\layerwd+0.5*\layerwd);
\endgroup
}%%
{%
\pgfmathsetmacro{\rpTF}{ifthenelse(\tmp>180,\tmp+90,\tmp-90)}
\node[inner sep=0pt, %%% If there is text, print it
text width=#3*\layerwd*3+\layerwd,
align=center,
rotate=\rpTF,
font=\customannfont] at (\tmp:#3*\layerwd+0.5*\layerwd)
{#6};
}%
}%
\ifnum\theoutermost<#3\setcounter{outermost}{#3}\fi
}
\begin{document}
\begin{onion}*{0.6in}
\draw[fill=red!20,thick] (0,0) circle (1.53cm);
\node[color=red,thick,font=\bfseries] at (0,0) {My research};
\annulus*[pear]{1}{0}{180}[Materials for composites]
\annulus*[pear!80]{2}{0}{180}[Working through trial and errors to find parameters]
\annulus*[pear!60]{3}{0}{180}[Conditions associated with pre and post heat treatment]
\annulus*[pear!40]{4}{20}{70}[Mechanical]
\annulus*[pear!40]{4}{0}{20}[Physical]
\annulus*[pear!40]{4}{70}{100}[Tribological]
\annulus*[pear!40]{4}{100}{150}[Microstructure(OM/SEM/TEM)]
\annulus*[pear!40]{4}{150}{180}[XRD]
\annulus[pear!25]{5}{150}{180}[2($\theta$) and \\Bulk texture]
\annulus[pear!25]{5}{100}{150}[Composites{,}\\Fracture{,}\\Wear track/debris]
\annulus*[pear!25]{5}{70}{100}[Wear rate/COF]
\annulus[pear!25]{5}{20}{40}[Hardness (Hv)]
\annulus[pear!25]{5}{0}{20}[Density]
\annulus[pear!25]{5}{40}{70}[Tensile (MPa)\\Yield (MPa)\\Elongation ($\delta$)]
\annulus*[lavender!65]{1}{180}{360}[Materials for composites]
\annulus*[lavender!55]{2}{180}{360}[Working through trial and errors to find parameters]
\annulus*[lavender!45]{3}{180}{360}[Conditions associated with pre and post heat treatment]
\annulus*[lavender!35]{4}{180}{200}[Physical]
\annulus*[lavender!35]{4}{200}{250}[Mechanical]
\annulus*[lavender!35]{4}{250}{280}[Tribological]
\annulus*[lavender!35]{4}{280}{330}[Microstructure(OM/SEM/TEM)]
\annulus*[lavender!35]{4}{330}{360}[XRD]
\annulus[lavender!25]{5}{180}{200}[Density]
\annulus[lavender!25]{5}{200}{220}[Hardness (Hv)]
\annulus[lavender!25]{5}{220}{250}[Tensile (MPa)\\Yield (MPa)\\Elongation ($\delta$)]
\annulus*[lavender!25]{5}{250}{280}[Wear rate/COF]
\annulus[lavender!25]{5}{280}{330}[Composites{,}\\Fracture{,}\\Wear track/debris]
\annulus[lavender!25]{5}{330}{360}[2($\theta$) and \\Bulk texture]
\end{onion}
\end{document}
답변2
글꼴은 \bfseries
및 로 지정할 수 있습니다 \large
.
코드는 다음을 사용하여 단순화할 수 있습니다.휠차트내가 쓴 패키지.
호 안의 텍스트는 키에 제공됩니다 arc data
. 여기서는 \\
텍스트를 여러 줄로 분할하는 데 사용할 수 있습니다. 이 텍스트의 방향은 \WCmidangle
키에 사용되는 호의 중앙 각도에 따라 달라집니다 arc data dir
. 이 텍스트는 가 있는 호의 중심에 있습니다 arc data pos=0.5
.
\documentclass[border=6pt]{standalone}
\usepackage{wheelchart}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}[scale=1.2]
\bfseries\large
\definecolor{lavender}{rgb}{0.71, 0.49, 0.86}
\definecolor{pear}{rgb}{0.82, 0.89, 0.19}
\pgfkeys{
/wheelchart,
arc data=\WCvarB,
arc data dir={\WCmidangle<180?1:-1},
arc data expand=f,
arc data pos=0.5,
data=,
slices style={fill=\WCcolor,draw=black,thick},
total angle=180
}
\fill[red!20] (0,0) circle[radius=1.5] node[red] {My research};
\foreach\WCstartangle/\WCcolorA/\WCcolorB/\WCcolorC/\WCcolorD/\WCcolorE in {%
180/pear/pear!80/pear!60/pear!40/pear!25,
0/lavender!65/lavender!55/lavender!45/lavender!35/lavender!25%
}{
\pgfkeys{
/wheelchart,
start angle=\WCstartangle
}
\edef\WCcolor{\WCcolorA}
\wheelchart[
radius={1.5}{3}
]{%
1/Materials for composites%
}
\edef\WCcolor{\WCcolorB}
\wheelchart[
radius={3}{4.5}
]{%
1/Working through trial and errors to find parameters%
}
\edef\WCcolor{\WCcolorC}
\wheelchart[
radius={4.5}{6}
]{%
1/Conditions associated with pre and post heat treatment%
}
\edef\WCcolor{\WCcolorD}
\wheelchart[
radius={6}{7.5}
]{%
30/XRD,
50/{Microstructure (OM/SEM/TEM)},
30/Tribological,
50/Mechanical,
20/Physical%
}
\edef\WCcolor{\WCcolorE}
\wheelchart[
radius={7.5}{9}
]{%
30/$2({\theta})$ and\\Bulk texture,
50/{Composites,\\Fracture,\\Wear track/debris},
30/{Wear rate/COF},
30/Tensile (MPa)\\Yield (MPa)\\Elongation (${\delta}$),
20/Hardness (Hv),
20/Density%
}
}
\end{tikzpicture}
\end{document}