From 5e8316467f4ccf10104bb1c43d85a5b77eedb142 Mon Sep 17 00:00:00 2001 From: Jeffrey Reep Date: Mon, 8 Jul 2024 14:29:51 -1000 Subject: [PATCH] small plotting update --- src/scripts/plot.py | 4 ++-- src/scripts/render_figure1.py | 7 ++++++- src/scripts/render_figure2.py | 7 ++++++- src/scripts/render_figure3.py | 8 +++++++- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/scripts/plot.py b/src/scripts/plot.py index f229f0c..3444a7f 100644 --- a/src/scripts/plot.py +++ b/src/scripts/plot.py @@ -6,7 +6,7 @@ import numpy as np from matplotlib import pyplot as plt -def plot_figures(time, temperature, density, L, H, t, filename=None, xlim=None): +def plot_figures(time, temperature, density, L, H, t, filename=None, xlim=None, show_legend=False): """ Plot the temperature, density, and abundance factor as a function of time for a given set of simulations @@ -48,7 +48,7 @@ def plot_figures(time, temperature, density, L, H, t, filename=None, xlim=None): plt.grid('-') if xlim is not None: plt.xlim(xlim) - if H == '0.01' and L == '40': + if show_legend': plt.legend(fontsize=18) plt.savefig(paths.figures / ('temperature_' + filename), dpi=300) plt.close() diff --git a/src/scripts/render_figure1.py b/src/scripts/render_figure1.py index 50e8a59..88914c8 100644 --- a/src/scripts/render_figure1.py +++ b/src/scripts/render_figure1.py @@ -30,4 +30,9 @@ temperature = [T_e_v, T_e_p, T_e_c] density = [n_v, n_p, n_c] - plot_figures(time, temperature, density, L, H, t) \ No newline at end of file + if H == '0.01': + show_legend = True + else: + show_legend = False + + plot_figures(time, temperature, density, L, H, t, show_legend=show_legend) \ No newline at end of file diff --git a/src/scripts/render_figure2.py b/src/scripts/render_figure2.py index 2864769..6ecfe86 100644 --- a/src/scripts/render_figure2.py +++ b/src/scripts/render_figure2.py @@ -30,4 +30,9 @@ temperature = [T_e_v, T_e_p, T_e_c] density = [n_v, n_p, n_c] - plot_figures(time, temperature, density, L, H, t) \ No newline at end of file + if H == '0.01': + show_legend = True + else: + show_legend = False + + plot_figures(time, temperature, density, L, H, t, show_legend=show_legend) \ No newline at end of file diff --git a/src/scripts/render_figure3.py b/src/scripts/render_figure3.py index 6be48da..f134534 100644 --- a/src/scripts/render_figure3.py +++ b/src/scripts/render_figure3.py @@ -29,6 +29,12 @@ temperature = [T_e_v, T_e_p, T_e_c] density = [n_v, n_p, n_c] + if L == '40': + show_legend = True + else: + show_legend = False + + plot_figures(time, temperature, density, L, H, t, filename = 'train_L'+L+'_H'+H+'_t'+t+'.png', - xlim = [0, 40]) + xlim = [0, 40], show_legend=show_legend)