# Problem with legend position

I have been using the tikz package to plot my graphs. When I want to describe each graph in a plot, I use "legend entries" and using "legend pos" I can manage the box describing the graphs. But now I want to have some legend entries in a different position as it can be seen in the figure that I have attached it. Here is a code that I want to make a change in it.

\documentclass[12 pt]{article}
\usepackage{times,bm}
\usepackage[affil-it,]{authblk}
\usepackage[margin=1 in]{geometry}
\geometry{landscape,a4paper}
\usepackage{graphicx,fancyref}
\usepackage{cite}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage{float}
\usepackage{multirow,multicol}
\usepackage{tabulary}
\usepackage[flushleft]{threeparttable}
\usepackage{pgfplots,subfigure}
\usepackage[dvipsnames]{xcolor}
\numberwithin{equation}{section}
\usepackage{tikz}
\usepgflibrary{arrows}
\usetikzlibrary{shapes.callouts}
\tikzset{
level/.style   = { thick, },
connect/.style = { dotted, red   },
notice/.style  = { draw, rectangle callout, callout relative pointer=        {#1} },
label/.style   = { text width=2cm }}

\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}[scale=2, ]
\begin{axis}[
xlabel={$\varepsilon$},
ylabel={$E$},
legend entries={$1/2[400]$,$1/2[411]$,$3/2[402]$,$1/2[420]$,$3/2[411]$,$5/2[402]$,$1/2[431]$,$3/2[422]$,$5/2[413]$,$7/2[404]$,$1/2[440]$,$3/2[431]$,$5/2[422]$,$7/2[413]$,$9/2[404]$,},
legend pos=outer north east,legend columns=2 ]
\end{axis}
\end{tikzpicture}
\end{figure}

\end{document}


This code gives me

But I want to have

How can I figure it out?

You can acces to data file clicking the here.

Thanks.

• add node at end of \addplot code line. for more, provide mwe (minimal working example) which generate showed image. – Zarko May 14 '18 at 6:40
• I have added my code dear Zarko. – HS8637 May 14 '18 at 7:03

like this:

since i haven't your tables with plotting data, i simulate only three of them with coordinates. this should be sufficient to see a way, how labels are added to your curves in diagram.

\documentclass[12 pt]{article}
\usepackage{pgfplots}
\pgfplotsset{compat=1.16}

\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}[scale=2]
\begin{axis}[
width=70mm,             % new
xlabel={$\varepsilon$},
ylabel={$E$},
ymin=0, ymax=6,         % new, needed for my coordinates, can be omitted
axis y line=left,       % new
y axis line style={-},  % new
% no marks,             % use in the case if you not like to have marks on curves
clip=false,             % new
font=\footnotesize      % new, but is not important
]
\addplot +[thick]   coordinates {(0,3) (2,5)} node[right] {$1/2[400]$};
\addplot +[thick]   coordinates {(0,2) (2,4)} node[right] {$1/2[411]$};
\addplot +[thick]   coordinates {(0,1) (2,3)} node[right] {$3/2[402]$};
\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}

• Congratulations for your 100K! – egreg May 14 '18 at 8:58