How can I place the axis of a 3D plot inside the graph itself instead of on the graph edges?
I need this:
Instead of my current axis which are by default on the edges of the plot box:
Code:
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
fig = plt.figure()
ax = fig.add_subplot(2, 1, 1, projection='3d')
x = np.linspace(-1, 1, 300)
# equivalent to f=R(x)*e^ix
f = np.e**(15*1j*x - 18 * x**4)
real_f = np.real(f)
im_f = np.imag(f)
f_conj = np.conjugate(f)
im_f_conj = np.imag(f_conj)
# 1st plot
ax.scatter(x, real_f, im_f, label='Ψ ', color='b')
plt.title("The complex conjugate of Ψ\nis its mirror image.")
ax.legend()
ax.set_xlabel("x")
ax.set_ylabel("Re")
ax.set_zlabel("Im")
# ax.set_axis_off() removes the box as well
ax.set_xticks([])
ax.set_yticks([])
ax.set_zticks([])
# 2nd plot
ax = fig.add_subplot(2, 1, 2, projection='3d')
ax.scatter(x, real_f, im_f_conj, label='Ψ *', color='r')
ax.legend()
ax.set_xlabel("x")
ax.set_ylabel("Re")
ax.set_zlabel("Im")
ax.set_xticks([])
ax.set_yticks([])
ax.set_zticks([])
plt.show()