I am trying to make a scatter plot with some data points (x,y,z,radius) and this is my result up to now:
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
x = np.random.rand(20)
y = np.random.rand(20)
z = np.random.rand(20)
r = np.random.rand(20)
plt.rc('text', usetex=True)
plt.rcParams['text.latex.preamble']=[r"\usepackage{amsmath}"]
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.scatter(x, y, z, s=np.pi*r**2*100, c='blue', alpha=0.75)
ax.set_xlabel(r'$x$ $\left[\frac{\text{Mpc}}{h}\right]$')
ax.set_ylabel(r'$y$ $\left[\frac{\text{Mpc}}{h}\right]$')
ax.set_zlabel(r'$z$ $\left[\frac{\text{Mpc}}{h}\right]$')
#plt.savefig('spheres.png')
plt.show()
How can I improve this plot in order to have no overlap of the x- and y-labels with the tics?
And it there a possibility to make spheres instead of areas in this 3D-plot?