TypeError at /accounts/past_result
fill_between() takes at least 2 arguments (2 given) とエラーが出ました。views.pyに
@login_required def past_result(request): return render(request, 'registration/past_result/past_result.html', {'chart': _view_plot(request)}) def _view_plot(request): results = TestAndUser.objects.filter(user=request.user).order_by('-date') xlist = [results[0].score] ylist =[results[0].score] plt.plot(xlist, ylist,color="red",marker="x", markersize=15) plt.xlim(0,180) plt.ylim(0, 230) plt.xlabel('min') plt.ylabel('max') plt.fill_between(x1=0,x2=80,y1=0,y2=120, facecolor='yellow', alpha=0.2) jpg_image_buffer = cStringIO.StringIO() plt.savefig(jpg_image_buffer) array = base64.b64encode(jpg_image_buffer.getvalue()) jpg_image_buffer.close() return array
と書いてpast_result.htmlには
<div class="image"> <img src="data:image/png;base64,{{ chart }}" width="700px" height="500px" alt="img"/> </div>
と書きました。x軸の0〜80とy軸の0〜120までを黄色で色をつけたいです。
なぜ上記のようなエラーが出るのかわかりません。
どのように直せば良いのでしょうか?
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。