I have a figure environment with which I depict two pgfplots axis environments next to each other. I want to scale the figure such that it uses the full \textwidth. I attempt to do so by means of the tikzscale package. I however, get the error

! Package pgfplots Error: Error: Plot width `-144.19234pt' is too small. This cannot be implemented while maintaining constant size for labels. Sorry, label sizes are only approximate. You will need to adjust your width..

while there is plenty of room to scale the figure.

The minimum working example is as follows.


\usepackage{float} % Improved interface for floating objects.
\usepackage{lipsum} % For test purposes.

% TikZ libraries.
\tikzset{external/system call={lualatex -shell-escape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"}}

            \tikzset{external/remake next}
            \tikzsetnextfilename{\currfiledir tikzpicture}
            \includegraphics[width=\textwidth]{\currfiledir tikzpicture.tikz}
        \caption{Test caption.}

The content of tikzpicture.tikz is represented by



        \addplot {x};


        at={($(plot_left.outer east)+(5mm,0)$)},
        anchor=outer west,
        legend style=
            anchor=north west,
        legend cell align=left,

        \addplot {x};



    \draw[dashed,line width=0pt] (plot_left.outer south west) rectangle (plot_left.outer north east);
    \draw[dashed,line width=0pt] (plot_right.outer south west) rectangle (plot_right.outer north east);


How do I resolve this error?

  • Is the fact that externalization is involved here relevant to the problem? If not, I'm tempted to close as a duplicate of your other question. (I can always delete my answer there, if you feel that it reduces the chance of a better one.) Or perhaps you can specify that my suggestion is not an alternative due to the problems you mentioned. Oct 2, 2015 at 13:28
  • @TorbjørnT. No the externalization has nothing to with it. The difference with the question tex.stackexchange.com/questions/230974/… is that in this example, I do not use \matrix. But besides that, the problem is the same: scaling a figure to the \texwidth.
    – Adriaan
    Oct 2, 2015 at 14:46
  • Sorry, didn't notice that, but I dont't think that matters at all to be honest. You get exactly the same error as well. Oct 2, 2015 at 15:31
  • @TorbjørnT. Indeed. Any suggestions for a solution? I unfortunately don't seem to be getting a response. Surprises me a bit, since I'm sure a lot of people have the same problem.
    – Adriaan
    Oct 3, 2015 at 11:17
  • 3
    Some years have passed and I'm running into the same issue in the last days. Have you found any solution for that? I've found out, that using at=(plot2.right of south east), and anchor=left of south west, reduce the error probability. Furthermore scaling the height (if necessary in combination with axisratio) instead of the width reduces the error as well. But this way you cannot scale figures to the width of the line etc. Any help appreciated!
    – Nivek
    Aug 24, 2021 at 18:55


You must log in to answer this question.

Browse other questions tagged .