# [Matplotlib-users] how to create a facecolors map?

```Hello,

I would like to create a surface with a color provided by an independent
variable. The shape is defined by a matrix  with the z-values. The
color is a matrix of identical shape with floats. Can this be done?
My experiment code is incomplete: I could not write anything useful. Can
onyone help me making it work?```
```
Thank you

import matplotlib.pyplot as plt
import numpy as np
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter

no=100
cdict = {'red':   ((0.0,  0.0, 0.0),
(15.0,  1.0, 1.0)),

'green': ((0.0,  0.0, 0.0),
(15.0,  0.0, 0.0)),

'blue':  ((0.0,  1.0, 1.0),
(15.0,  0.0, 0.0))}

fig = plt.figure()
ax = fig.gca(projection = '3d')
x = np.linspace(-5,5,no)
y = np.linspace(-5,5,no)
x,y = np.meshgrid(x,y)
R = np.sqrt(x**2 + y**2)
z = np.sin(R)
D = np.sqrt((x-5)**2 + (y-5)**2)
#and now I need to map distance D
#making (-5,-5) blue and (5,5) red
c=

surf = ax.plot_surface(x, y, z, facecolors=c, rstride = 1, cstride = 1, cmap =
jet, linewidth = 0)
ax.set_zlim3d(-2, 2)
plt.show()

------------------------------------------------------------------------------
Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more!
Discover the easy way to master current and previous Microsoft technologies