From d7a2770e6bcb2f57ce9e42c895b0588d75edde61 Mon Sep 17 00:00:00 2001 From: RahulKN <59457716+RahulKikkeriNagaraja@users.noreply.github.com> Date: Wed, 7 Oct 2020 09:49:38 +0200 Subject: [PATCH] removing commented code lines in plot.py (#75) Co-authored-by: Rahul Kikkeri Nagaraja --- .../plot_results.py | 34 ++----------------- .../plot_results.py | 31 ----------------- .../plot_results.py | 19 ----------- 3 files changed, 2 insertions(+), 82 deletions(-) diff --git a/shape_optimization/use_cases/02_Strain_Energy_Minimization_3D_Shell/plot_results.py b/shape_optimization/use_cases/02_Strain_Energy_Minimization_3D_Shell/plot_results.py index 50e44bee..816a83e4 100644 --- a/shape_optimization/use_cases/02_Strain_Energy_Minimization_3D_Shell/plot_results.py +++ b/shape_optimization/use_cases/02_Strain_Energy_Minimization_3D_Shell/plot_results.py @@ -1,32 +1,21 @@ -from matplotlib.ticker import TickHelper import pandas as pd import matplotlib.pyplot as plt import matplotlib.ticker as ticker + plt.style.use('seaborn') -history = "Optimization_Results_3.0" +history = "Optimization_Results" plot = { "name": "strain energy", "column_name": "f" } - path = f"{history}/optimization_log.csv" df = pd.read_csv(path, delimiter=",") df.columns = [x.strip() for x in df.columns] -""" -fig, axs = plt.subplots(1, len(plots), figsize=(18, 6)) - -for plot, ax in zip(plots, axs): - for column_name in plot["column_names"]: - ax.plot(df[column_name], label=column_name) - ax.legend() - ax.set_title(plot["name"]) -""" - fig, ax = plt.subplots(1, 1, figsize=(4, 6)) ax.plot(df[plot["column_name"]], label=plot["column_name"]) ax.legend(fontsize=11) @@ -36,23 +25,4 @@ ax.yaxis.set_major_locator(ticker.MultipleLocator(0.5)) # tick_spacing ax.xaxis.set_major_locator(ticker.MultipleLocator(10)) # tick_spacing -"""grid = plt.GridSpec(2, 3) -plot_f = plt.subplot(grid[:, 0]) -plot_c1 = plt.subplot(grid[0, 1]) -plot_c2 = plt.subplot(grid[0, 2]) -plot_c3 = plt.subplot(grid[1, 1]) -plot_stp = plt.subplot(grid[1, 2]) -axs_list = [plot_f, plot_c1, plot_c2, plot_c3, plot_stp] -for plot, ax in zip(plots, axs_list): - for column_name in plot["column_names"]: - ax.plot(df[column_name], label=column_name) - ax.legend(fontsize=11) - ax.set_title(plot["name"], fontsize=13) - ax.tick_params(axis='x', labelsize=13) - ax.tick_params(axis='y', labelsize=13) - ax.xaxis.set_major_locator(ticker.MultipleLocator(4)) # tick_spacing is 4 - if plot['name'] == 'mass': - ax.yaxis.set_major_locator(ticker.MultipleLocator(1)) -plt.tight_layout() -""" plt.show() diff --git a/shape_optimization/use_cases/06_bead_optimization_plate/plot_results.py b/shape_optimization/use_cases/06_bead_optimization_plate/plot_results.py index 3cb2567e..d7fa8669 100644 --- a/shape_optimization/use_cases/06_bead_optimization_plate/plot_results.py +++ b/shape_optimization/use_cases/06_bead_optimization_plate/plot_results.py @@ -1,4 +1,3 @@ -from matplotlib.ticker import TickHelper import pandas as pd import matplotlib.pyplot as plt import matplotlib.ticker as ticker @@ -11,22 +10,11 @@ "column_name": "f" } - path = f"{history}/optimization_log.csv" df = pd.read_csv(path, delimiter=",") df.columns = [x.strip() for x in df.columns] -""" -fig, axs = plt.subplots(1, len(plots), figsize=(18, 6)) - -for plot, ax in zip(plots, axs): - for column_name in plot["column_names"]: - ax.plot(df[column_name], label=column_name) - ax.legend() - ax.set_title(plot["name"]) -""" - fig, ax = plt.subplots(1, 1, figsize=(4, 6)) ax.plot(df[plot["column_name"]], label=plot["column_name"]) ax.legend(fontsize=11) @@ -36,23 +24,4 @@ ax.yaxis.set_major_locator(ticker.MultipleLocator(0.001)) # tick_spacing ax.xaxis.set_major_locator(ticker.MultipleLocator(10)) # tick_spacing -"""grid = plt.GridSpec(2, 3) -plot_f = plt.subplot(grid[:, 0]) -plot_c1 = plt.subplot(grid[0, 1]) -plot_c2 = plt.subplot(grid[0, 2]) -plot_c3 = plt.subplot(grid[1, 1]) -plot_stp = plt.subplot(grid[1, 2]) -axs_list = [plot_f, plot_c1, plot_c2, plot_c3, plot_stp] -for plot, ax in zip(plots, axs_list): - for column_name in plot["column_names"]: - ax.plot(df[column_name], label=column_name) - ax.legend(fontsize=11) - ax.set_title(plot["name"], fontsize=13) - ax.tick_params(axis='x', labelsize=13) - ax.tick_params(axis='y', labelsize=13) - ax.xaxis.set_major_locator(ticker.MultipleLocator(4)) # tick_spacing is 4 - if plot['name'] == 'mass': - ax.yaxis.set_major_locator(ticker.MultipleLocator(1)) -plt.tight_layout() -""" plt.show() diff --git a/shape_optimization/use_cases/10_Multi_Constraint_Optimization_3D_Hook/plot_results.py b/shape_optimization/use_cases/10_Multi_Constraint_Optimization_3D_Hook/plot_results.py index cbb6a2d0..a911ee30 100644 --- a/shape_optimization/use_cases/10_Multi_Constraint_Optimization_3D_Hook/plot_results.py +++ b/shape_optimization/use_cases/10_Multi_Constraint_Optimization_3D_Hook/plot_results.py @@ -1,4 +1,3 @@ -from matplotlib.ticker import TickHelper import pandas as pd import matplotlib.pyplot as plt import matplotlib.ticker as ticker @@ -49,24 +48,6 @@ df = pd.read_csv(path, delimiter=",") df.columns = [x.strip() for x in df.columns] -""" -fig, axs = plt.subplots(1, len(plots), figsize=(18, 6)) - -for plot, ax in zip(plots, axs): - for column_name in plot["column_names"]: - ax.plot(df[column_name], label=column_name) - ax.legend() - ax.set_title(plot["name"]) - - -fig, axs = plt.subplots(2, 3) -axs_list = [axs[0][0], axs[0][1], axs[0][2], axs[1][0], axs[1][1]] -for plot, ax in zip(plots, axs_list): - for column_name in plot["column_names"]: - ax.plot(df[column_name], label=column_name) - ax.legend() - ax.set_title(plot["name"])""" - grid = plt.GridSpec(2, 3) plot_f = plt.subplot(grid[:, 0]) plot_c1 = plt.subplot(grid[0, 1])