import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def plot_pic(request):
# делаешь графики
plt.draw()
response = HttpResponse(content_type="image/jpeg")
plt.savefig(response, format="png")
plt.clf()
return response
<img src={% url 'plot_pic' %} width="640" height="auto">