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

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

如何在已保存的另一個文件上顯示圖形?

如何在已保存的另一個文件上顯示圖形?

慕無忌1623718 2021-03-18 18:15:52
我正在使用pylab。那么它在使用from show_graph import display嗎?from pylab import *from numpy import outerfrom show_graph import displayrc('text', usetex=False)a=outer(arange(0,1,0.01),ones(10))figure(figsize=(10,5))subplots_adjust(top=0.8,bottom=0.05,left=0.01,right=0.99)maps=[m for m in cm.datad if not m.endswith("_r")]maps.sort()l=len(maps)+1for i, m in enumerate(maps):    subplot(1,l,i+1)    axis("off")    imshow(a,aspect='auto',cmap=get_cmap(m),origin="lower")    title(m,rotation=90,fontsize=10)savefig("colormaps.png",dpi=100,facecolor='gray')display("colormaps.png")但是當我嘗試跑步時,它說 no module named show_graph
查看完整描述

1 回答

?
阿晨1998

TA貢獻2037條經驗 獲得超6個贊

您應刪除from show_graph import display,因為此導入會引發ImportError。然后,您保存和顯示情節的代碼可能像這樣


from pylab import *

from numpy import outer

rc('text', usetex=False)

a=outer(arange(0,1,0.01),ones(10))

figure(figsize=(10,5))

subplots_adjust(top=0.8,bottom=0.05,left=0.01,right=0.99)

maps=[m for m in cm.datad if not m.endswith("_r")]

maps.sort()

l=len(maps)+1

for i, m in enumerate(maps):

    subplot(1,l,i+1)

    axis("off")

    imshow(a,aspect='auto',cmap=get_cmap(m),origin="lower")

    title(m,rotation=90,fontsize=10)

savefig("colormaps.png",dpi=100,facecolor='gray')

show()


查看完整回答
反對 回復 2021-03-23
  • 1 回答
  • 0 關注
  • 160 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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