2

I am using pgfplot to make a 2D plot with the nodes labelled. However, some of the text labels interfere with each other as they're too close. The default positioning of text labels in pgfplot seems to be above the node. Is it possible to position them beside the node?

This is what I have (had to make the y axis semilogy to increase the spacing between points)

enter image description here

Here's what I want it to be (pardon my poor photoshopping skills)

enter image description here

The pgfplot code I am using is as described here: Update reference labels in scatter plots

picasso
  • 616

1 Answers1

5

I guess nodes near coords align=right does what you're after.

enter image description here

\documentclass[border=2mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.9}
\begin{document}

\begin{tikzpicture}
\begin{axis}[
  width=6cm,xmax=0.4, % these were just for the example
  nodes near coords align=right
  ]
\addplot+[nodes near coords,only marks,
  point meta=explicit symbolic]
  table[meta=label] {
x y label
0.3 0.2 [1]
0.2 0.1 [2]
 };
\end{axis}
\end{tikzpicture}
\end{document}
Torbjørn T.
  • 206,688