Way to make radial gradient in 2-d PGFPlot?

Let’s say you wanted to make a plot like:

How would you make a radial gradient using Plots.jl with the PGFPlots backend?

Current attempt:

cur_theta = linspace(0,2*pi)

sphere_x = cos.(cur_theta)
sphere_y = sin.(cur_theta)

plot()

plot!(sphere_x-7.75, sphere_y+5.5, color=1, fill=true, fillopacity=0.95, label="")
plot!(sphere_x-8.75, sphere_y+4.5, color=2, fill=true, fillopacity=0.95, label="")
plot!(sphere_x-7.5, sphere_y+4, color=1, fill=true, fillopacity=0.95, label="")

plot!(ann=[(-4.5,6,"Tritium")])

plot!(sphere_x-6.5, sphere_y-4.25, color=1, fill=true, fillopacity=0.95, label="")
plot!(sphere_x-8, sphere_y-5, color=2, fill=true, fillopacity=0.95, label="")

plot!(aspectratio=:equal)

plot!(ann=[(-9.75,-2.25,"Deuterium")])

plot!([-4.75, -3], [2.75, 1], color=3, label="")
plot!([-4.75, -3], [-2.75, -1], color=3, label="")

plot!([-3, -3.5, -3, -3], [1, 1, 1.5, 1], fill=true, color=3, label="")
plot!([-3, -3.5, -3, -3], [-1, -1, -1.5, -1], fill=true, color=3, label="")

plot!([3, 4.75], [1, 2.75], color=3, label="")
plot!([3, 4.75], [-1, -2.75], color=3, label="")

plot!([4.75, 4.25, 4.75, 4.75], [2.75, 2.75, 2.25, 2.75], fill=true, color=3, label="")
plot!([4.75, 4.25, 4.75, 4.75], [-2.75, -2.75, -2.25, -2.75], fill=true, color=3, label="")

plot!(ann=[(0,0,"+17.6 MeV")])

plot!([-3, +3, +3, -3, -3], [1,1,-1,-1,1], fill=true, color=3, fillopacity=0.2, label="")

plot!(sphere_x+6.75, sphere_y+4, color=1, fill=true, fillopacity=0.95, label="")

plot!(sphere_x+6.75, sphere_y-5, color=1, fill=true, fillopacity=0.95, label="")
plot!(sphere_x+8, sphere_y-6, color=2, fill=true, fillopacity=0.95, label="")
plot!(sphere_x+7.25, sphere_y-3.75, color=2, fill=true, fillopacity=0.95, label="")
plot!(sphere_x+8.5, sphere_y-4.5, color=1, fill=true, fillopacity=0.95, label="")

plot!(ann=[(10,-2.25,"Helium")])

xlims!(-12,12)
ylims!(-8,8)

scatter!([100],[100],color=1,label="Neutron")
scatter!([100],[100],color=2,label="Proton")

plot!(grid=false, ticks=false)
title!("The Nuclear Fusion Reaction")
xlabel!(L"x")
ylabel!(L"y")
2 Likes

Not sure this helps, but if you know how to do it in LaTeX you can probably make it work in

In case there is a feature missing (for passing on the relevant LaTeX code), please open an issue.