GeneticAlgorithmPython icon indicating copy to clipboard operation
GeneticAlgorithmPython copied to clipboard

Error when trying to use the built-in plotting functions

Open dhutter-fhv opened this issue 3 years ago • 0 comments

pygad version: 2.16.3 (testing in a jupyter notebook), python version: 3.10.3

The function call ga_instance.plot_fitness() as well as other plot functions like ga_instance.plot_new_solution_rate() throw an error:

        matplotlib.pyplot.title(title, fontsize=font_size)
     -> matplotlib.pyplot.xlabel(xlabel, fontsize=font_size)
        matplotlib.pyplot.ylabel(ylabel, fontsize=font_size)

TypeError: 'str' object is not callable

This error also obviously prevents the rest of the code to run, which means I currently can not use the built-in plotting functions.

Just glancing at the error I would assume the problem stems from the string parameter for the xlabel name being called the same as the used pyplot function to create this plot and python not being able to differ between them.

However that's just a guess, maybe someone had this issue before and it is caused by something else?

dhutter-fhv avatar Apr 21 '22 09:04 dhutter-fhv