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[margin=1 in]{geometry}
    level/.style   = { thick, },
    connect/.style = { dotted, red   },
    notice/.style  = { draw, rectangle callout, callout relative pointer=        {#1} },
    label/.style   = { text width=2cm }}


\begin{tikzpicture}[scale=2, ]
        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 ]
        \addplot [thick, Apricot]       table {sdg1.dat};
        \addplot [thick, Aquamarine]    table {sdg2.dat};
        \addplot [thick, BurntOrange]   table {sdg3.dat};
        \addplot [thick, black]         table {sdg4.dat};
        \addplot [thick, blue]          table {sdg5.dat};
        \addplot [thick, BlueGreen]     table {sdg6.dat};
        \addplot [thick, CadetBlue]     table {sdg7.dat};
        \addplot [thick, DarkOrchid]    table {sdg8.dat};
        \addplot [thick, Brown]         table {sdg9.dat};
        \addplot [thick, ForestGreen]   table {sdg10.dat};
        \addplot [thick, Goldenrod]     table {sdg11.dat};
        \addplot [thick, Green]         table {sdg12.dat};
        \addplot [thick, cyan]          table {sdg13.dat};
        \addplot [thick, JungleGreen]   table {sdg14.dat};
        \addplot [thick, gray]          table {sdg15.dat};


This code gives me enter image description here

But I want to have

How can I figure it out? enter image description here

You can acces to data file clicking the here.


Related Questions

pgfplot legend on top of grid but below graphs

Updated July 16, 2015 19:10 PM

pslegend bounding box odd while using Cirkuit

Updated June 15, 2017 09:23 AM

Two curves in one plot

Updated September 19, 2017 15:23 PM

Importing plots from third party tools

Updated October 18, 2017 20:23 PM