On Tue, May 26, 2015 at 12:36 PM, Raj Kumar Manna <rajphysics....@gmail.com>
wrote:
> import matplotlib.pyplot as plt
> from mpl_toolkits.mplot3d import Axes3D
> import numpy as np
>
> # create a 21 x 21 vertex mesh
> xx, yy = np.meshgrid(np.linspace(0,1,21), np.linspace(0,1,21))
>
> # create vertices for a rotated mesh (3D rotation matrix)
> X = xx
> Y = yy
> Z = 10*np.ones(X.shape)
>
> # create some dummy data (20 x 20) for the image
> data = np.cos(xx) * np.cos(xx) + np.sin(yy) * np.sin(yy)
>
> # create the figure
> fig = plt.figure()
>
> # show the reference image
> ax1 = fig.add_subplot(121)
> ax1.imshow(data, cmap=plt.cm.BrBG, interpolation='nearest',
> origin='lower', extent=[0,1,0,1])
>
> # show the 3D rotated projection
> ax2 = fig.add_subplot(122, projection='3d')
> ax2.plot_surface(X, Y, Z, rstride=1, cstride=1,
> facecolors=plt.cm.BrBG(data), shade=False)
>
The call to imshow() without vmin/vmax arguments will automatically scale
the colormap to cover the entire range of values. Meanwhile, when you did
plt.cm.BrBG(data), it assumed that the vmin/vmax is 0 and 1, respectively.
The min and max of your data is actually 0.292 and 1.708. If you normalize
your data, it should look much more correct.
Cheers!
Ben Root
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users