I thought I could guess the cause: the call to savefig expects a file name but you expect it to write into your BytesIO. The effect you’re seeing is that method turning it into a str file name it can’t open. But if we’re talking about savefig then the documentation supports your expectation.
However, it seems to be achieved by delegation to some plugable rendering class, so maybe the particular renderer you get here doesn’t implement the contract correctly?
A trace-back would pin it down more (and you or someone who knows the library better than I can work it out).