I would like some help to get two ellipses around two sets of data on my final plot (d) like this:
Here is what I have so far:
\documentclass{article}
\usepackage{tikz,pgfplots}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{groupplots}
\usetikzlibrary{fit,shapes}
\newcommand{\datasetname}{check2.dat}
\begin{filecontents*}{\datasetname}
2 3
1 2
1 1
2 2
4 2
4 1
5 1
\end{filecontents*}
\pagestyle{empty}
\begin{document}
\begin{center}
\begin{tikzpicture}
\begin{groupplot}[group style={group size=2 by 2, horizontal sep=4em, vertical sep=5em}]
\nextgroupplot[xmin=-1, xmax=6, ymin=-1, ymax=5, legend style={font=\fontsize{7}{9}\selectfont}, title = (a) Original Data]
\addplot [only marks, line width = 0.3mm, mark=triangle*, red, mark options={scale=1.2}]table[x index=0, y index=1, col sep=comma, only marks,col sep=space] {\datasetname}; \addlegendentry{$Data$}
\nextgroupplot[xmin=-1, xmax=6, ymin=-1, ymax=5, legend style={font=\fontsize{7}{9}\selectfont}, title = (b) Data with Initial Centroids]
\addplot [only marks, line width = 0.3mm, mark=triangle*, red, mark options={scale=1.2}]table[x index=0, y index=1, col sep=comma, only marks,col sep=space] {\datasetname}; \addlegendentry{$Data$}
\addplot[mark=diamond*, blue, only marks] coordinates {(0,1)};\addlegendentry{$C1$}
\addplot[mark=diamond*, cyan, only marks] coordinates {(2,0)};\addlegendentry{$C2$}
\nextgroupplot[xmin=-1, xmax=6, ymin=-1, ymax=5, legend style={font=\fontsize{7}{9}\selectfont}, title = (c) Data with Centroids after First Iteration]
\addplot [only marks, line width = 0.3mm, mark=triangle*, red, mark options={scale=1.2}]table[x index=0, y index=1, col sep=comma, only marks,col sep=space] {\datasetname}; \addlegendentry{$Data$}
\addplot[mark=diamond*, blue, only marks] coordinates {(3.5,1.25)};\addlegendentry{$C1$}
\addplot[mark=diamond*, cyan, only marks] coordinates {(1.667,2.333)};\addlegendentry{$C2$}
\nextgroupplot[xmin=-1, xmax=6, ymin=-1, ymax=5, legend style={font=\fontsize{7}{9}\selectfont}, title = (d) Data with Centroids after Second Iteration]
\addplot [only marks, line width = 0.3mm, mark=triangle*, red, mark options={scale=1.2}]table[x index=0, y index=1, col sep=comma, only marks,col sep=space]{\datasetname};\addlegendentry{$Data$}
\addplot[mark=diamond*, blue, only marks] coordinates {(4.333,1.333)};\addlegendentry{$C1$}
\addplot[mark=diamond*, cyan, only marks] coordinates {(1.5,2.0)};\addlegendentry{$C2$}
%\node [pos=0.955,
% shape=ellipse,
% rotate=55,
% minimum width=0.35*\pgfkeysvalueof{/pgfplots/width},
% minimum height=0.2*\pgfkeysvalueof{/pgfplots/height},
% very thick,
% draw=green!75!black,
% ] (ellipse) {};
\end{groupplot}
\end{tikzpicture}
\end{center}
\end{document}

