0

I would like to change the color of the text 7.91-6.33 in figure A's legend and the text 73169 - 60901 in figure B's legend to red.

Please any help would be really appreciated.

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

enter image description here

3
  • 1
    I'm not sure I understand. Doesn't simply change the color name in the list clearly visible in the code work? The colors are ordered exactly like in the figure. What problem do you get?
    – Miyase
    Commented Apr 14, 2023 at 7:27
  • Welcome to TeX.SX! If you want to change the color of the text, you can simply do 10/\textcolor{blue}{7.91 - 6.33} (or 10/\textcolor{red}{73169 - 60901}). Commented Apr 14, 2023 at 7:32
  • Thank you so much Jasper!! I appreciate your help!
    – shefo
    Commented Apr 14, 2023 at 7:36

1 Answer 1

1

You can add normal LaTeX commands in the label text to change the appearance. For the first entry you can use for example:

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

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

Result:

enter image description here

1
  • Marjin, thank you very much. Much appreciated
    – shefo
    Commented Apr 14, 2023 at 7:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .