I am trying to draw a sphere in cartesian coordinates. However, I get a half sphere as if np.sqrt gives me only positive values. How can I complete the sphere? Any alternative to np.sqrt?
I know how to draw a sphere in polar coordinates or with sin and cosine functions so I am only interested in drawing it by using x, y, z values such as;
x**2+y**2+z**2=1
Here is the code gives half sphere and the warning;
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure(figsize=(20, 10))
ax = fig.add_subplot(1,2,1, projection = '3d')
xs=np.linspace(-1,1, 100)
ys=np.linspace(-1,1, 100)
xs,ys=np.meshgrid(xs,ys)
zs= np.sqrt(1-xs*xs-ys*ys)
ax.plot_surface(xs, ys, zs, lw = 0, antialiased = True)