I'm trying to a 3d figure without any plot elements in python. Sort of a 3d version of this.
When I run the code I have added below, I get regular plot
.
I want to remove the axes, axes labels, ticks, and background (and remain only with the surface).
How can I remove them.
Also, is there way to add arrows to the plot?
Here is my code:
import random
import math
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
import numpy as np
pi = 3.14159
bignum = 3
amp = 0.1
mat = []
X = []
Y = []
class mode:
i=0
j=0
phase=0
amp=0
modes = dict()
for i in range(0,3):
submodes = dict()
for j in range (0,5):
if not (i==0 and j==2):
m = mode()
m.i = i
m.j = j
m.amp = amp*random.random()/(pow(i,2) + pow(j-2,2))
m.phase = random.random()*2*pi
submodes[j] = m
modes[i] = submodes
for x in range (0,bignum):
mat.append([])
for y in range (0,bignum):
dz = 0
for i in range (0,3):
for j in range (0,5):
if not (i == 0 and j == 2):
dz += math.cos(i*x*2*pi/bignum + j *y*2/bignum + modes[i][j].phase)*modes[i][j].amp
mat[x].append(dz)
X = np.mgrid[:bignum,:bignum]
print (len(X[0]))
print (len(mat))
fig = plt.figure(figsize=plt.figaspect(2.))
fig.frameon=True
ax = fig.add_subplot(1,1,1, projection='3d')
ax.frameon=False
ax.xticks=[]
ax.yticks=[]
ax.zticks=[]
surf = ax.plot_surface(X[0],X[1],mat,rstride=1, cstride=1,
linewidth=0, antialiased=False)
ax.set_zlim3d(0, 1)
plt.show()
