Skip to content

Commit

Permalink
Make it possible to save image sequence to a file
Browse files Browse the repository at this point in the history
  • Loading branch information
tkralphs committed Apr 2, 2020
1 parent a498e5c commit 4aa8429
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import setuptools

setup(name='coinor.grumpy',
version='0.9.3',
version='0.9.4',
description='Graphics for Understanding Mathematical Programming (GrUMPy)',
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.
Expand Down
17 changes: 10 additions & 7 deletions src/grumpy/polyhedron2D.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,18 @@ def set_xlim(self, xlim):
def set_ylim(self, ylim):
self.ax.set_ylim(ylim)

def show(self, pause = True, wait_for_click = True):
def show(self, pause = True, wait_for_click = True, filename = None):
plt.legend()
if wait_for_click == True:
plt.draw()
if plt.waitforbuttonpress(timeout = 10000):
plt.close()
exit()
if filename is not None:
plt.savefig(filename, bbox_inches='tight')
else:
plt.show(block=pause)
if wait_for_click == True:
plt.draw()
if plt.waitforbuttonpress(timeout = 10000):
plt.close()
exit()
else:
plt.show(block=pause)
self.fig = None

if __name__ == '__main__':
Expand Down

0 comments on commit 4aa8429

Please sign in to comment.