[Tex/LaTex] Put centered text in bottom of image using overpic

graphicshorizontal alignmentoverpic

I have a graph for which I want a centered x-label at the bottom. The idea is to use overpic and then insert som text at the bottom using \put(50,1){some x-label}.

The problem is that \put places the START of the text relative to the image. Is there a way to put the CENTER of the text relative to the image?

Code:

\begin{center}
    \begin{overpic}[width=0.8\textwidth]{graph}
        \put(50,1){some x-label}
    \end{overpic}
\end{center}

I also want a y-label rotated 90deg counter clockwise horisontally centered on the left side of the graph. Is there a way to do this?

Best Answer

   \put(50,1){\makebox(0,0){some x-label}}

will put the (horizontal and vertical) centre of of the text at the specified position.

To rotate text you can use \rotatebox

   \put(50,1){\makebox(0,0){\rotatebox{90}{some x-label}}}