-3

I want to return venn diagram in my html page using return render in flask

I have tried so many attempts but nothing works, each plot is possible to return using matplotlib but i did not find a way for venn diagram.

  • 1
    Firstly, generate the graphics to a picture format ( you can save them to `NamedTemporary` file). Have a HTML template that takes in image src and renders the image and then pass in the URL on the 1st step to it. – evanstjabadi Jan 09 '23 at 10:13
  • Potentially the same logic as the django code in an [older question I had](https://stackoverflow.com/questions/31719138/matplotlib-cant-render-multiple-contour-plots-on-django) – Sayse Jan 09 '23 at 10:20
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jan 09 '23 at 11:31

1 Answers1

0

hi i think best way for this is you first save your diagram in backend as images file and return a link to that image in template

and also you can implement some logic for delete Image automatically

Alisharify
  • 16
  • 1
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 09 '23 at 19:37
  • how to do in json? – Saksham Shrivastava Jan 12 '23 at 12:49
  • for json you can save it in backend in media folder in static and generate url for that image with url_for and return it with jsonfiy Function – Alisharify Jan 14 '23 at 19:08