サンバースト チャート内のテキストを太字にして、フォント サイズを少し大きくするにはどうすればよいでしょうか?

サンバースト チャート内のテキストを太字にして、フォント サイズを少し大きくするにはどうすればよいでしょうか?

私は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}

関連情報