From f7aa6a5b7763e03f5f8ae5f4289edc417fe11fee Mon Sep 17 00:00:00 2001 From: robjmcgibbon <36136863+robjmcgibbon@users.noreply.github.com> Date: Wed, 27 Mar 2024 11:03:24 +0000 Subject: [PATCH] Set aspect ratio for density-temperature plots (#277) * Set aspect ratio for density-temperature plots * Format * Update other scripts * One more --- colibre/scripts/bh_masses.py | 8 +++++++- colibre/scripts/birth_density_metallicity.py | 8 +++++++- colibre/scripts/birth_density_redshift.py | 8 +++++++- colibre/scripts/birth_density_temperature.py | 8 +++++++- colibre/scripts/birth_metallicity_redshift.py | 8 +++++++- colibre/scripts/density_internal_energy.py | 8 +++++++- colibre/scripts/density_pressure.py | 8 +++++++- colibre/scripts/density_species_depletions.py | 8 +++++++- colibre/scripts/density_species_diffuse.py | 8 +++++++- colibre/scripts/density_species_interp.py | 8 +++++++- colibre/scripts/density_temperature.py | 8 +++++++- colibre/scripts/density_temperature_dust.py | 8 +++++++- colibre/scripts/density_temperature_dust2metal.py | 8 +++++++- colibre/scripts/density_temperature_dust_to_metals.py | 8 +++++++- colibre/scripts/density_temperature_metals.py | 8 +++++++- colibre/scripts/density_temperature_sf_fraction.py | 8 +++++++- colibre/scripts/density_temperature_species.py | 8 +++++++- colibre/scripts/gas_minimal_smoothing_length_redshift.py | 8 +++++++- colibre/scripts/max_temperature_redshift.py | 8 +++++++- colibre/scripts/median_temperature_density.py | 8 +++++++- colibre/scripts/particle_updates_step_cost.py | 8 +++++++- 21 files changed, 147 insertions(+), 21 deletions(-) diff --git a/colibre/scripts/bh_masses.py b/colibre/scripts/bh_masses.py index 6e279786..063855f8 100644 --- a/colibre/scripts/bh_masses.py +++ b/colibre/scripts/bh_masses.py @@ -51,8 +51,14 @@ def setup_axes(mass_bounds, number_of_simulations: int): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/birth_density_metallicity.py b/colibre/scripts/birth_density_metallicity.py index 20f4318c..df835c93 100644 --- a/colibre/scripts/birth_density_metallicity.py +++ b/colibre/scripts/birth_density_metallicity.py @@ -74,8 +74,14 @@ def setup_axes(number_of_simulations: int): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/birth_density_redshift.py b/colibre/scripts/birth_density_redshift.py index 0c3e5f96..4afbcfd7 100644 --- a/colibre/scripts/birth_density_redshift.py +++ b/colibre/scripts/birth_density_redshift.py @@ -60,8 +60,14 @@ def setup_axes(number_of_simulations: int): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/birth_density_temperature.py b/colibre/scripts/birth_density_temperature.py index 2bb05c09..d4cde449 100644 --- a/colibre/scripts/birth_density_temperature.py +++ b/colibre/scripts/birth_density_temperature.py @@ -62,8 +62,14 @@ def setup_axes(number_of_simulations: int): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/birth_metallicity_redshift.py b/colibre/scripts/birth_metallicity_redshift.py index 5c2d5d92..8f1f2eab 100644 --- a/colibre/scripts/birth_metallicity_redshift.py +++ b/colibre/scripts/birth_metallicity_redshift.py @@ -72,8 +72,14 @@ def setup_axes(number_of_simulations: int): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/density_internal_energy.py b/colibre/scripts/density_internal_energy.py index 802a1eb1..de016622 100644 --- a/colibre/scripts/density_internal_energy.py +++ b/colibre/scripts/density_internal_energy.py @@ -61,8 +61,14 @@ def setup_axes(number_of_simulations: int): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/density_pressure.py b/colibre/scripts/density_pressure.py index d3054fae..4670952d 100644 --- a/colibre/scripts/density_pressure.py +++ b/colibre/scripts/density_pressure.py @@ -63,8 +63,14 @@ def setup_axes(number_of_simulations: int): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/density_species_depletions.py b/colibre/scripts/density_species_depletions.py index 19670e67..ef7b1c8b 100644 --- a/colibre/scripts/density_species_depletions.py +++ b/colibre/scripts/density_species_depletions.py @@ -195,8 +195,14 @@ def setup_axes(number_of_simulations: int, prop_type="hydro"): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/density_species_diffuse.py b/colibre/scripts/density_species_diffuse.py index aa47bdf7..32782401 100644 --- a/colibre/scripts/density_species_diffuse.py +++ b/colibre/scripts/density_species_diffuse.py @@ -197,8 +197,14 @@ def setup_axes(number_of_simulations: int, prop_type="hydro"): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/density_species_interp.py b/colibre/scripts/density_species_interp.py index ecfb2bb1..f63608b1 100644 --- a/colibre/scripts/density_species_interp.py +++ b/colibre/scripts/density_species_interp.py @@ -198,8 +198,14 @@ def setup_axes(number_of_simulations: int, prop_type="hydro"): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/density_temperature.py b/colibre/scripts/density_temperature.py index dd6139d9..e07a63c7 100644 --- a/colibre/scripts/density_temperature.py +++ b/colibre/scripts/density_temperature.py @@ -63,8 +63,14 @@ def setup_axes(number_of_simulations: int): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/density_temperature_dust.py b/colibre/scripts/density_temperature_dust.py index 47d589b9..4c338b78 100644 --- a/colibre/scripts/density_temperature_dust.py +++ b/colibre/scripts/density_temperature_dust.py @@ -83,8 +83,14 @@ def setup_axes(number_of_simulations: int, prop_type="hydro"): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/density_temperature_dust2metal.py b/colibre/scripts/density_temperature_dust2metal.py index 890ed16c..b3d8b33e 100644 --- a/colibre/scripts/density_temperature_dust2metal.py +++ b/colibre/scripts/density_temperature_dust2metal.py @@ -90,8 +90,14 @@ def setup_axes(number_of_simulations: int, prop_type="hydro"): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/density_temperature_dust_to_metals.py b/colibre/scripts/density_temperature_dust_to_metals.py index 3b1e7dcf..16286bf5 100644 --- a/colibre/scripts/density_temperature_dust_to_metals.py +++ b/colibre/scripts/density_temperature_dust_to_metals.py @@ -92,8 +92,14 @@ def setup_axes(number_of_simulations: int): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/density_temperature_metals.py b/colibre/scripts/density_temperature_metals.py index aa955648..6d82bc0d 100644 --- a/colibre/scripts/density_temperature_metals.py +++ b/colibre/scripts/density_temperature_metals.py @@ -75,8 +75,14 @@ def setup_axes(number_of_simulations: int): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/density_temperature_sf_fraction.py b/colibre/scripts/density_temperature_sf_fraction.py index 79ea14df..0edc4424 100644 --- a/colibre/scripts/density_temperature_sf_fraction.py +++ b/colibre/scripts/density_temperature_sf_fraction.py @@ -88,8 +88,14 @@ def setup_axes(number_of_simulations: int): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/density_temperature_species.py b/colibre/scripts/density_temperature_species.py index 6edc22a2..05b733af 100644 --- a/colibre/scripts/density_temperature_species.py +++ b/colibre/scripts/density_temperature_species.py @@ -91,8 +91,14 @@ def setup_axes(number_of_simulations: int, prop_type="hydro"): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/gas_minimal_smoothing_length_redshift.py b/colibre/scripts/gas_minimal_smoothing_length_redshift.py index 406e8c8a..e377b991 100644 --- a/colibre/scripts/gas_minimal_smoothing_length_redshift.py +++ b/colibre/scripts/gas_minimal_smoothing_length_redshift.py @@ -120,8 +120,14 @@ def setup_axes(number_of_simulations: int): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/max_temperature_redshift.py b/colibre/scripts/max_temperature_redshift.py index 0e8f723b..defede6c 100644 --- a/colibre/scripts/max_temperature_redshift.py +++ b/colibre/scripts/max_temperature_redshift.py @@ -65,8 +65,14 @@ def setup_axes(number_of_simulations: int): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/median_temperature_density.py b/colibre/scripts/median_temperature_density.py index bbd06471..467f09d3 100644 --- a/colibre/scripts/median_temperature_density.py +++ b/colibre/scripts/median_temperature_density.py @@ -47,8 +47,14 @@ nlabel % number_of_simulations > 0 ) + fig_w, fig_h = pl.figaspect(vertical_number / horizontal_number) fig, ax = pl.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax diff --git a/colibre/scripts/particle_updates_step_cost.py b/colibre/scripts/particle_updates_step_cost.py index 9ab9ee98..780b9119 100644 --- a/colibre/scripts/particle_updates_step_cost.py +++ b/colibre/scripts/particle_updates_step_cost.py @@ -71,8 +71,14 @@ def setup_axes(number_of_simulations: int): # Ensure >= number_of_simulations plots in a grid vertical_number = int(np.ceil(number_of_simulations / horizontal_number)) + fig_w, fig_h = plt.figaspect(vertical_number / horizontal_number) fig, ax = plt.subplots( - vertical_number, horizontal_number, squeeze=True, sharex=True, sharey=True + vertical_number, + horizontal_number, + squeeze=True, + sharex=True, + sharey=True, + figsize=(fig_w, fig_h), ) ax = np.array([ax]) if number_of_simulations == 1 else ax