1

I have 4 D data, with 3 independent variables (x,y,z), and a fourth variable m (represent in color) which is a function of the x,y, and z. The code below generates a plot with the three variables, and m with shades of a color.

Is there a way to interpolate between the different points with variation in the shades of color so to form a color surface in 3-D?

from __future__ import division
import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d import axes3d



def fourVariable_colorPlot():
    fig = plt.figure()
    ax = fig.add_subplot(111, projection='3d')


    x = np.random.standard_normal(100)
    y = np.random.standard_normal(100)
    z = np.random.standard_normal(100)
    c = []
    for i in xrange(100):
        c.append(x[i]**2 + y[i] ** 3 + z[i] ** 4)

    ax.scatter(x, y, z, c=c, cmap=plt.hot())
    plt.show()


fourVariable_colorPlot()

enter image description here

user58925
  • 1,537
  • 5
  • 19
  • 28

0 Answers0