0

I plot a graph using pgfplots package. I want to change the location and size of the legends in the plotted graph. The code and graph are attached.

\begin{figure}
\begin{tikzpicture}
\begin{axis}[
    xlabel={Nodes},
    ylabel={Power (m/W)},
    width=9.6cm,height=8cm,
    xmin=0, xmax=7.7,
    ymin=0, ymax=1.80,
    xtick={0,2.2,3.3,4.4,5.5,6.6,7.7},
    ytick={0,.20,.40,.60,.80,1.00,1.20,1.40,1.60},
    legend pos=north west,
    ymajorgrids=true,
    grid style=dashed,
]
\addplot[
    color=red,
    mark=square,
    line width=2pt
    ]
    coordinates {
    (2.2,.15)(3.3,.15)(4.4,.15)(5.5,.15)(6.6,.15)(7.7,.15)};
    \addplot[
    color=blue,
    mark=triangle, line width=2pt
    ]
    coordinates {
    (2.2,.52)(3.3,.49)(4.4,.52)(5.5,.51)(6.6,.48)(7.7,.49)};
    \addplot[
    color=green,
    mark=*, line width=2pt
    ]
    coordinates {
    (2.2,.97)(3.3,.93)(4.4,.96)(5.5,.98)(6.6,.93)(7.7,.96)};
    \addplot[
    color=yellow,
    mark=x, line width=2pt
    ]
    coordinates {
    (2.2,1.22)(3.3,.98)(4.4,1.01)(5.5,1.10)(6.6,1.02)(7.7,1.09)};
    \legend{LPM, CPU, Radio Listen,Radio Transmit}
\end{axis}
\end{tikzpicture}
\caption{Analysis of Power Consumption}
\label{}
\end{figure}
Torbjørn T.
  • 206,688

0 Answers0