In this group plot how do I add labels to individual graphs. I want to label each graph as (a), (b), (c)…
\documentclass[margin=5mm]{standalone}
\usepackage{pgfplots}
\usetikzlibrary{matrix}
\usepgfplotslibrary{groupplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{groupplot}[group style={group size= 2 by 4},height=5cm,width=6.4cm]
\nextgroupplot[title=type1,ylabel={Range1 }]
\addplot[blue] {x};\label{plots:plot1}
\addplot[red] {x^2};\label{plots:plot2}
\addplot[green] {2*x};\label{plots:plot3}
\coordinate (top) at (rel axis cs:0,1);% coordinate at top of the first plot
\nextgroupplot[title=type2]
\addplot[blue]{x};
\nextgroupplot[ylabel={Range2 }]
\addplot[blue]{x};
\nextgroupplot
\addplot[blue]{x};
\nextgroupplot[ylabel={Range3 }]
\addplot[blue]{x};
\nextgroupplot
\addplot[blue]{x};
\nextgroupplot[xlabel={Number of Threads},ylabel={Range4 }]
\addplot[blue]{x};
\nextgroupplot[xlabel={Number of Threads}]
\addplot[blue]{x};
\coordinate (bot) at (rel axis cs:1,0);% coordinate at bottom of the last plot
\end{groupplot}
\path (top-|current bounding box.west)--
node[anchor=south,rotate=90] {throughput}
(bot-|current bounding box.west);
% legend
\path (top|-current bounding box.north)--
coordinate(legendpos)
(bot|-current bounding box.north);
\matrix[
matrix of nodes,
anchor=south,
draw,
inner sep=0.2em,
draw
]at([yshift=1ex]legendpos)
{
\ref{plots:plot1}& curve 1&[5pt]
\ref{plots:plot2}& curve2&[5pt]
\ref{plots:plot3}& curve 3\\};
\end{tikzpicture}
\end{document}
output:
Best Answer
You can use
group names
key and with the help of positioninglibrary
ad a node below every plot like:Here
c1r1
meanscolumn 1 and row 1
.You may have to adjust the
vertical sep
so as to accommodate these nodes like I did (1.5cm).