그래서이 있었다 : 잘 작동하지만, 내가 (다른 VPS에 그것을 실행하면 예, 이미했습니다입력 오류, 다음에 ValueError : x와 y는 같은 첫 번째 차원이 있어야합니다
def graph_data(dateList, countList, name):
xarray = [0,1,2,3,4,5,6]
xarray = np.asarray(xarray)
myticks = dateList
plt.figure(figsize=(9,5))
plt.xticks(xarray, myticks)
plt.plot(xarray, countList, color='r', linewidth='3.0')
plt.ylabel("Activity")
plt.xlabel("Date")
plt.title(name + "'s Activity for the past 7 days")
plt.savefig("graph.png")
PIP 모든 종속성을)를 설치하지만, 그것은 plt.plot에, countList은 플로트 될 필요가 있다고 주장, 나에게 유형의 오류를했다, 그래서 나는이에 대한 코드 변경 :
def graph_data(dateList, countList, name):
for n in countList:
fixedList = []
fixedList.append(float(n))
xarray = [0,1,2,3,4,5,6]
myticks = dateList
plt.figure(figsize=(9,5))
plt.xticks(xarray, myticks)
plt.plot(xarray, fixedList, color='r', linewidth='3.0')
plt.ylabel("Activity")
plt.xlabel("Date")
plt.title(name + "'s Activity for the past 7 days")
plt.savefig("graph.png")
을하지만 그것은 내게 준 이 오류 :
"have shapes {} and {}".format(x.shape, y.shape))
ValueError: x and y must have same first dimension, but have shapes (7,) and (1,)
그래서 xarray = np.asarray(xarray)
과 fixedList = np.asarray(fixedList)
을 추가했지만 여전히 모양 오류가납니다. 내가 도대체 뭘 잘못하고있는 겁니까?