In my current document I have both pictures from file and tikz pictures. For the output I use both, landscape (for screen reading) and portrait (for print).
For pictures loaded from file i use the code blow to make sure that they are always of an acceptable size.
\begin{figure}
\centering
\includegraphics[keepaspectratio, width=1\textwidth, height=1\textheight]{Filename}
\caption{Figure}
\end{figure}
The problem is that I have not been able to apply the same to my tikx picture as it does not have a dimension by it self. I am using $width=1\textwidth, height=1\textheight$ but that just means that the picture will have a different aspect ratio in portrait and landscape mode.
Is there a simple way to define the aspect ratio (e.g 4:3) of a tikx picture?
Edit 1
I thought I had found a simple solution.
Other than in my example where the height is limited by the textheigt and the width beeing limited by the textwidth I use the same dimension for both, height and width for tikx pictures. The only difference is that I use different factors. Below a short example.
\begin{tikzpicture}
\begin{axis}[
width=0.80\textwidth,
height=0.60\textwidth,
...
With this setup will always have an aspectratios of 4:3 and a width of 80% of the text. The problem however is that with other values the image might get to heigh to fit on one page (e.g. for aspect ratio 1:1).
Any suggestions?
tikzscale
package