Is there a possibility in pgfplots to set the margins reserved for the x- and y-label, similarly to gnuplots tmargin, bmargin, lmargin, rmargin.
I would like to have following values for the horizontal direction.
lmargin: 0.3in
graphwidth=\columnwidth-0.4in
rmargin: 0.1in
plotwidth: \columnwidth (=picture width)
For the vertical direction:
bmargin: 0.3in
graphheight=4in-0.4in
tmargin: 0.1in
plotheight: 4in (=picture height)
Following minimal working example tries to scale only the axis (option scale only axis) and then trim with negative values accordingly.
MWE:
\documentclass[class=elsarticle,preprint,5p,twocolumn, 10pt]{standalone}
% NOTE: 'standalone' messes up \textheight,
% \textwidth and \columnwidth (252pt) are fine
\usepackage{pgfplots}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\pgfplotsset{compat=1.12,width=\columnwidth,height=4in}
\begin{document}
\begin{tikzpicture}[trim left=-0.3in, trim right=\columnwidth-0.3in]
% why is there no trim top or bottom?
\begin{axis}[width=\columnwidth-0.4in, height=4in-0.3in, scale only axis]
\addplot [red, mark=*] table {
0 1
2 5.5
3 7.25
4 8
};
\end{axis}
\end{tikzpicture}
\end{document}
Checking the pdf dimensions:
$ pdfinfo *.pdf | grep "Page size:"
Page size: 251.059 x 279.86 pts
The width is almost correct: 251.059pt instead of 252pt. Possibly numerical errors (only single precision). So I can live with this.
But there is no trim top and trim bottom. I couldn't find a workaround for this. Can anyone help me?
Possibly it is also a problem with standalone cropping. tikzscale is really slow, so I would prefer to avoid it. There should be a final picture which I can submit to a journal.
trimcommands are just special cases of setting the bounding box. – Andrew Swann May 19 '15 at 14:57tight background, and play with the frame seps.inner frame x/ysep. – nickpapior May 19 '15 at 15:35