I want to build the graph of complex function and use Matplotlib for that. But it can visualize only value of three variable and i want colour my graph as light as much value of fourth variable. Matplotlib allows to do that only with third variable's value. My code (still without fourth variable):
import pylab as pl
from mpl_toolkits.mplot3d import Axes3D
from matplotlib.colors import LinearSegmentedColormap
from matplotlib import cm
import numpy as np
def makeData ():
x = np.arange (-10, 10, 0.1)
y = np.arange (-10, 10, 0.1)
xgrid, ygrid = np.meshgrid(x, y)
zgrid = np.sin (xgrid) * np.sin (ygrid) / (xgrid * ygrid)
return xgrid, ygrid, zgrid
x, y, z = makeData()
fig = pl.figure()
axes = Axes3D(fig, auto_add_to_figure=False)
fig.add_axes(axes)
axes.plot_surface(x, y, z, rstride=4, cstride=4, cmap = cm.jet)
pl.show()
Exactly this code uses value of z and colour graph:
axes.plot_surface(x, y, z, rstride=4, cstride=4, cmap = cm.jet)
Can you help me?