Is it possible to scale a tikz
figure to the maximum size possible for the page with the text that is present on it using some parameters? For example, are there some parameters such that
\usepackage{float}
\usepackage{tikz, pgfplots}
\begin{document}
\begin{figure}[H]
\begin{tikzpicture}[scale = **SOMETHING_HERE_TO_AUTO_SCALE_TO_MAX_SIZE_ON_PAGE?**]
% ... code to draw figure
\end{tikzpicture}
\end{figure}
\end{document}
The only way I have been achieving this is by trial and error.
By this I mean I try
\begin{figure}[H]
\begin{tikzpicture}[scale = 1]
% ... code to draw figure
\end{tikzpicture}
\end{figure}
It fits on the page so can I make it bigger? Try
\begin{figure}[H]
\begin{tikzpicture}[scale = 2]
% ... code to draw figure
\end{tikzpicture}
\end{figure}
It's too big, so I scale down
\begin{figure}[H]
\begin{tikzpicture}[scale = 1.5]
% ... code to draw figure
\end{tikzpicture}
\end{figure}
Ok it fits again. Can I make it bigger?
... etc.
Is there an easy way for latex to auto adjust the picture to the maximum size possible on the current page with all text, other figures etc. that are already present?
scale
option. You can use\resizebox{\textwidth}{!}{\begin{tikzpicture}...\end{tikzpicture}}
but that will scale the text as well.\maxsizebox*{\textwidth}{<max height>}{\begin{tikzpicture}...\end{tikzpicture}}
where you replace<max height>
with whatever is the maximum height that you want to have. Needs\usepackage{adjustbox}
. For<max height>
you can use\dimexpr\pagegoal-\pagetotal-1cm\relax
where\pagegoal-\pagetotal
is roughly the space left on the page and the-1cm
is to account for inaccuracies.