Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This seems to be a feature from matplotlib. You can try your best, turning off everything in matplotlib like this:

import matplotlib.pyplot as plt
plt.plot(range(10), range(10))
plt.axis('off')
plt.savefig('/tmp/a.png', bbox_inches='tight')

The outcome of the plot will be the same as the following code in Sage:

list_plot(range(10), plotjoined=True, axes=False)

So there is not much that can be done on Sage side. Eventually, the generation of the figure and the saving is handled by matplotlib.

This seems to be a feature from matplotlib. You can try your best, turning off everything in matplotlib like this:

import matplotlib.pyplot as plt
plt.plot(range(10), range(10))
plt.axis('off')
plt.savefig('/tmp/a.png', bbox_inches='tight')

The outcome of the plot will be the same as the following code in Sage:

list_plot(range(10), plotjoined=True, axes=False)

So there is not much that can be done on Sage side. Eventually, the generation of the figure and the saving is handled by matplotlib.

Update:

There is a way to do it in matplotlib.

sage: import matplotlib.pyplot as plt
sage: plt.plot(range(10), range(10), '-o')
sage: plt.subplots_adjust(left=0, right=1, top=1, bottom=0)
sage: plt.axis('off')
sage: plt.savefig('/tmp/a.png', bbox_inches=0)