¿Cómo poner texto en negrita dentro del gráfico Sunburst y aumentar un poco el tamaño de fuente?

¿Cómo poner texto en negrita dentro del gráfico Sunburst y aumentar un poco el tamaño de fuente?

He utilizado la ayuda de¿Cómo hacer un gráfico de rayos solares en látex?y lo personalicé según mis necesidades de crear un gráfico de rayos solares. Necesito poner en negrita todo el texto que contiene y, si es posible, aumentar el tamaño del texto que contiene. Aquí está mi 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}

Produce el siguiente resultado:

ingrese la descripción de la imagen aquí

Respuesta1

Para cambiar el estilo de fuente, debe modificar eltextopropiedad dentro del\anillodefinición. En concreto, tienes que cambiar esto:

decoration={
    text along path,
    raise=-3pt,
    text align={align=center},
    reverse path=\rpTF,
    text=#6 % <-------------- HERE!
}

a esto:

text={|\customannfont|#6}

y esto:

\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};

a esto:

font=\customannfont] at (\tmp:#3*\layerwd+0.5*\layerwd)

Nota: En lugar de usar \customannfont, simplemente podrías escribir el estilo de tu fuente, así:

%%% code before
text={|\bfseries\fontsize{10}{0}\selectfont|#6}
%%% other code
font=\fontsize{10}{0}\selectfont

para que la fuente sea de 10 puntos y en negrita. Sin embargo, recomiendo definir tu estilo antes del\anillodefinición, por lo que puedes cambiarla en ambos lugares del código modificándola solo una vez, así:

\newcommand{\customannfont}{\fontsize{10}{0}\selectfont}

Aquí está el código completo para hacer la fuente en negrita y más grande:Gráfico modificado

\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}

Respuesta2

La fuente se puede especificar con \bfseriesy \large.

El código se puede simplificar usando eldiagrama de ruedaspaquete, que escribí.

El texto en los arcos se le da a la clave arc data. Aquí, \\se puede utilizar para dividir el texto en varias líneas. La dirección de este texto depende del ángulo del medio del arco dado por \WCmidangleel cual se utiliza en la clave arc data dir. Este texto está centrado en el arco con arc data pos=0.5.

ingrese la descripción de la imagen aquí

\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}

información relacionada