I have created a graph with pgfplots and adjusted the bounding box to the axes. When I include the pdf of the graph in my main tex-document with includegraphics
, I want to see the axes labels which are outside of the bounding box. Afaik, the axes labels are still within the pdf however are clipped.
pgfplotsclipped.tex
\documentclass[class=elsarticle,preprint,5p,twocolumn, 10pt]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{calc}
\usetikzlibrary{positioning}
\usetikzlibrary{backgrounds}
\usetikzlibrary{pgfplots.groupplots}
\pgfplotsset{compat=1.12}
\begin{document}
\begin{tikzpicture}[inner frame sep=0]
\begin{axis}[%
clip=false,
width=\columnwidth-0.4in,
height=4in-0.5in,
scale only axis,
axis x line=bottom,
axis y discontinuity=parallel,
xmin=360, xmax=600,
ymin=0, ymax=7,
enlargelimits=false,
]
\addplot coordinates {
(420,2)
(500,6)
(590,4)
};
\end{axis}
\pgfresetboundingbox
\path
(current axis.south west) -- ++(-0.4in,-0.4in)
rectangle (current axis.north east) -- ++(0.0in,0.1in);
\end{tikzpicture}
\end{document}
main.tex
\documentclass[5p]{elsarticle}
\usepackage[]{graphicx}
\begin{document}
\fbox{\includegraphics[viewport=0 0 400 300,clip=false]{pgfplotsclipped.pdf}}
\end{document}
I was hoping the clip
option of graphicx
what allow this:
\includegraphics[clip=false]{pgfplotsclipped.pdf}
$ texdoc grfguide.pdf
clip Either ‘true’ or ‘false’ (or no value, which is equivalent to
‘true’). Clip the graphic to the bounding box.
'Make visible node text outside of pgfplot axes range'
suggests to add to the axis command in my pgfplotsclipped.tex clip=false
which did not help either.
A similar question was asked regarding inkscape: Including graphic outside bounding box using graphicx and pdflatex
Best Answer
The job, which generates the plot can also calculate the parameters for the
trim
option for later inclusion via\includegraphics
.The output for option
trim
is:Then the image can be included with parts of the image sticking outside. The red frame shows the space, TeX uses for the image.
The first image sticks into the left and right margin and is scaled to the available width. The second example limits the box to the axis area with a larger scaling of the image. The parameters for
trim
remains the same regardless of the scaling.