I'm fairly new to tikz-dependency,tikz and pgfplot and I am trying to use it for plotting the output of several dependency parsers. However whenever I render a document using PDFLateX or LatexMk I end up with the following output with the graph centered in an odd position.
The code to generate such an output is:
\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{pgfplots}
\usepackage{tikz-dependency}
\pgfplotsset{compat=1.14}
\begin{document}
\begin{figure}[!h]
\centering
\begin{tikzpicture}
\begin{dependency}
\begin{deptext}[column sep=0.2cm]
The \& old \& car \& broke \& down \& in \& the \& car \& park \\
\end{deptext}
\deproot{4}{root}
\depedge{3}{1}{det}
\depedge{3}{2}{amod}
\depedge{4}{3}{nsubj}
\depedge{4}{5}{compound:prt}
\depedge{9}{6}{case}
\depedge{9}{7}{det}
\depedge{9}{8}{compound}
\depedge{4}{9}{nmod:in}
\end{dependency}
\end{tikzpicture}
\caption{Stanford Output Sentence 1}
\end{figure}
\end{document}
I'm using:
- Mac OS X 10.13.2
- pdfTeX 3.14159265-2.6-1.40.18 (TeX Live 2017) or
- LatexMk 4.52c with the same issue with both build tools.
The caption leads me to believe the figure is centered but I guess some part of how I declare the tikzpicture might be wrong. I'm not sure how to solve this and I hope someone else has come across this before and workout out how to fix this.

\centeringinside thetikzpicture? – Phelype Oleinik Jan 02 '18 at 16:25\begin{tikzpicture}...\end{tikzpicture}, just dive straight in with\begin{dependency}.... Remove those two lines results in a centered picture. – Andrew Swann Jan 02 '18 at 16:37