fadingPrimitive[size_, formula_, c_] :=
DensityPlot[
Max[0, formula],
{x, -size, size}, {y, -size, size},
ColorFunction -> (Opacity[#, c] &),
Frame -> False];
smoothlyFadingColorDisk[r_, c_] :=
fadingPrimitive[r, r - Sqrt[x^2 + y^2], c];
smoothlyFadingColorRing[rs_, rb_, c_] :=
fadingPrimitive[rs + rb, rs - Abs[rb - Sqrt[x^2 + y^2]], c];
Up to this point everything works nice. The image size is exactly as large as the actual graphics:
smoothlyFadingColorDisk[1, Purple]
smoothlyFadingColorRing[0.25, 1.25, Blue]
But when I try to combine them, the image size suddenly gets much larger than the actual graphics:
Graphics[{
Inset[smoothlyFadingColorDisk[1, Purple]],
Inset[smoothlyFadingColorRing[0.25, 1.25, Blue]]}]
I tried ImageSize->Scaled[1]
, ImageSize->Full
, ImageSize->All
, ImageSize->Automatic
- all fail or even make the disproportion even greater.
Show[
smoothlyFadingColorRing[0.25, 1.25, Blue],
smoothlyFadingColorDisk[1, Purple]]
This works as expected, but I'd rather avoid show: I want to be able to use Inset
s to be able to reposition the graphics, and it seems I can't use Inset
s with Show
.
Why does this happen? How to set this straight? Thanks in advance!