亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在python-matplotlib中繪制3D多邊形

在python-matplotlib中繪制3D多邊形

飲歌長嘯 2019-11-28 10:01:23
我無法通過網絡瀏覽以下簡單問題的解決方案:如何使用頂點值繪制3D多邊形(例如,填充的矩形或三角形)?我嘗試了很多想法,但都失敗了,請參閱:from mpl_toolkits.mplot3d import Axes3Dfrom matplotlib.collections import PolyCollectionimport matplotlib.pyplot as pltfig = plt.figure()ax = Axes3D(fig)x = [0,1,1,0]y = [0,0,1,1]z = [0,1,0,1]verts = [zip(x, y,z)]ax.add_collection3d(PolyCollection(verts),zs=z)plt.show()我預先感謝任何想法/意見。根據接受的答案進行更新:import mpl_toolkits.mplot3d as a3import matplotlib.colors as colorsimport pylab as plimport scipy as spax = a3.Axes3D(pl.figure())for i in range(10000):    vtx = sp.rand(3,3)    tri = a3.art3d.Poly3DCollection([vtx])    tri.set_color(colors.rgb2hex(sp.rand(3)))    tri.set_edgecolor('k')    ax.add_collection3d(tri)pl.show()結果如下:
查看完整描述

2 回答

  • 2 回答
  • 0 關注
  • 1372 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號