如何更改 overleaf 饼图图例中的文本颜色

如何更改 overleaf 饼图图例中的文本颜色

我想将图 A 图例中的文本 7.91-6.33 和图 B 图例中的文本 73169 - 60901 的颜色更改为红色。

如有任何帮助我将非常感激。

\begin{figure}[htbp]
\centering
\begin{subfigure}[b]{0.23\textwidth}
\centering
\begin{tikzpicture}
\pie[ hide number, scale =.5, rotate = 375, radius=1, color={red, orange, yellow, magenta!90, green!70, cyan!90, pink!40}, text=legend]{4/ 9.51 - 7.91, 10/7.91 - 6.33, 10/6.33 - 4.74, 6/4.74 - 3.16, 5/3.16 - 1.57, 65/1.57 - 0.01, 0.001/ Out of Range }
\end{tikzpicture}
\caption{A Into}
\label{subfigure7}
\end{subfigure}
\begin{subfigure}[b]{0.23\textwidth}
\centering
\begin{tikzpicture}
\pie[ hide number, scale =.5, rotate = 375, radius=1, color={red, orange, yellow, magenta!90, green!70, cyan!90, pink!40}, text=legend]{10/ 73169 - 60901, 3/ 60901 - 48706, .1/48706 - 36511, 10/36511 - 24316, 7/24316 - 12122, 70.1/12122 - 73, 0.1/ Out of Range}
\end{tikzpicture}
\caption{B Into}
\label{subfigure8}
\end{subfigure}
\caption[Caption for LOF]{A and B}
\label{figure6}
\end{figure}

在此处输入图片描述

答案1

您可以在标签文本中添加常规 LaTeX 命令来更改外观。例如,对于第一个条目,您可以使用:

4/\textcolor{red}{9.51 - 7.91}

完整 MWE:

\documentclass{article}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{pgf-pie}
\begin{document}
\begin{figure}[htbp]
\centering
\begin{subfigure}[b]{0.23\textwidth}
\centering
\begin{tikzpicture}
\pie[ hide number, scale =.5, rotate = 375, radius=1, color={red, orange, yellow, magenta!90, green!70, cyan!90, pink!40}, text=legend]{4/\textcolor{red}{9.51 - 7.91}, 10/7.91 - 6.33, 10/6.33 - 4.74, 6/4.74 - 3.16, 5/3.16 - 1.57, 65/1.57 - 0.01, 0.001/Out of Range }
\end{tikzpicture}
\caption{A Into}
\label{subfigure7}
\end{subfigure}
\hspace{2cm}
\begin{subfigure}[b]{0.23\textwidth}
\centering
\begin{tikzpicture}
\pie[ hide number, scale =.5, rotate = 375, radius=1, color={red, orange, yellow, magenta!90, green!70, cyan!90, pink!40}, text=legend]{10/\textcolor{red}{73169 - 60901}, 3/60901 - 48706, .1/48706 - 36511, 10/36511 - 24316, 7/24316 - 12122, 70.1/12122 - 73, 0.1/Out of Range}
\end{tikzpicture}
\caption{B Into}
\label{subfigure8}
\end{subfigure}
\caption[Caption for LOF]{A and B}
\label{figure6}
\end{figure}
\end{document}

结果:

在此处输入图片描述

相关内容