1 | initial version |
This SO question also seems relevant. However, even with using the relevant Sage functionality
sage: P = plot(sin(x),(x,-pi,pi),color='green',linestyle='--',thickness=10)
sage: P = plot(sin(x),(x,-pi,pi),color='green',linestyle='--',thickness=10)
sage: M = P.matplotlib()
sage: M.add_subplot(111,axisbg='r')
<matplotlib.axes.AxesSubplot at 0x115234610>
sage: from matplotlib.backends.backend_agg import FigureCanvasAgg
sage: M.set_canvas(FigureCanvasAgg(M))
sage: M.savefig('/Users/.../test.png',dpi=100,transparent=False)
it covers up/replaces the previous Axes
object. It doesn't seem (easily) possible to change this afterward. (That is apparently a limitation in matplotlib and/or a feature of how they use the subplot instances.) However, it would be relatively straightforward to add this in Sage, though one would have to make sure it didn't mess anything up.