开发者

matplotlib: how to hide grey border around the plot

开发者 https://www.devze.com 2022-12-21 08:39 出处:网络
I\'d like to save figurecanvas as bitmap and don\'t need grey border around the plot开发者_如何学运维 in it. How can I hide this?I believe that savefig will not include the gray border by default. How

I'd like to save figurecanvas as bitmap and don't need grey border around the plot开发者_如何学运维 in it. How can I hide this?


I believe that savefig will not include the gray border by default. However, .bmp is not support by savefig; use .png instead.

import pylab
f = pylab.figure()
ax = f.add_axes([0.1, 0.1, 0.8, 0.8])
ax.plot([1,2,3],[4,5,6])
f.savefig('image.png')

Output:

matplotlib: how to hide grey border around the plot


(source: stevetjoa.com)


I found it: subplots_adjust.

0

精彩评论

暂无评论...
验证码 换一张
取 消