# Controlling Image Size with External TikZ

I am building a groupplot using extikzpicture to externalize the graphics so that I can later just include them when I submit the paper for publication. I would like to reduce the size of the final groupplot. I could probably work this out on my own, but I'm working with severely compromised internet access at the moment, so it's difficult to research anything....even in posting this question, I can't get the full editor to load...hope I can make this look decent with markdown....

The code below (which is not an MWE) is the offending bit

\begin{figure}
\centering
\begin{extikzpicture}[runs=2]{fig5}
\begin{groupplot}[
group style={group size=2 by 2,
height=10cm,
width=10cm,
group name = fig5_plots,
xlabels at=edge bottom,
ylabels at=edge left
},
xlabel = {\footnotesize $\rho$},
ylabel = {\footnotesize $\gamma$},
%view={0}{90},
colorbar horizontal,
colorbar to name=ContourColorbar,
colormap/blackwhite,
y tick label style={
/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=1,
/tikz/.cd
},
x tick label style={
/pgf/number format/.cd,
fixed,
fixed zerofill,
precision=0,
/tikz/.cd
}]
\nextgroupplot[title={\scriptsize +Resources}, z buffer=sort]
\nextgroupplot[title={\scriptsize ++Resources}, z buffer=sort]
%\nextgroupplot[title={\scriptsize +Resources Delta},view={0}{90},]
\nextgroupplot[view={0}{90},]
%\nextgroupplot[title={\scriptsize ++Resources Delta},view={0}{90},]
\nextgroupplot[view={0}{90},]
\end{groupplot}
\node (fig5_Legend) at ($(fig5_plots c1r2.center)!0.5!(fig5_plots c2r2.center)-(0,4.5cm)$){\ref{ContourColorbar}};
\end{extikzpicture}
\caption{Reactive $\alpha$ Starting at Upper Bound}
\label{ReactiveDecreasing}
\end{figure}


You'll note the lines

height=10cm,
width=10cm,


in the groupstyle...they're the problem. If I remove those two lines, it compiles fine and produces an image, just one that is larger than I want.

Include those lines, and I get an error because there is no external image. When I look through the log file for that specific image, I find

Package pgfkeys Error: I do not know the key '/pgfplots/group/height', to whi ch you passed '10cm', and I am going to ignore it. Perhaps you misspelled it.

With my crappy internet access, I can't really search for anything. I have the pgfplot manual, which shows using the height and width keys in the groupstyle for a tikzpicture groupplot, so I assumed it would be the same for an extikzpicture, but evidently not.

• where does the extikzpicture come from? – percusse Jul 16 '15 at 12:43
• @percusse In the preamble \usepackage{pgfplots} \usepgfplotslibrary{external} – jerH Jul 16 '15 at 23:33

Duh!

I misread the documentation. The height and width keys do not go in the group style.

On page 391 of the pgfplots manual I had seen this line

\begin{groupplot}[group style={group size=2 by 2},height=3cm,width=3cm]


And somehow my brain saw height and width inside the closing }, not outside. Move those keys out of the group style and you're golden.

I need to sleep more :)

I am trying to use something similar to your solution, and I realized that using extikzpicture has some limitations compare to the standard tikzpicture.

For instance, say I define a macro for my figure height in the preamble \newcommand{\fheight}{5cm}; if I now want to use it as the height of my groupplots in a standard tikzpicture, I can simply write height=\fheight as an option of the grouplot environment. However, if I do the same within the extikzpicture, I get the error

! Undefined control sequence. \pgfplots@height ->\fheight

No idea of the reason why.