# Positioning labels to an existing empty plot using tikz

Can you help me in correctly positioning labels to an existing empty plot using tikz ?

My problems are:

• my labels are too far from the axes;
• my labels are not centered.

Here is the empty plot

and here is what I currently do to superimpose axis labels:

\documentclass[a4paper, 11pt]{article}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath, amssymb}
\usepackage{tikz}

\begin{document}

\begin{figure} \centering
\begin{tikzpicture}
\node (plot) {\includegraphics[scale=0.7]{plot.pdf}};
\node at (plot.west) {$y$};
\node at (plot.south) {$x$};
\end{tikzpicture}
\caption{My graphic.}
\end{figure}

\end{document}


• The easiest way for this particular problem would be \node at ([xshift=1cm]plot.west) {$y$}; and \node at ([yshift=1cm]plot.south) {$x$}; where you will replace 1cm with needed distance. But I'd suggest to draw the complete graphic with pgfplots. You will find a lot of examples and help here. – Ignasi Jun 4 '13 at 12:25

I am guessing that the labels are too far away because the pdf file contains a lot of white space around the graph. You can use the trim option of \includegraphics to effectively trim that unwanted white space, like so :

\documentclass[a4paper, 11pt]{article}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amsmath, amssymb}
\usepackage{tikz}

\begin{document}

\begin{figure} \centering
\begin{tikzpicture}
\node (plot) {\includegraphics[scale=0.7, trim=1cm 1cm 0 0]{plot.pdf}};
\node at (plot.west) {$y$};
\node at (plot.south) {$x$};
\end{tikzpicture}
\caption{My graphic.}
\end{figure}

\end{document}


where in trim=l b r t, l, b, r and t correspond to left, bottom, right and top respectively. Hopefully, this would also solve the centering problem.

• Looks nice! I did not know the trim option. Let me try and I will probably accept your answer very soon. – Marco Jun 4 '13 at 13:07