简体   繁体   中英

3D pcolor/pclormesh plot in matplotlib

1. My attempt

  • 2-d numpy array represent some value of an area, showing like this:

http://i8.tietuku.com/90d045a6c2375474.png

And I want to plot the value in the Z-axis.

For example, If I want to plot the altitude of this area, using 3d pcolor plot, I can get a figure just like the real terrain.

2. My result

For now, I can plot 3-d plot of this area using

Code

import mpl_toolkits.mplot3d.axes3d as axes3d
fig,ax = plt.subplots(subplot_kw=dict(projection='3d'),figsize = (12,8))
ax.plot_surface(xx, yy,value,rstride = 1,cstride = 1,\
            cmap=plt.cm.Spectral_r,linewidth = 0)

Result

http://i4.tietuku.com/b2e650d0d23d5756.png

Can some one offer some advice to plot 3-d based on each grid value (like a 3-d histogram)?

Update

A little question added here, how to change the xticks and yticks in 3-d axes?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM