Open Keno opened 10 years ago
You can do this, but you need to pass a Figure
object, e.g. via gcf()
:
open(file -> writemime(file, "image/png", gcf()), "test.png", "w")
The Matplotlib plotting functions typically don't return the Figure
object, e.g. returning a Lines2D
object or some such thing; I guess this is because they may refer to only part of the figure. I could change them to return gcf()
, of course, but I'm reluctant to change the Matplotlib API too much.
You could also just do savefig("test.png")
.
While I see the rationality of not wanting to change the matplotlib API too much, it's also somewhat annoying (especially since I can't just display()
it). Nevertheless, if you can't see a way to make both work (maybe by having display
and writemime
implicitly draw the whole plot even if passed only part?), I won't complain.
I was expecting to be able to do
In order to save a PyPlot plot (this works for e.g. Gadfly/Winston). Any chance that could be supported?