Jack Kamm <jackk...@gmail.com> 于2023年7月5日周三 13:13写道:
> 1. Do you need to add a call to pyplot.gcf().clear(), in case of > multiple blocks in a session? I don't think so. Some users may want to keep the figure between blocks, and they can always clear the figure themselves when necessary. > 2. Would it make sense to wrap in pyplot.rc_context, so that we can use > the :width and :height arguments like ob-R? E.g., > > with pyplot.rc_context({'figure.figsize': (8,5)}): > pyplot.plot([1,2,3,4,5]) > pyplot.gcf().savefig('filename.png') > > Will create a png file with width 8 and height 5. Thanks for your suggestion and I have added some arguments (e.g. :dpi) in the updated patch. But rc_context doesn't work reliably with multiple blocks in a session, i.e., the figure size may not change. BTW, I have updated the patch to turn off the feature by default, since it may break existing src blocks using `graphics'. WDYT? Thanks.