From 169c2042965cab5caee62ca52885632a6447051c Mon Sep 17 00:00:00 2001 From: danielwilczak101 <44122838+danielwilczak101@users.noreply.github.com> Date: Thu, 3 Dec 2020 02:21:32 -0500 Subject: [PATCH] Fixed ga.yscale so it works with all plots --- src/database/matplotlib_graph.py | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/database/matplotlib_graph.py b/src/database/matplotlib_graph.py index aeb6a70..188f178 100644 --- a/src/database/matplotlib_graph.py +++ b/src/database/matplotlib_graph.py @@ -31,11 +31,8 @@ class Matplotlib_Graph: # Query for Y data self.y = self.database.get_generation_total_fitness(config_id) - # If using log then the values have to be positive numbers - if self.yscale == "log": - self.y = [abs(ele) for ele in self.y] - self.type_of_graph(self.x, self.y) + plt.yscale(self.yscale) plt.xlabel('Generation') plt.ylabel('Generation Total Fitness') plt.title('Relationship Between Generations and Generation Total Fitness') @@ -53,11 +50,8 @@ class Matplotlib_Graph: # Query for Y data self.y = self.database.get_highest_chromosome(config_id) - # If using log then the values have to be positive numbers - if self.yscale == "log": - self.y = [abs(ele) for ele in self.y] - self.type_of_graph(self.x, self.y) + plt.yscale(self.yscale) plt.xlabel('Generation') plt.ylabel('Highest Fitness') plt.title('Relationship Between Generations and Highest Fitness') @@ -75,11 +69,8 @@ class Matplotlib_Graph: # Query for Y data self.y = self.database.get_lowest_chromosome(config_id) - # If using log then the values have to be positive numbers - if self.yscale == "log": - self.y = [abs(ele) for ele in self.y] - self.type_of_graph(self.x, self.y) + plt.yscale(self.yscale) plt.xlabel('Generation') plt.ylabel('Lowest Fitness') plt.title('Relationship Between Generations and Lowest Fitness')