Skip to content

Commit ce752f0

Browse files
author
Alan LaMielle
committed
Adds support for passing kwargs to Plot.save to allow specifying options directly to pylab, such as bbox_inches='tight' to remove the whitespace border around the plot.
1 parent 88744f1 commit ce752f0

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Plot.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -327,12 +327,12 @@ def setPlotParameters(self, **kwdict):
327327
self.plotParams["hspace"] = 0.20
328328

329329

330-
def save(self, filename):
330+
def save(self, filename, **kwargs):
331331
"""
332332
Save this plot to a file.
333333
"""
334334
layout = self.__setupLayout()
335-
layout.save(filename)
335+
layout.save(filename,**kwargs)
336336

337337
def plotInset(self, parentAxes, width, height, location, padding):
338338
if not insetLocatorLoaded:

PlotLayout.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ def plot(self):
256256
else:
257257
pylab.draw()
258258

259-
def save(self, filename):
259+
def save(self, filename, **kwargs):
260260
print "Saving %s ..." % filename
261261

262262
tempDisplayHack = False
@@ -265,7 +265,7 @@ def save(self, filename):
265265
tempDisplayHack = True
266266
os.environ["DISPLAY"] = ":0.0"
267267
self._doPlot()
268-
pylab.savefig(filename)
268+
pylab.savefig(filename,**kwargs)
269269
pylab.clf()
270270

271271
if tempDisplayHack == True:

0 commit comments

Comments
 (0)