Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How is it possible to specific the colors shown in the sample plot here:

enter image description here

The code is below and copied from the site!

 \begin{tikzpicture}
\begin{ternaryaxis}[
    ternary limits relative,
    title={Data range $[0,1]$, limits relative},
    area style]
\addplot3 coordinates {
    (0.2,0.8,0)
    (0.31,0.4,0.29)
    (0.34,0.2,0.46)
    (0.4,0,0.6)
    (1,0,0)
};
\addplot3 coordinates {
    (0.4,0,0.6)
    (0.34,0.2,0.46)
    (0.31,0.4,0.29)
    (0.14,0.46,0.4)
    (0,0.37,0.63)
    (0,0,1)
};
\node[fill=white] 
    at (axis cs:0.56,0.28,0.16) {$F 42$};
\node[fill=white] 
    at (0.7,0.2) {$F 43$};
\end{ternaryaxis}
\end{tikzpicture}
share|improve this question
3  
I don't understand your question. The colors from your code (after suitable completion) and those in the linked image are the same. What exactly are you trying to achieve? –  Gonzalo Medina May 15 at 18:43
    
do you maybe want to ask what would be the LaTeX definition of the standard plot colors or, more generally, how to define a given color (e.g. taken from a pdf) in LaTeX? –  dcmst May 15 at 19:35

2 Answers 2

I understand you are asking where are these blue and red colors defined when no color is mentioned into the code.

pgfplots uses some internally defined cycle lists of colors. When plots have no explicit colors, default ones are used. This way, first plot uses to be blue, second, red, ...

In this particular case, the plot is filled with some color, it is not only drawn. Let's try to find in pgfplots documentation how are this filling colors defined.

Let's start in Ternary Diagrams section (page 444 in Revision 1.10 from 2014/02/28). It says:

enter image description here

As you can see these colors looks like your ones. This paragraph mention that this kind of plot uses area style to change cycle list. If we click on area style we jump to page 95

enter image description here

where we click on bar cycle list which send us to page 82

enter image description here`

where we find that these filling colors are blue!30!white for the first addplot3d and red!30!white for the second.

share|improve this answer
    
+1 Ah, yes. This seems to be what the OP was asking (I didn't understood the question). I'll leave my answer in any case as it can also be helpful in other cases. –  Gonzalo Medina May 15 at 22:07

If you are asking how to change the colors, this can be done using the draw=<color> and or fill=<color> options for the \addplot3 commands and using your favorite colors. A little example using your code in which I added a third \addplot3 just to illustrate how to change colors for the three regions:

\documentclass{article}
\usepackage{pgfplots}
\usepgfplotslibrary{ternary}

\begin{document}

\begin{tikzpicture}
\begin{ternaryaxis}[
    ternary limits relative,
    title={Data range $[0,1]$, limits relative},
    area style]
\addplot3 [fill=green!70!black] coordinates {
    (0.2,0.8,0)
    (0.31,0.4,0.29)
    (0.34,0.2,0.46)
    (0.4,0,0.6)
    (1,0,0)
};
\addplot3 [fill=orange!70!black] coordinates {
    (0.4,0,0.6)
    (0.34,0.2,0.46)
    (0.31,0.4,0.29)
    (0.14,0.46,0.4)
    (0,0.37,0.63)
    (0,0,1)
};
\addplot3 [fill=cyan!70!black] coordinates {
    (0,0,0)
    (0.2,0.8,0)
    (0.31,0.4,0.29)
    (0.14,0.46,0.4)
    (0,0.37,0.63)
    (0,0,0)
};
\node[fill=white] 
    at (axis cs:0.56,0.28,0.16) {$F 42$};
\node[fill=white] 
    at (0.7,0.2) {$F 43$};
\end{ternaryaxis}
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.