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.

I am trying to get a surface graph with two colormaps. Instead of using the full Z range i want to give the first surface its own colormap and the second surface should receive its own colormap too (it may be even the same)... however the current version takes the full range of Z-Data and calculates the colormap. Is there any way?

\begin{tikzpicture}
    \begin{axis}[grid = major, colormap={bw}{gray(0cm)=(0); gray(1cm)=(1)}, view={-30}{15}]

 \addplot3[surf]
   table 
   {DATA1.dat};

 \addplot3[surf]
   table 
   {DATA2.dat};

\end{axis}
\end{tikzpicture}

Right now it looks like that: enter image description here

I want each of the surface to be scaled individually... just to see more clearly how the amplitude changes :)

Any ideas?

Thanks, Alex

share|improve this question

1 Answer 1

To scale the colormap for each plot individually, set point meta rel=per plot:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[
            grid = major,
            colormap={bw}{gray(0cm)=(0); gray(1cm)=(1)},
            view={-30}{15},
            point meta rel=per plot
        ]

 \addplot3 [surf] {x^3};

 \addplot3 [surf] {x^3+300};

\end{axis}
\end{tikzpicture}
\end{document}

To use different color maps for different plots, specify the required color map in the \addplot options:

\documentclass{article}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[
            grid = major,
            colormap={bw}{gray(0cm)=(0); gray(1cm)=(1)},
            view={-30}{15},
            point meta rel=per plot
        ]

 \addplot3 [surf] {x^3};

 \addplot3 [surf, colormap/greenyellow] {x^3+300};

\end{axis}
\end{tikzpicture}
\end{document}
share|improve this answer
    
Wow that seemed kind of easy! Thank you Jake! You saved my day :) –  Alex Feb 5 at 14:41

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.