python - How to set the margins for a matplotlib figure? -
i generating on-screen figure has 2 subplots: 1 image , other graph. margins extremely large around figures.
how adjust margins around figures?
most questions searched involved saving images (bbox seemed perfect), , using axes instead of subplots absolute positioning.
here code used generate figure:
def __init__(self, parent): wx.panel.__init__(self, parent) ... self.figure, (self.picture, self.intensity) = \ plt.subplots(nrows=2, figsize=(12, 5)) self.figure.set_dpi(80) #self.figure.subplots_adjust(left=0.1, right=0.9, top=0.9, bottom=0.1) #self.picture.imshow(np.random.uniform()) #size=(5, 50))) self.intensity.plot(np.random.random()) #size=641)) self.intensity.autoscale(axis='x', tight=true)
have @ plt.tight_layout() or plt.subplots_adjust() or fig.savefig(bbox_inches='tight').
with subplots_adjust can adjust parameters, while tight_layout() , bbox_inches='tight' more or less semi automatic.
Comments
Post a Comment