def write_image(cls, filename, scene): code = scene_code(scene) + "\n\nplt.show()" with open(filename, "wt") as f: f.write(code)
def write_image(cls, filename, scene): import matplotlib with matplotlib.rc_context({"backend": "pdf"}): code = scene_code(scene) + "\n\nplt.savefig({})".format( repr(filename)) exec(code, {}) # will generate a pdf
def write_image(cls, filename, scene): code = scene_code(scene) + "\n\nplt.savefig({})".format(repr(filename)) exec(code, {}) # will generate a pdf