I am using nodes near coords but as you can see the values on the bottom are overlapping. I have tried placing them manually but that hasn't worked either…How to just shift up the nodes so they do not overlap with eachother or the line!?
Thank you!!!!!
\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
compat=newest,
height=0.4\textheight,
enlarge y limits={upper, value=0.3},
ymin=0,
xtick=data,
xtick={\empty},
ytick=data,
enlarge x limits = 0.5,
bar width=24pt,
title={},
symbolic x coords={0,5},
y axis line style={opacity=0},
yticklabels={\empty},
ytick style={draw=none},
axis on top,
major grid style=white,
nodes near coords
]
\addplot [red, line width=2pt]coordinates {(0,.1) (5,.83)};
\addplot [blue, line width=2pt]coordinates {(0,.12) (5,2.4)};
\end{axis}
\end{tikzpicture}
\end{document}
Best Answer
This is one possible solution. Firstly, move
every node near coords
down a little bit viaThen adds to the addplot[options] a particular
nodes near coords
(the blue one) viaraisebox
The result is shown below
Code