Currently I am trying to get a glimpse of how a certain value is depending from different input parameters. Thus I created a function in python with this parameters as input. Now I'd like to plot the result. I already managed to get a 3D plot, meaning 2 variables can be taken into consideration at once. I hope there are ways to extend this by using colors etc.
Sample code:
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
def calculation(v,w,x,y,z):
return v+w+x+y+z
#Part for 3D plotting so far:
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x=np.arange(1, 10, 1)
y=np.arange(1, 10, 1)
X, Y = np.meshgrid(x, y)
zs = np.array([calculation(1, 1, x, y, 1) for x,y in zip(np.ravel(X), np.ravel(Y))])
Z = zs.reshape(X.shape)
ax.plot_surface(X, Y, Z)
plt.show()
Edit: With scatter I have come a little further now, so I can display influence of three different parameters now:
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x=np.arange(1, 10, 1)
y=np.arange(1, 10, 1)
z=np.arange(1, 10, 1)
X, Y, Z = np.meshgrid(x,y,z)
zs = np.array([calculation(1,1,x,y,z) for x,y,z in zip(np.ravel(X), np.ravel(Y), np.ravel(Z))])
C = zs.reshape(X.shape)
surf = ax.scatter(X, Y, Z, c=C, linewidth=0, antialiased=False, norm=MidpointNormalize(midpoint=0.), cmap=cm.seismic)
fig.colorbar(surf)
plt.show()