我有一个figure
环境,我用它描绘了两个pgfplots
axis
并排的环境。我想缩放图形,以便它使用完整的\textwidth
。我尝试通过tikzscale
包来实现这一点。然而,我得到了错误
! 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..
同时还有足够的空间来扩大规模。
最小工作示例如下。
\documentclass{article}
\usepackage{currfile}
\usepackage{float} % Improved interface for floating objects.
\usepackage{lipsum} % For test purposes.
\usepackage{pgfplots}
\usepackage{showframe}
\usepackage{tikzscale}
% TikZ libraries.
\usetikzlibrary{calc}
\usetikzlibrary{external}
\tikzset{external/system call={lualatex -shell-escape -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"}}
\tikzexternalize
\usetikzlibrary{plotmarks}
\begin{document}
\lipsum[1]
\begin{figure}[H]
\begin{center}
\tikzset{external/remake next}
\tikzsetnextfilename{\currfiledir tikzpicture}
\includegraphics[width=\textwidth]{\currfiledir tikzpicture.tikz}
\end{center}
\caption{Test caption.}
\end{figure}
\lipsum[2]
\end{document}
的内容tikzpicture.tikz
表示为
\begin{tikzpicture}
\begin{loglogaxis}
[
name=plot_left,
xlabel=$x$,
ylabel=$y$
]
\addplot {x};
\end{loglogaxis}
\begin{loglogaxis}
[
name=plot_right,
at={($(plot_left.outer east)+(5mm,0)$)},
anchor=outer west,
legend style=
{
at={(1,1)},
anchor=north west,
draw=none,
fill=none
},
legend cell align=left,
xlabel=$x$,
ylabel=$y$
]
\addplot {x};
\legend
{
$l_1$
}
\end{loglogaxis}
\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);
\end{tikzpicture}
我该如何解决这个错误?