When you specify width and height of a plot in pgfplots, the latter estimates the scaling so it can fit everything. The problem is that this estimate is too conservative. Consider the following MWE:
\documentclass[12pt, twoside, paper = B5]{scrbook}
\usepackage{fontspec}
\usepackage{unicode-math}
\usepackage{pgfplots}
\setmainfont{Libertinus Serif}
\setmathfont{Libertinus Math}
\pgfplotsset{compat = 1.17}
\usetikzlibrary{backgrounds}
\begin{document}
\noindent\begin{tikzpicture}
\begin{scope}[on background layer]
\fill[black!20] (0, 0) rectangle (57mm, 32mm);
\end{scope}
\begin{axis}[
anchor = outer south west
, width = 57mm
, height = 32mm
, axis equal
, axis lines = middle
, axis line style = {-stealth, thick}
, enlargelimits = false
, tick style = {draw = none}
, ymin = {0.0}
, xtick = \empty
, ytick = \empty
, xlabel = {$x$}
, ylabel = {$y$}
, xlabel style = {
at = {(current axis.right of origin)}
, anchor = base west
, font = \footnotesize
}
, ylabel style = {
at = {(current axis.above origin)}
, anchor = base west
, font = \footnotesize
}
]
\addplot+[
no markers
, thick
, domain = -2.08869:8.37188
, samples = 201
] ({x - 1.5 * sin(x r)}, {1.5 - 1.5 * cos(x r)});
\end{axis}
\end{tikzpicture}
\end{document}
It produces the following output:
The gray rectangle designates the desired width and height. You can see that the actual plot size is far smaller than the specified dimensions. I know about scale only axis, but it will overshoot the size, I really need it to fit.



scale only axis=trueworks fine. – Excelsior Apr 23 '21 at 07:29scale only axis. – facetus Apr 23 '21 at 07:38overshoot the size? – Excelsior Apr 23 '21 at 07:40scale only axisis enabled,widthandheightapply only to the axis rectangle. Consequently, the resulting figure is larger that width and height (because of any axis descriptions)." – facetus Apr 23 '21 at 07:42node {$x$}in a temporary box. Its width was all I needed to manually estimate the exact width. – facetus Apr 25 '21 at 16:33