I'm somewhat baffled by my apparent inability to choose a mix of colors in pgfplots
. Here's a MWE:
\documentclass[10pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.4}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{tikzpicture}
\begin{document}
\begin{tikzpicture}[scale=1.0]
\begin{axis}[enlargelimits=false,
xtick={-3.141,0,3.141},
xticklabels={$-\pi$,$0$,$\pi$}]
\addplot[color=red!0.4!black,domain=-pi:pi] {sin(deg(x))};
\end{axis}
\end{tikzpicture}
\end{document}
I would have expected a color in between red and black, but I get just black. If I choose the color as color=black!0.4!red
it turns out to be red. What am I doing wrong?
Best Answer
You need to use percentages rather than fractions.
red!40!black
works.I had to remove the
\pgfplotsset{compat=1.4}
line from your source code because it prevented compilation. Nevertheless, the following code produces a mixture of black and red. Apparentlyred!0.4!black
gives you 0.4% red and 99.6% black (assuming decimal inputs are accepted). Otherwise, it would round to 0% and 100%.