使用matplotlib示例时Django中的错误

使用matplotlib示例时Django中的错误,第1张

使用matplotlib示例时Django中的错误

目前,matplotlib的写入功能要求

seek
ducktype在文件中使用响应。您可以像这样写入缓冲区

import iodef mplimage(request):    f = matplotlib.figure.Figure()    # Code that sets up figure goes here; in the question, that's ...    FigureCanvasAgg(f)    buf = io.BytesIO()    plt.savefig(buf, format='png')    plt.close(f)    response = HttpResponse(buf.getvalue(), content_type='image/png')    return response


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5646325.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存