# [Tex/LaTex] Gaussian ellipsoids using tikz

I'm trying to draw illustrations of Gaussian ellipsoids using shaded ellipses.
In simple terms what I'm after is a way to have a light shade throughout the outer edge of the ellipse and a darker shade towards the centre of the ellipse (i.e the contours of a 2D Gaussian distribution should have the same shade proportional to the density). I've tried radial shading but it's not the effect I'm looking for.

Here is a simple example (which does not produce the shading result I want).

  \begin{tikzpicture}
\def\particles{(20,-3),(22,-5),(22,-7),(19,-8) }
\pgfsetfillopacity{0.6};

\foreach \point in \particles{
\shade[rotate around={30:\point},inner color=green] \point ellipse (1 and 2);
\draw[fill=black] \point circle (2mm);
}
\end{tikzpicture}


Can anyone please suggest a method to draw the Gaussian ellipsoids?

What you could do is layer lots of ellipses on top of each other, each one a little bit smaller and darker than the previous one. This gives the illusion of a smooth gradient, providing there are enough ellipses. In the code below I'm using ten ellipses, but you can adjust that to your liking.

## Code

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\def\particles{(20,-3),(22,-5),(22,-7),(19,-8) }

\foreach \point in \particles{
\foreach\i in {0,0.1,...,1} {
\fill[opacity=\i,green,rotate around={30:\point}] \point ellipse ({1-\i} and {2-2*\i});
}
\fill[black] \point circle (2mm);
}
\end{tikzpicture}
\end{document}


## Result

In the code below, I used 100 ellipses. I also adjusted the opacity by a factor of 0.02. There's no method to this, I just fiddled with the numbers until it looked "right".

\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\def\particles{(20,-3),(22,-5),(22,-7),(19,-8) }
\foreach \point in \particles{
\foreach\i in {0,0.01,...,1} {
\fill[opacity=\i*0.02,green,rotate around={30:\point}] \point ellipse ({1-\i} and {2-2*\i});
}
\fill[black] \point circle (2mm);
}
\end{tikzpicture}
\end{document}