Dado el siguiente fragmento de código:
\begin{frame}
\titlesub
\pgfplotsset{compat=1.9}
\centering
\begin{tikzpicture}
\begin{axis}[
width=0.9\textwidth,
height=0.9\textheight,
ybar stacked,
ymin=0,
enlarge y limits={upper, value=0.2},
enlarge x limits = 0.2,
bar width = 1 cm,
legend style={at={(1.1, 1)},
anchor=north,legend columns=1},
ylabel={CPU time (s)},
symbolic x coords={Run 1, Run 2, Run 3, Reference},
xtick=data,
nodes near coords,
legend style={/tikz/every even column/.append style={column sep=0.5cm}}]
%nodes near coords align={horizontal},
]
\addplot [fill = POLIMIblue] coordinates {(Run 1, 426) (Run 2, 387) (Run 3, 446) (Reference, 614) };
\addplot [fill = col2] coordinates {(Run 1, 1182) (Run 2, 725) (Run 3, 1517) (Reference, 951) };
\legend{Setup, Solve}
\end{axis}
\end{tikzpicture}
\end{frame}
¿Cómo puedo cambiar el color de las etiquetas 426/387/446/614 (blanco) y 1182/725/1517/951 (otro color)?
Respuesta1
Puedes usar every node near coord/.style={green}
.
\documentclass{beamer}
\usepackage{pgfplots}
\begin{document}
\begin{frame}
\pgfplotsset{compat=1.9}
\centering
\begin{tikzpicture}
\begin{axis}[
width=0.9\textwidth,
height=0.9\textheight,
ybar stacked,
ymin=0,
enlarge y limits={upper, value=0.2},
enlarge x limits = 0.2,
bar width = 1 cm,
legend style={at={(1.1, 1)},
anchor=north,legend columns=1},
ylabel={CPU time (s)},
symbolic x coords={Run 1, Run 2, Run 3, Reference},
xtick=data,
nodes near coords,
legend style={/tikz/every even column/.append style={column sep=0.5cm}}]
%nodes near coords align={horizontal},
]
\addplot [fill = blue,every node near coord/.style={white}] coordinates {(Run 1, 426) (Run 2, 387) (Run 3, 446) (Reference, 614) };
\addplot [fill = red,every node near coord/.style={green}] coordinates {(Run 1, 1182) (Run 2, 725) (Run 3, 1517) (Reference, 951) };
\legend{Setup, Solve}
\end{axis}
\end{tikzpicture}
\end{frame}
\end{document}