# Overlaying two fading circles using TikZ

I have the following MWE which draws two fading filled circles:

\documentclass{article}
\usepackage{pgfplots}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\fill[inner color=red,outer color=white] (0,0) circle (1.8);
\begin{scope}[xshift=4cm]
\fill[inner color=red,outer color=white] (0,0) circle (1.8);
\end{scope}
\end{tikzpicture}
\end{document}


I would like to change the scope xshift to 3cm. The problem is that the circles overlap with the right circle placed on top of that on the left circle. I want the colour intensity to instead add constructively.

A seperate question: How can I add a Gaussian function on top of the circles without the axes? The examples I saw on the TikZ site used the pgfplots package which draws the axes.

We use the fadings library (search the \tikzfading documentation in the PGF/TikZ manual.)

## The output

I think it did not look very pretty with both red disks, so I changed one to blue.

## The code

\documentclass[tikz]{standalone}
[
inner color=transparent!0,
outer color=transparent!100
]
\begin{document}
\begin{tikzpicture}
\tikzset
{
myCircle/.style=
{
red,
}
}
\def\a{1}
\fill[myCircle] (-\a,0) circle (1.8);
\fill[myCircle, blue,] (\a,0) circle (1.8);
\draw plot [samples=200] (\x, {exp(-.5*(\x)^2)}) ;
\end{tikzpicture}
\end{document}

• Marsupilam, thanks! The bounding box can be sorted by moving the \tikzfading and \tikzset commands outside of the \tikzpicture enviroment. – Sid Feb 1 '17 at 15:07
• Thank you. It is enough to take the tikzfading out. I'll edit. – marsupilam Feb 1 '17 at 15:09

I am a little uncertain of how it works, but I think you need Fadings from the TikZ manual section 23.4. Something like this:

\documentclass[border=0.2 cm]{standalone}
\usepackage{tikz}