GeneticAlgorithmPython icon indicating copy to clipboard operation
GeneticAlgorithmPython copied to clipboard

plot_genes() missing matplt()

Open tlint101 opened this issue 1 year ago • 1 comments

Hello,

I noticed in PyGAD 3.4.0, calling the plot_genes() method brings the following error:

in Plot.plot_genes(self, title, xlabel, ylabel, linewidth, font_size, plot_type, graph_type, fill_color, color, solutions, save_dir)
    274     ax.set_xlabel(0, fontsize=font_size)
    275 else:
--> 276     fig, axs = matplt.subplots(num_rows, num_cols)
    278     if num_cols == 1 and num_rows == 1:
    279         fig.set_figwidth(5 * num_cols)

NameError: name 'matplt' is not defined

I think the method is missing the following function (which is present in the other plot methods):

matplt = get_matplotlib()

tlint101 avatar Jan 27 '25 14:01 tlint101

Thanks! Fixed and will be available in the next release: https://github.com/ahmedfgad/GeneticAlgorithmPython/commit/22b579f92dd8c6e9b3b0ffba94ca51a4530a0a97

ahmedfgad avatar Feb 06 '25 20:02 ahmedfgad