第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

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

我的Fig1.savefig功能將我的圖形保存為空白屏幕,我該如何解決這個問題?

我的Fig1.savefig功能將我的圖形保存為空白屏幕,我該如何解決這個問題?

叮當(dāng)貓咪 2023-10-06 19:35:03
我正在通過 .csv 文件導(dǎo)入數(shù)據(jù)并繪制它,但是當(dāng)我繪制圖形并嘗試將其保存到我的谷歌驅(qū)動器時,它只保存一個沒有任何數(shù)據(jù)的空白圖像。我正在使用谷歌協(xié)作實驗室。這是我的代碼:#Displaying the Dataimport matplotlib.pyplot as pltimport numpy as npimport pandas as pdplt.title("Score of Each Raisan Thrown", fontsize ='x-large')plt.ylabel("Valid Raisans Thrown", fontsize='large')plt.xlabel("Score", fontsize= 'large')dart = data[:,0]score =  data[:,1]plt.plot(score ,dart, marker='o', linestyle='none', color='black')ax = plt.subplot()ax.set_facecolor('seashell')# Adding ticks to make my plot easier to understand/readax.set_yticks([20,40,60,80,100,120,140,160,180,200])ax.set_xticks([-16,-14,-12,-10,-8,-6,-4,-2,0,2,4,6,8,10,12,14,-16])fig = plt.figure(figsize=(10,5))fig = plt.gcf()plt.draw()fig.savefig(datapath+'My Experiment1 Plot')plt.show()
查看完整描述

1 回答

?
牛魔王的故事

TA貢獻(xiàn)1830條經(jīng)驗 獲得超3個贊

因為你的


fig = plt.figure(figsize=(10,5))


fig = plt.gcf()

plt.draw()

fig.savefig(datapath+'My Experiment1 Plot')

出現(xiàn)在所有繪圖命令之后,這意味著您正在創(chuàng)建一個新圖形而不繪制任何內(nèi)容并保存它。您需要重新排列命令:


# get the data:

dart = data[:,0]

score =  data[:,1]


# set up the fig and axes:

fig, ax = plt.subplots(figsize=(10,5))


# plot the data

plt.plot(score ,dart, marker='o', linestyle='none', color='black')


# additional formatting

plt.title("Score of Each Raisan Thrown", fontsize ='x-large')

plt.ylabel("Valid Raisans Thrown", fontsize='large')

plt.xlabel("Score", fontsize= 'large')


# even more formatting

ax.set_facecolor('seashell')


# Adding ticks to make my plot easier to understand/read    

ax.set_yticks([20,40,60,80,100,120,140,160,180,200])

ax.set_xticks([-16,-14,-12,-10,-8,-6,-4,-2,0,2,4,6,8,10,12,14,-16])


fig.savefig(datapath+'My Experiment1 Plot')


plt.show()


查看完整回答
反對 回復(fù) 2023-10-06
  • 1 回答
  • 0 關(guān)注
  • 159 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號