Skip to content

Commit 9ffd348

Browse files
committed
Merge branch 'master' of github.com:pichur/GeneticAlgorithmPython
2 parents 3a77e4c + e98e742 commit 9ffd348

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pygad.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3361,7 +3361,8 @@ def plot_fitness(self,
33613361
font_size=14,
33623362
plot_type="plot",
33633363
color="#3870FF",
3364-
save_dir=None):
3364+
save_dir=None,
3365+
show=True):
33653366

33663367
"""
33673368
Creates, shows, and returns a figure that summarizes how the fitness value evolved by generation. Can only be called after completing at least 1 generation. If no generation is completed, an exception is raised.
@@ -3375,7 +3376,7 @@ def plot_fitness(self,
33753376
plot_type: Type of the plot which can be either "plot" (default), "scatter", or "bar".
33763377
color: Color of the plot which defaults to "#3870FF".
33773378
save_dir: Directory to save the figure.
3378-
3379+
show: For True show the plot
33793380
Returns the figure.
33803381
"""
33813382

@@ -3399,7 +3400,8 @@ def plot_fitness(self,
33993400
if not save_dir is None:
34003401
matplotlib.pyplot.savefig(fname=save_dir,
34013402
bbox_inches='tight')
3402-
matplotlib.pyplot.show()
3403+
if show:
3404+
matplotlib.pyplot.show()
34033405

34043406
return fig
34053407

0 commit comments

Comments
 (0)