HI, is it possible that I created a image from matplotlib and I save it on an image object I created from PIL? Sounds very hard? Who can help me?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
To render Matplotlib images in a webpage in the Django Framework:
create the matplotlib plot
save it as a png file
store this image in a string buffer (using PIL)
pass this buffer to Django’s HttpResponse (set mime type image/png)
which returns a response object (the rendered plot in this case).
In other words, all of these steps should be placed in a Django view function, in views.py: