For some fun I am trying to plot a surface representation of 2D image where the height level corresponds to the intensity at each pixel. I have been able to change the cmap but would like to assign the original pixel colour values (Grayscale or RGB) to corresponding in the surface plot. Is this possible? To be honest, I not even sure if I have constructed the plot correctly.

Any help appreciated.

Regards,

Brickle.

## ···

----

----- Surface Representation of 2D Image --------

from mpl_toolkits.mplot3d import axes3d

import matplotlib.pyplot as plt

from skimage import data, color

import numpy as np

from scipy import ndimage

from matplotlib import cm

image = color.rgb2gray(data.lena())

image = ndimage.gaussian_filter(image, 8)

x = range(image.shape[0])

y = range(image.shape[1])

X,Y = np.meshgrid(x,y) # Is this the correct way?

Z = image # Not sure if this is correct?

fig = plt.figure()

ax = fig.add_subplot(1,1,1, projection='3d')

ax.plot_surface(X,Y,Z, cmap=cm.gray)

plt.show()

----------------------------------------------