I have a beamer frame inside which I want to include a figure composed of 3 independent plots, like this:
Please note that each one of these has completely different axis domain and unit vector ratio*. So, if I am not wrong, groupplot is not suitable for this situation.
I created the following .tikz file:
% myPlot.tikz
\begin{tikzpicture}
\begin{axis}[domain=-5:5,unit vector ratio*=2 1]
\addplot {x};
\end{axis}
\begin{scope}[yshift=-7cm]
\begin{axis}[domain=-1:3,unit vector ratio*=1 2]
\addplot {-x};
\end{axis}
\end{scope}
\begin{scope}[yshift=-7cm,xshift=8cm]
\begin{axis}[domain=-2:10,y domain=0:4,unit vector ratio*=1 0.8]
\addplot {x*x};
\end{axis}
\end{scope}
\end{tikzpicture}
And inside my beamer frame I have
% main.tex
\documentclass[dvipsnames]{beamer}
\usepackage{tikz,pgfplots,graphicx,siunitx,tikzscale}
\pgfplotsset{compat=1.17}
\usepackage{geometry,xcolor}
\geometry{paperwidth=148mm,paperheight=96mm}
\useoutertheme[width=20mm]{sidebar}
\usecolortheme{beaver}
\begin{document}
\begin{frame}{Algebra and Geometry}
\begin{figure}
\includegraphics[width=\textwidth,height=230pt]{myPlot.tikz}
\end{figure}
An additional line of text.
\end{frame}
\end{document}
But I get an error
! Dimension too large.
<recently read> \pgfmath@x
What is the correct way of creating such figure?
I am really having hard time at it, and would really like to solve this issue soon.
Desired output is
(Made artificially with Windows Paint)
I also tried
\resizebox{\textwidth}{194pt}
{
\input{myPlot.tikz}
}
Bit it stretches the figure:
Needless to say, the real figure I am working on is composed of 3 much more complicated axis environments, one of which is a surf and the other is a curve in the 3d space..
I guess that the problem starts with the scope environment that I defined that calls for a an x and y shift specified in cm's.
I think that the best way is to let TeX decide what should be xshift and yshift, and to be calculated according to the figure width and height inside includegraphics.
This where I am asking for you help.
Update:
I just learned that one can do
% myPlot.tikz
\begin{tikzpicture}
\pgfplotsset{width=\textwidth,height=194pt}
\begin{axis}[domain=-5:5,unit vector ratio*=2 1]
% rest of file..
\end{tikzpicture}
But still I shifted the begin{axis} in the x and y direction, by some values in cm, after a few trial and errors, until I got a satisfactory output.
I wonder if there is a better solution.



tikzpictures, defining an appropriate size for eachaxis, e.g.width=\linewidth, height=0.3\linewidthfor the first one, without involvingtikzscale. – Torbjørn T. Jun 15 '21 at 17:44