# Revision history [back]

I think that there are two options for plot() that can also be passed to save(). These are figsize in inches and dpi - the product of which (should) give the resolution of the image (although it doesn't seem to quite come out that way...).

p = plot(sin, (0, 2*pi)); p


print p.SHOW_OPTIONS['figsize'], p.SHOW_OPTIONS['dpi']

(6, 3.7082039324993699) 100

p.save(os.path.expanduser('~/sin.default.png'))
p.save(os.path.expanduser('~/sin.20.png'),dpi=20)


sin.default.png comes out at 506316 pixels and 12.5 KB, while sin.20.png is just 10164 pixels and 1.8KB.

I think that there are two options for plot() that can also be passed to save(). These are figsize in inches and dpi - the product of which (should) give the resolution of the image (although it doesn't seem to quite come out that way...).

p = plot(sin, (0, 2*pi)); p


print p.SHOW_OPTIONS['figsize'], p.SHOW_OPTIONS['dpi']

(6, 3.7082039324993699) 100

p.save(os.path.expanduser('~/sin.default.png'))
p.save(os.path.expanduser('~/sin.20.png'),dpi=20)


sin.default.png comes out at 506316 506*316 pixels and 12.5 KB, 12.5KB, while sin.20.png is just 10164 101*64 pixels and 1.8KB.

I think that there are two options for plot() that can also be passed to save(). These are figsize in inches and dpi - the product of which (should) give the resolution of the image (although it doesn't seem to quite come out that way...).

sage: p = plot(sin, (0, 2*pi)); p


sage: print p.SHOW_OPTIONS['figsize'], p.SHOW_OPTIONS['dpi']
(6, 3.7082039324993699) 100

sage: p.save(os.path.expanduser('~/sin.default.png'))
sage: p.save(os.path.expanduser('~/sin.20.png'),dpi=20)


sin.default.png comes out at 506*316 pixels and 12.5KB, while sin.20.png is just 101*64 pixels and 1.8KB.

Actually if you look at

sage: print p.matplotlib()
Figure(480x296.656)


This basically matches the size of the outputted png file once you remove the padding.