This question is related to the answer of tcolorbox: get height of actual box from inside box
Is it possible to get the newly defined option remember height working with
\usetikzlibrary{external} \tikzexternalize and \usepackage{tikzscale}?
Without externalization I don't know how to handle many plots with lots of data :-(
Please help me again.
\documentclass{article}
\usepackage[breakable]{tcolorbox}
\usepackage{pgfplots}\pgfplotsset{compat=1.9}
\usetikzlibrary{external}
\tikzexternalize %%%%%%% problem here %%%%%%%%
\usepackage{tikzscale}
\begin{filecontents}{tikzimage.tikz}
\begin{tikzpicture}
\begin{axis}[xlabel=time,ylabel=value]
\addplot{x^2};
\end{axis}
\end{tikzpicture}
\end{filecontents}
\makeatletter
\tcbset{%
remember height/.style={before upper={%
\iftcb@fixedheight%
\tcbdimto#1{\kvtcb@top@rule@stand+\kvtcb@bottom@rule@stand+\kvtcb@boxsep*2+\kvtcb@top+\kvtcb@bottom}%
\iftcb@hasTitle%
\tcbdimto#1{#1+\ht\tcb@titlebox+\dp\tcb@titlebox+\kvtcb@title@rule+\kvtcb@boxsep*2+\kvtcb@toptitle+\kvtcb@bottomtitle}%
\fi%
\tcbdimto#1{\kvtcb@height@fixed-#1}%
\else%
\tcbdimto#1{4cm}% fallback
\fi%
}},
}
\makeatother
\begin{document}
\begin{tcolorbox}a\\a\\a\end{tcolorbox}
\begin{tcolorbox}
\includegraphics[width=\linewidth,height=8cm]{tikzimage.tikz}
\end{tcolorbox}
\begin{tcolorbox}[%
height fill,
remember height=\myheight,
]
\includegraphics[width=\linewidth,height=\myheight]{tikzimage.tikz}
\end{tcolorbox}
\end{document}


\documentclass[tikz]{standalone}. The result will be a pdf file with as many pages as plots, and each page cropped to plot dimensions. In your main file you can include plots with command\includegraphics[page=..., other options]{your-plots-file}, or into atcolorbox-rasterwith\tcbincludepdf. http://tex.stackexchange.com/a/214787/1952, http://tex.stackexchange.com/a/99272/1952 – Ignasi Jan 27 '16 at 16:08\usepackage{tikzscale}can do that. – Tobias Jan 28 '16 at 15:04widthandheight\includegraphicsoptions. Although in this case text is also scaled. – Ignasi Jan 28 '16 at 15:35tikzscalewithexternalizethat automates most of the work. – Tobias Jan 28 '16 at 17:05