I want to know whether there is a way to plot a sphere based on an inputs of:

radius

center of the sphere (x,y,z)

Instead of using sin,cos inputs.

I use this code from the forum:

using Plots
n = 100
u = range(-π, π; length = n)
v = range(0, π; length = n)
x = cos.(u) * sin.(v)'
y = sin.(u) * sin.(v)'
z = ones(n) * cos.(v)'
plotly()
surface(x, y, z)

using Plots; plotlyjs()
function sphere(r, C) # r: radius; C: center [cx,cy,cz]
n = 100
u = range(-π, π; length = n)
v = range(0, π; length = n)
x = C[1] .+ r*cos.(u) * sin.(v)'
y = C[2] .+ r*sin.(u) * sin.(v)'
z = C[3] .+ r*ones(n) * cos.(v)'
return x, y, z
end
surface(sphere(2, [1,2,3]))