:)
, , Z , , NaN. :
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
kvec = np.linspace(-np.pi,np.pi,101)
kx,ky = np.meshgrid(kvec,kvec)
E = np.sqrt(1+4*np.cos(3*kx/2)*np.cos(np.sqrt(3)/2*ky) + 4*np.cos(np.sqrt(3)/2*ky)**2)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(kx,ky,E,cmap='viridis',vmin=-E.max(),vmax=E.max(),rstride=1,cstride=1)
ax.plot_surface(kx,ky,-E,cmap='viridis',vmin=-E.max(),vmax=E.max(),rstride=1,cstride=1)
Elim = 1
E[E>Elim] = np.nan
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
ax.plot_surface(kx,ky,E,cmap='viridis',rstride=1,cstride=1,vmin=-Elim,vmax=Elim)
ax.plot_surface(kx,ky,-E,cmap='viridis',rstride=1,cstride=1,vmin=-Elim,vmax=Elim)
plt.show()
:

, : : ( ), , , , , plot_surface plot_surface. Matplotlib 2d , 3d - - . , ( , , ).
, : , nan, , , . , , , zlim, . :
from matplotlib.cm import get_cmap
Elim = 1
cmap = get_cmap('viridis')
colors_top = cmap((E + Elim)/2/Elim)
colors_bott = cmap((-E + Elim)/2/Elim)
colors_top[E > Elim, -1] = 0
colors_bott[-E < -Elim, -1] = 0
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
s1 = ax.plot_surface(kx, ky, E, facecolors=colors_top, rstride=1, cstride=1)
s2 = ax.plot_surface(kx, ky, -E, facecolors=colors_bott, rstride=1, cstride=1)
ax.set_zlim(-Elim, Elim)
plt.show()
: 
, , 3 , matplotlib (3.0.2) ( ) . , . , , , .