最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Python+matplotlib+numpy實(shí)現(xiàn)在不同平面的二維條形圖

 更新時(shí)間:2018年01月02日 14:15:25   投稿:mengwei  
這篇文章主要介紹了Python+matplotlib+numpy實(shí)現(xiàn)在不同平面的二維條形圖,具有一定借鑒價(jià)值,需要的朋友可以參考下

在不同平面上繪制二維條形圖。

本實(shí)例制作了一個(gè)3d圖,其中有二維條形圖投射到平面y=0,y=1,等。

演示結(jié)果:

完整代碼:

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

# Fixing random state for reproducibility
np.random.seed(19680801)


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

colors = ['r', 'g', 'b', 'y']
yticks = [3, 2, 1, 0]
for c, k in zip(colors, yticks):
  # Generate the random data for the y=k 'layer'.
  xs = np.arange(20)
  ys = np.random.rand(20)

  # You can provide either a single color or an array with the same length as
  # xs and ys. To demonstrate this, we color the first bar of each set cyan.
  cs = [c] * len(xs)
  cs[0] = 'c'

  # Plot the bar graph given by xs and ys on the plane y=k with 80% opacity.
  ax.bar(xs, ys, zs=k, zdir='y', color=cs, alpha=0.8)

ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')

# On the y axis let's only label the discrete values that we have data for.
ax.set_yticks(yticks)

plt.show()

腳本運(yùn)行時(shí)間:(0分0.063秒)

總結(jié)

以上就是本文關(guān)于Python+matplotlib+numpy實(shí)現(xiàn)在不同平面的二維條形圖的全部內(nèi)容,希望對(duì)大家有所幫助。感興趣的朋友可以繼續(xù)參閱本站其他相關(guān)專題,如有不足之處,歡迎留言指出。感謝朋友們對(duì)本站的支持!

相關(guān)文章

最新評(píng)論

闽清县| 湄潭县| 阿图什市| 永新县| 健康| 澎湖县| 江川县| 资中县| 祁阳县| 连山| 都昌县| 九龙坡区| 博兴县| 平果县| 简阳市| 龙里县| 神农架林区| 馆陶县| 舞钢市| 娄底市| 嘉荫县| 奉化市| 沙坪坝区| 祁门县| 太保市| 江达县| 海丰县| 鲁山县| 五华县| 高陵县| 普陀区| 新沂市| 满洲里市| 昌平区| 安康市| 田林县| 江津市| 望城县| 抚顺县| 长垣县| 焦作市|