【发布时间】:2021-01-20 21:40:55
【问题描述】:
我正在通过 .csv 文件导入数据并绘制它,但是当我绘制我的图形并尝试将其保存到我的谷歌驱动器时,它只会保存一个没有任何数据的空白图像。我正在使用 Google Collaboratory。
这是我的代码:
#Displaying the Data
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
plt.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/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 = plt.figure(figsize=(10,5))
fig = plt.gcf()
plt.draw()
fig.savefig(datapath+'My Experiment1 Plot')
plt.show()
【问题讨论】:
标签: python python-3.x numpy matplotlib google-colaboratory