# Problem with legend position

by Hadi Sobhani   Last Updated May 14, 2018 07:23 AM

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.

Tags :