![如何更改 overleaf 饼图图例中的文本颜色](https://linux22.com/image/463670/%E5%A6%82%E4%BD%95%E6%9B%B4%E6%94%B9%20overleaf%20%E9%A5%BC%E5%9B%BE%E5%9B%BE%E4%BE%8B%E4%B8%AD%E7%9A%84%E6%96%87%E6%9C%AC%E9%A2%9C%E8%89%B2.png)
我想将图 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}
结果: