1

This is a follow up to a previous post. My aim is to produce a plot that uses meta data to colour/shade data points. What I'm having trouble in understanding is how the colour map is applied at the max/min values in meta range. As you can see from the MWE below, the points that have $\Pi_2 = 0$ are coloured blue whereas I'm expecting black as I'm using the hot2 colour map. Can anyone tell me what's going on here?

Thanks!

\documentclass[margin=5pt]{standalone}

\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{filecontents*}{mydata.dat}
  C   P1      P2      P3  sigP3
  1   1.12E-4 0.06189 0.1865  0.0080
  1   6.03E-3 0.00000 0.2517  0.0046
  1   2.64E-2 0.00000 0.2247  0.0165
  2   6.49E-5 0.00000 0.1906  0.0043
  2   1.27E-5 0.00296 0.2120  0.0039
  2   3.34E-4 0.00865 0.1709  0.0050
  3   1.59E-2 0.01857 0.1596  0.0216
  3   7.10E-4 0.01857 0.2547  0.0316
  3   3.23E-5 0.00526 0.1557  0.0051
  3   2.33E-4 0.01857 0.2008  0.0136
  3   5.80E-4 0.01857 0.2389  0.0172
\end{filecontents*}

\begin{document}
\begin{tikzpicture}

  \begin{semilogxaxis}[
      width=12cm,height=8cm,
      xlabel={$\Pi_1$},
      ylabel={$\Pi_3$},
      ymin=0.1,ymax=0.35,
      xmin=1E-5,xmax=1E-1,
      log basis x=10,
      colorbar,
      colorbar style={
        colormap/hot2,
        xshift=-1.5em,
        ylabel={$\Pi_2$},
        scaled ticks=false,
        yticklabel style={
          font=\footnotesize,
          /pgf/number format/fixed,
          /pgf/number format/fixed zerofill,
          /pgf/number format/precision=2,
        },
      },
    ]
    \addplot+[
      scatter,scatter src=explicit,mark=*,only marks,
      error bars/.cd,y dir=both,y explicit,error bar style={black}
    ]
    table[x=P1,y=P3,y error=sigP3,meta=P2,
      restrict expr to domain={\thisrow{C}}{1:1}
    ]{mydata.dat}; 
    \addlegendentry{Cond. 1}

    \addplot+[
      scatter,scatter src=explicit,mark=square*,only marks,
      error bars/.cd,y dir=both,y explicit,error bar style={black}
    ]
    table[x=P1,y=P3,y error=sigP3,meta=P2,
      restrict expr to domain={\thisrow{C}}{2:2}
    ]{mydata.dat}; 
    \addlegendentry{Cond. 2}

    \addplot+[
      scatter,scatter src=explicit,mark=triangle*,only marks,
      error bars/.cd,y dir=both,y explicit,error bar style={black}
    ]
    table[x=P1,y=P3,y error=sigP3,meta=P2,
      restrict expr to domain={\thisrow{C}}{3:3}
    ]{mydata.dat}; 
    \addlegendentry{Cond. 3}

  \end{semilogxaxis}
\end{tikzpicture}

\end{document}

MWE

closed as off-topic by Stefan Pinnow, Zarko, egreg, Przemysław Scherwentke, Martin Schröder Oct 23 '16 at 21:30

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    You have to set colormap/hot2 for the whole axis, not just within the colorbar style. – Jake May 6 '15 at 12:46
  • 4
    I'm voting to close this question as off-topic because it was solved in the comments. – Stefan Pinnow Oct 23 '16 at 20:44

Browse other questions tagged or ask your own question.