# Forcing a common z-scale in a surface groupplot

I've come across some similar questions, but not this exact one. And nothing I've tried has been able to achieve precisely what I'm looking for.

I have a groupplot that contains two overhead views of surface plots. The code (not an MWE) that produces them is

\begin{figure}
\centering
\begin{extikzpicture}[runs=2]{fig6}
\begin{groupplot}[
group style={group size=2 by 1,
group name = fig6_plots,
xlabels at=edge bottom,
ylabels at=edge left
},
xlabel = {\footnotesize $\alpha_{++}$},
ylabel = {\footnotesize Departure Rate},
view={0}{90},
colorbar horizontal,
colormap/blackwhite,
y tick label style={
/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=2,
/tikz/.cd
},
x tick label style={
/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=0,
/tikz/.cd
}]
\nextgroupplot[title={\scriptsize Come and Go}]
\nextgroupplot[title={\scriptsize ++Resources}]
\end{groupplot}
\end{extikzpicture}
\caption{++Resources and Come and Go}
\label{HeatMap}
\end{figure}


The output looks like

Note the different colorbar scales. I'd like to be able to force them both to use the same Z-scale so that they'll use the same colorbar. Then I could just produce one colorbar centered between the two and it would facilitate comparison. But I can't find any way to do that.

For reference, here is an early figure that shows both surfaces on a single plot. I felt it didn't render very well in black and white (which is required for the journal I'm submitting to) so I tried switching to the two "heat map" views.

• I suspect (without seeing the data) that the mean and sd are different in the two data sets. So before you input the data into \addplot you need to normalize each data set. (This is a basic stats issue.) Zscore=(x-meanx)/sdx – R. Schumacher May 20 '15 at 3:30
• I'm not sure that's what I'm after. I just edited the original post to include a figure that shows the 3D view of both surfaces. When they're on the same plot like that they obviously have a common Z-scale. But I didn't think that plot rendered very well in black and white. So I tried switching to the overhead "heat map" view. – jerH May 20 '15 at 3:45
• Adding point meta min and point meta max to your axis configurations allows to sync the color maps and color bars. In order to place + align a single color bar, you may want to consider section "4.9.13 Color Bars Outside Of an Axis" of the pgfplots reference manual and, in particular, the key colorbar to name combined with \ref – Christian Feuersänger May 20 '15 at 16:10

Many thanks! I knew how to build the common color bar, just not how to force the scale to be common. Solution looks like this

\begin{figure}
\centering
\begin{extikzpicture}[runs=2]{fig6}
\begin{groupplot}[point meta min=4,point meta max=15,
group style={group size=2 by 1,
group name = fig6_plots,
xlabels at=edge bottom,
ylabels at=edge left
},
xlabel = {\footnotesize $\alpha_{++}$},
ylabel = {\footnotesize Departure Rate},
view={0}{90},
colorbar horizontal,
colorbar to name=ContourColorbar,
colormap/blackwhite,
y tick label style={
/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=2,
/tikz/.cd
},
x tick label style={
/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=0,
/tikz/.cd
}]
\nextgroupplot[title={\scriptsize Come and Go}]
\node (fig6_Legend) at ($(fig6_plots c1r1.center)!0.5!(fig6_plots c2r1.center)-(0,4.5cm)$){\ref{ContourColorbar}};