# Removing imperfections in circle with color gradient edge

I am trying to draw a red circle with a colour gradient fading into white on the edge. The way I am currently doing it is to first define a smooth step function and draw a rectangular block with a color gradient defined by the smooth step function:

smoothstep[x_] := Piecewise[{{0, x <= -(1/2)}, {-20*(x + 1/2)^7 + 70*(x + 1/2)^6 - 84*(x + 1/2)^5 + 35*(x + 1/2)^4, -(1/2) < x < 1/2}, {1, x >= 1/2}}]

img = Rasterize[DensityPlot[smoothstep[x], {x, 0, 4}, {y, -4, 4}, ColorFunction -> Function[{x, y}, Hue[1, x, 1]], Frame -> False, PlotRangePadding -> None]


which seems to be successful

Then I applied this colour gradient to a circle as a texture

ParametricPlot[{r*Cos[t], r*Sin[t]}, {r, 0, 1}, {t, 0, 2 Pi}, Mesh -> False, BoundaryStyle -> None, Axes -> False, Frame -> False, PlotStyle -> {Opacity[1], Texture[img]}]


which is mostly successful, apart from 1) the white dot at the centre of the circle, and 2) the faint concentric red line outside.

How do I remove these imperfections in the resulting image? Should I change my approach?

• Your code sample can't produce the posted image, please double check it. Mar 15, 2020 at 4:19

One approach would be to draw a red disk and then filter it to blur the edges:

GaussianFilter[Image[Graphics[{White, Disk[], Red, Disk[{0, 0}, 0.5]}]], 20]


This is, more or less, what Photoshop would call "feathering" of the red region into the white background.

Alternative approaches:

### 1. RadialGradientImage:

RadialGradientImage[{Red, White, White}, ImageSize -> Medium]


### 2. ParametricPlot + ColorFunction + Blend

ParametricPlot[r {Cos[t], Sin[t]}, {r, 0, 1}, {t, 0, 2 Pi},
Mesh -> None, BoundaryStyle -> None, Axes -> False, Frame -> False,
ColorFunction -> (Blend[{Red, White}, #3] &)]


### 3. ChartElementDataFunction "GradientBubble"

Graphics[ChartElementDataFunction["GradientBubble",
"ColorScheme" -> (Lighter[Red, #] & /@ Subdivide[4]),

### 4. Blur
Blur[Graphics[{Red, Disk[]}, PlotRangePadding -> Scaled[.2]], 50]