Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Mystery white border around Graphics object

If you try to show() a sage.plot.graphics.Graphics object, you will find something extremely bizarre: there is a white border around the .png image which is 30 pixels wide (on some sides, 31 pixels wide). There is no documentation of this and it seems to be impossible to remove with any documented options to show() or to the settings of a Graphics object.

Does anyone know how to get rid of this bug?

The best thing I came up with was to do

show(MyObject, axes=False, axes_pad=0)

This only reduced the number of pixels but didn't remove the border entirely.
Also note that you can sometimes make the graphics object transparent (though not through show()), but this does not remove the border, it only makes it transparent, which causes even more problems when I pipe this into other software.

Mystery white border around Graphics object

If you try to show() a sage.plot.graphics.Graphics object, you will find something extremely bizarre: there is a white border around the .png image which is 30 pixels wide (on some sides, 31 pixels wide). There is no documentation of this and it seems to be impossible to remove with any documented options to show() or to the settings of a Graphics object.

Does anyone know how to get rid of this bug?

The best thing I came up with was to do

show(MyObject, axes=False, axes_pad=0)

This only reduced the number of pixels but didn't remove the border entirely.
Also note that you can sometimes make the graphics object transparent (though not through show()), but this does not remove the border, it only makes it transparent, which causes even more problems when I pipe this into other software.

Example:

polygon([(0,0),(1,0),(1,1),(0,1)],aspect_ratio=1,axes=False,figsize=1,axes_pad=0)

yields:

example