2

Problem: Labels from table are placed right, but overlap. Is there a way to automate alignment of the labels near nodes so that labels do not overlap? This is a small example but I have bigger table where this problem agravates. How can I select only some specific names from the table? How can I force that the label name is printed in two lines. Entering "\" for line break within the name in the table doesn't work.

\documentclass[12pt,a4paper]{report}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\usepackage[german]{babel}
\usepackage{filecontents}
\usepackage[dvipsnames,svgnames,x11names,fixpdftex]{xcolor}
\usepackage{pgfplots, pgfplotstable
} %Diagramme
\pgfplotsset{compat=newest,
every axis/.append style={
font=\small,
%line width=.7pt,
%tick style={line width=.7pt, color=black}
}
}  %Abstand Abszissenbeschriftung in Diagrammen
\begin{document}

\begin{filecontents}{rankdist.dat}
rang    distrib tls socut   p2012   rbbrl
1   {Sony (Columbia)}   27  24.692  21.790987           254.265931
2   {Fox}   25  22.825  21.096097   219.680717
3   {Disney}    16  17.640  17.141172   200.716283
4   {Warner}    28  19.050  17.716110   197.348198
5   {Paris (SM)}    39  21.248  17.631287   189.518046
6   {Paramount} 12  16.803  12.716975   142.275706
7   {Imagem (Wmix)} 44  17.409  12.419712   136.702831
8   {Downtown/Paris/Riofilme}   6   11.473  9.876740            100.209045
9   {Universal} 17  13.945  9.162490    95.913858
10  {Califórnia (Antonio Fernandes)}    22  3.449   1.763263            21.285077
\end{filecontents}
\begin{figure}[thbp]
\caption {Reihung der Verleiher 2012}\label{abb:rankdist}
\begin{center}
%\small
\begin{tikzpicture}[scale=1]
\begin{axis}[
%colormap={redgreen}{color=(Red) color=(YellowOrange)color=(YellowGreen)         color=(Green)},
width=0.95\textwidth,height=0.4\textheight,
%scale only axis,
axis x line=bottom,
axis y line=left,
tick align=center,
%minor ytick={1,2,...,24},
yminorgrids=true,
ymajorgrids=true,
x tick label style={/pgf/number format/1000 sep=},
x tick label style={rotate=45, anchor=north east},
y tick label style={/pgf/number format/1000 sep=},
%xmin=0,xmax=200,
%unbounded coords=jump,
%xtick={1971,1973,...,2011},
%minor xtick={1972,1974,...,2010},
%ymin=0,ymax=3,
%ytick={0,5,...,25},
ylabel={Belegte Kinosäle in Tausend},
xlabel={Bruttoeinspielergebnisse in Mio. BRL},
enlargelimits=0.05,
legend columns=1,
legend style={at={(0,1)},anchor=south west, draw=none},
legend cell align=left
]
\addplot[
    scatter,
    only marks,
    scatter src=explicit,
    visualization depends on=\thisrow{p2012}\as\pub,
    visualization depends on=\thisrow{tls}\as\tls,
    scatter/@pre marker code/.append style={/tikz/mark size=\tls/10}
]
table[x=rbbrl,y=socut,meta=tls]{rankdist.dat};

\addplot[
    scatter,
    only marks,
    no markers,
    scatter src=explicit symbolic,
%    visualization depends on=\thisrow{tls4}\as\tlsfour,
%    scatter/@pre marker code/.append style={/tikz/mark         size=1.5*\tlsfour}, 
       nodes near coords, anchor=south west,
       every node near coord/.append style={font=\small,           black,
                   %yshift=.1ex,
                   %xshift=.2ex
               },
]
table[x=rbbrl,y=socut,meta=distrib]{rankdist.dat};
\end{axis}

\end{tikzpicture}
\end{center}
\end{figure}
\end{document}
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. You only need to indent code by 4 spaces to get the correct display on this site. – Andrew Swann Jan 5 '14 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.