[Tex/LaTex] Center included pdf graphic

graphics

I'm having trouble to center some graphics (in pdf format) I'm including in a latex document.

I've tried with

\begin{center}
\includegraphics{mygraph.pdf}
\end{center}

and

\begin{figure}
\centering
\includegraphics{mygraph.pdf}
\end{figure}

Both giving me the same output: a graph departing significantly to the right and eating a bit of the right margin.

illustration of the result:

enter image description here

This is not from the original pdf file, in which the graph is perfectly cantered as it has no margins or blanks on the side.

What could I do to center it better?

Best Answer

Here's one approach:

\documentclass{article}
\usepackage{mwe}
\begin{document}

  \begin{figure}
    \centering
    \includegraphics[width=.4\linewidth]{example-image-b}
  \end{figure}

\end{document}

This produces:

enter image description here