My first question on this is whether or not there may be any kind of concurrent access going on between multiple requests.
From the docs at https://matplotlib.org/stable/users/faq/howto_faq.html#work-with-threads
Matplotlib is not thread-safe: in fact, there are known race conditions that affect certain artists.
If this is a shared resource where multiple people can access it at the same time, you’re going to need to manage that access. (There are a couple different ways to do it, each with their own advantages / disadvantages.)
Even if the requests aren’t truly concurrent, I’d be concerned about the housekeeping involved between requests.
(And no, I would not think that Matplotlib is a good choice for an interactive web application.)