[Tex/LaTex] Spacing between image and text in pgfplot legend

pgfplots

Using the following code:

\begin{tikzpicture}
\begin{axis}[
xmin=0, xmax=4, ymin=0, ymax=10,
width=9cm, height=6cm,
legend style={draw=none}]

\addplot[only marks,color=red] coordinates {
(0, 10) (0.5, 8.5) (1, 2) (2, 0.5) (3.5, 1.9)};
\addlegendentry{Experimental Data Point}

\end{axis}
\end{tikzpicture}

I am getting the image:

enter image description here

The symbol in the legend is a bit close to the legend text for my taste. Is there anyway to increase the spacing between the two?

Best Answer

According to the pgfplots manual,

The legend is a TikZ-matrix, so one can use any TikZ option which affects nodes and matrices [...]. The matrix is created by something like

\matrix[style=every axis legend] {
    draw plot specification 1 & \node{legend 1}\\
    draw plot specification 2 & \node{legend 2}\\
    ...
};

Thus, you can increase the column sep of the legend style to achieve the desired effect.

Code

\documentclass[border=2pt]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.8}

\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=0, xmax=4, ymin=0, ymax=10,
width=9cm, height=6cm,
legend style={draw=none,column sep=10pt}]

\addplot[only marks,color=red] coordinates {
(0, 10) (0.5, 8.5) (1, 2) (2, 0.5) (3.5, 1.9)};
\addlegendentry{Experimental Data Point}

\end{axis}
\end{tikzpicture}
\end{document}

Output

enter image description here

Related Question