I already tried to create a legend with pgfplots but it seems that conflicts with tikz-uml library (another tikzpicture that I have in the same file) so I want to know how can I create a legend with this example (taken from http://www.woggie.net/2012/07/16/drawing-feature-models-in-pgf-tikz/):
\documentclass[tikz]{standalone}
\usetikzlibrary{matrix,arrows,positioning,shadows}
\tikzset{
feature/.style={draw, inner sep=1.5mm, font=\small\sffamily, fill=white, drop shadow},
opt/.style={fill=white}}
\begin{document}
\begin{tikzpicture}[node distance=.8cm]
\node[feature] (phone) {Phone};
\matrix (sub)[matrix of nodes,
below=of phone,
column sep=3mm, row sep=0mm, nodes=feature]{
Processor & %sub-1-1
NFC & %sub-1-2
Camera & %sub-1-3
4G \\ %sub-1-4
};
\matrix (group)[matrix of nodes,
below=of sub-1-1,
column sep=3mm, row sep=0mm, nodes=feature]{
ARM & %group-1-1
OMAP & %group-1-2
Snapdragon \\ %group-1-3
};
\draw (phone.south) -- (sub-1-1.north);
\draw (phone.south) -- (sub-1-2.north);
\draw (phone.south) -- (sub-1-3.north);
\draw (phone.south) -- (sub-1-4.north);
\draw (sub-1-1.south) -- (group-1-1);
\draw (sub-1-1.south) -- (group-1-2);
\draw (sub-1-1.south) -- (group-1-3);
%cross-tree constraint
\draw[-triangle 45,dashed] (sub-1-4) |- (group-1-3)
node[pos=.6,anchor=south east] {implies};
%optional / mandatory
\draw[opt] (sub-1-2.north) circle (.8mm);
\draw[opt] (sub-1-4.north) circle (.8mm);
\fill[draw] (sub-1-1.north) circle (.8mm);
\fill[draw] (sub-1-3.north) circle (.8mm);
%Group arc
\begin{scope}
\path[clip] (sub-1-1.south) -- (group-1-1.center) -- (group-1-3.center) -- cycle;
\draw (sub-1-1.south) circle (.5cm);
\end{scope}
\end{tikzpicture}
\end{document}
The idea is to create a legend at the top right like this example (taken from wikipedia) 
Can anyone help me? Thank you!

standalonedocument for the picture that needs pgfplots and include it viaincludegraphicsor viceversa. – Claudio Fiandrino Nov 04 '13 at 11:09