Skip to content

Commit 4aa8429

Browse files
committed
Make it possible to save image sequence to a file
1 parent a498e5c commit 4aa8429

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import setuptools
55

66
setup(name='coinor.grumpy',
7-
version='0.9.3',
7+
version='0.9.4',
88
description='Graphics for Understanding Mathematical Programming (GrUMPy)',
99
long_description='''GrUMPy is a class for visualizing various algorithm used in solving discrete optimization problem. It has a class for dynamically generating and visualizing branch-and-bound trees that is derived from the GiMPy graph class. Using the branch-and-bound class, a user can visualize the branch-and-bound process in a number of different ways either by building the tree dynamically through direct calls to Python from the solver or by piping the output of an instrumented solver to GrUMPy for parsing. The branch-and-bound class also includes a pure Python implementation of branch and bound that is targeted at educational use.
1010

src/grumpy/polyhedron2D.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -316,15 +316,18 @@ def set_xlim(self, xlim):
316316
def set_ylim(self, ylim):
317317
self.ax.set_ylim(ylim)
318318

319-
def show(self, pause = True, wait_for_click = True):
319+
def show(self, pause = True, wait_for_click = True, filename = None):
320320
plt.legend()
321-
if wait_for_click == True:
322-
plt.draw()
323-
if plt.waitforbuttonpress(timeout = 10000):
324-
plt.close()
325-
exit()
321+
if filename is not None:
322+
plt.savefig(filename, bbox_inches='tight')
326323
else:
327-
plt.show(block=pause)
324+
if wait_for_click == True:
325+
plt.draw()
326+
if plt.waitforbuttonpress(timeout = 10000):
327+
plt.close()
328+
exit()
329+
else:
330+
plt.show(block=pause)
328331
self.fig = None
329332

330333
if __name__ == '__main__':

0 commit comments

Comments
 (0)