sage_analysis.example_plots

Here we show a myriad of functions that can be used to plot properties calculated from the SAGE output.

We refer to ../user/plot for more information on how plotting is handled.

Authors: (Jacob Seiler, Manodeep Sinha)

sage_analysis.example_plots.adjust_legend(ax, location='upper right', scatter_plot=0)[source]

Adjusts the legend of a specified axis.

Parameters:
  • ax (matplotlib axes object) – The axis whose legend we’re adjusting
  • location (String, default “upper right”. See matplotlib docs for full options) – Location for the legend to be placed.
  • scatter_plot ({0, 1}) – For plots involved scattered-plotted data, we adjust the size and alpha of the legend points.
Returns:

Return type:

None. The legend is placed directly onto the axis.

sage_analysis.example_plots.plot_BMF(models: List[sage_analysis.model.Model], snapshots: List[int], plot_output_path: str, plot_output_format: str = 'png') → matplotlib.figure.Figure[source]

Plots the baryonic mass function for the specified models. This is the mass function for the stellar mass + cold gas.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshots (List of ints) – The snapshot to be plotted for each Model in models.
  • plot_output_path (string) – Path to where the plot will be saved.
  • plot_output_format (string, optional) – Format the plot will be saved in, includes the full stop.
  • Generates
  • ———
  • The plot will be saved as “<plot_output_path>2.BaryonicMassFunction.<plot_output_format>”
sage_analysis.example_plots.plot_BTF(models: List[sage_analysis.model.Model], snapshots: List[int], plot_output_path: str, plot_output_format: str = 'png') → matplotlib.figure.Figure[source]

Plots the baryonic Tully-Fisher relationship for the specified models.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshots (list of ints) – The snapshot to be plotted for each Model in models.
  • plot_output_path (string) – Path to where the plot will be saved.
  • plot_output_format (string, default “png”) – Format the plot will be saved in, includes the full stop.
  • Generates
  • ———
  • The plot will be saved as “<plot_output_path>4.BaryonicTullyFisher.<plot_output_format>”
sage_analysis.example_plots.plot_GMF(models: List[sage_analysis.model.Model], snapshots: List[int], plot_output_path: str, plot_output_format: str = 'png') → matplotlib.figure.Figure[source]

Plots the gas mass function for the specified models. This is the mass function for the cold gas.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshots (list of ints) – The snapshot to be plotted for each Model in models.
  • plot_output_path (string) – Path to where the plot will be saved.
  • plot_output_format (string, default “png”) – Format the plot will be saved in, includes the full stop.
  • Generates
  • ———
  • The plot will be saved as “<plot_output_path>3.GasMassFunction.<plot_output_format>”
sage_analysis.example_plots.plot_SFRD_history(models: List[sage_analysis.model.Model], snapshots: List[int], plot_output_path: str, plot_output_format: str = 'png') → matplotlib.figure.Figure[source]

Plots the evolution of star formation rate density for the specified models.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshots (List of ints) – This is a dummy variable that is present to ensure the signature is identical to the other plot functions.
  • plot_output_path (string) – Path to where the plot will be saved.
  • snapshot (int) – This is a dummy variable that is present to ensure the signature is identical to the other plot functions.
  • plot_output_format (string, default “png”) – Format the plot will be saved in, includes the full stop.
  • Generates
  • ———
  • The plot will be saved as “<plot_output_path>B.SFRDensity.<plot_output_format>”
sage_analysis.example_plots.plot_SMD_history(models: List[sage_analysis.model.Model], snapshots: List[int], plot_output_path: str, plot_output_format: str = 'png') → matplotlib.figure.Figure[source]

Plots the evolution of stellar mass density for the specified models.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshots (List of ints) – This is a dummy variable that is present to ensure the signature is identical to the other plot functions.
  • plot_output_path (string) – Path to where the plot will be saved.
  • plot_output_format (string, default “png”) – Format the plot will be saved in, includes the full stop.
  • Generates
  • ———
  • The plot will be saved as “<plot_output_path>C.StellarMassDensity.<plot_output_format>”
sage_analysis.example_plots.plot_SMF(models: List[sage_analysis.model.Model], snapshots: List[int], plot_output_path: str, plot_output_format: str = 'png', plot_sub_populations: bool = False) → matplotlib.figure.Figure[source]

Plots the stellar mass function for the specified models.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshots (list of ints) – The snapshot to be plotted for each Model in models.
  • plot_output_path (string) – Path to where the plot will be saved.
  • plot_output_format (string, default “png”) – Format the plot will be saved in, includes the full stop.
  • plot_sub_populations (Boolean, default False) – If True, plots the stellar mass function for red and blue sub-populations.
  • Generates
  • ———
  • The plot will be saved as “<plot_output_path>1.StellarMassFunction.<plot_output_format>”
sage_analysis.example_plots.plot_SMF_history(models: List[sage_analysis.model.Model], snapshots: List[int], plot_output_path: str, plot_output_format='png') → matplotlib.figure.Figure[source]

Plots the evolution of the stellar mass function for the specified models. This function loops over the value of model.SMF_snaps and plots and the SMFs at each snapshots.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshots (list of ints) – This is a dummy variable that is present to ensure the signature is identical to the other plot functions.
  • plot_output_path (string) – Path to where the plot will be saved.
  • plot_output_format (string, default “png”) – Format the plot will be saved in, includes the full stop.
  • Generates
  • ———
  • The plot will be saved as “<plot_output_path>A.StellarMassFunction.<plot_output_format>”
sage_analysis.example_plots.plot_baryon_fraction(models: List[sage_analysis.model.Model], snapshots: List[int], plot_output_path: str, plot_output_format: str = 'png', plot_sub_populations: bool = False) → matplotlib.figure.Figure[source]

Plots the total baryon fraction as afunction of halo mass for the specified models.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshots (list of ints) – The snapshot to be plotted for each Model in models.
  • plot_output_path (string) – Path to where the plot will be saved.
  • plot_output_format (string, default “png”) – Format the plot will be saved in, includes the full stop.
  • plot_sub_populations (Boolean, default False) – If True, plots the baryon fraction for each reservoir. Otherwise, only plots the total baryon fraction.
  • Generates
  • ———
  • The plot will be saved as “<plot_output_path>11.BaryonFraction.<plot_output_format>”
sage_analysis.example_plots.plot_bh_bulge(models: List[sage_analysis.model.Model], snapshots: int, plot_output_path: str, plot_output_format: str = 'png') → matplotlib.figure.Figure[source]

Plots the black-hole bulge relationship for the specified models.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshots (list of ints) – The snapshot to be plotted for each Model in models.
  • plot_output_path (string) – Path to where the plot will be saved.
  • plot_output_format (string, default “png”) – Format the plot will be saved in, includes the full stop.
  • Generates
  • ———
  • The plot will be saved as “<plot_output_path>8.BlackHoleBulgeRelationship.<plot_output_format>”
sage_analysis.example_plots.plot_bulge_fraction(models: List[sage_analysis.model.Model], snapshots: int, plot_output_path: str, plot_output_format: str = 'png', plot_var: bool = False) → matplotlib.figure.Figure[source]

Plots the fraction of the stellar mass that is located in the bulge/disk as a function of stellar mass for the specified models.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshot (int) – Snapshot we’re plotting at.
  • plot_output_path (string) – Path to where the plot will be saved.
  • plot_output_format (string, default “png”) – Format the plot will be saved in, includes the full stop.
  • plot_var (Boolean, default False) – If True, plots the variance as shaded regions.
  • Generates
  • ———
  • The plot will be saved as “<plot_output_path>10.BulgeMassFraction.<plot_output_format>”
sage_analysis.example_plots.plot_gas_fraction(models: List[sage_analysis.model.Model], snapshots: List[int], plot_output_path: str, plot_output_format: str = 'png') → matplotlib.figure.Figure[source]

Plots the fraction of baryons that are in the cold gas reservoir as a function of stellar mass for the specified models.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshots (list of ints) – The snapshot to be plotted for each Model in models.
  • plot_output_path (string) – Path to where the plot will be saved.
  • plot_output_format (string, default “png”) – Format the plot will be saved in, includes the full stop.
  • Generates
  • ———
  • The plot will be saved as “<plot_output_path>6.GasFraction.<plot_output_format>”
sage_analysis.example_plots.plot_metallicity(models: List[sage_analysis.model.Model], snapshots: List[int], plot_output_path: str, plot_output_format: str = 'png') → matplotlib.figure.Figure[source]

Plots the metallicity as a function of stellar mass for the speicifed models.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshots (list of ints) – The snapshot to be plotted for each Model in models.
  • plot_output_path (string) – Path to where the plot will be saved.
  • plot_output_format (string, default “png”) – Format the plot will be saved in, includes the full stop.
  • Generates
  • ———
  • The plot will be saved as “<plot_output_path>7.Metallicity.<plot_output_format>”
sage_analysis.example_plots.plot_quiescent(models: List[sage_analysis.model.Model], snapshots: List[int], plot_output_path: str, plot_output_format: str = 'png', plot_sub_populations: bool = False) → matplotlib.figure.Figure[source]

Plots the fraction of galaxies that are quiescent as a function of stellar mass for the specified models. The quiescent cut is defined by sSFRcut.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshots (list of ints) – The snapshot to be plotted for each Model in models.
  • plot_output_path (string) – Path to where the plot will be saved.
  • plot_output_format (string, default “png”) – Format the plot will be saved in, includes the full stop.
  • plot_sub_populations (Boolean, default False) – If True, plots the centrals and satellite sub-populations.
  • Generates
  • ———
  • The plot will be saved as “<plot_output_path>9.QuiescentFraction.<plot_output_format>”
sage_analysis.example_plots.plot_reservoirs(models: List[sage_analysis.model.Model], snapshots: List[int], plot_output_path: str, plot_output_format: str = 'png') → List[matplotlib.figure.Figure][source]

Plots the mass in each reservoir as a function of halo mass for the specified models.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshots (list of ints) – The snapshot to be plotted for each Model in models.
  • plot_output_path (string) – Path to where the plot will be saved.
  • plot_output_format (string, default “png”) – Format the plot will be saved in, includes the full stop.
  • Generates
  • ———
  • A plot will be saved as ``”<plot_output_path>12.MassReservoirs<model.label>.<plot_output_format>”`` for each mode.
sage_analysis.example_plots.plot_sSFR(models: List[sage_analysis.model.Model], snapshots: List[int], plot_output_path: str, plot_output_format: str = 'png') → matplotlib.figure.Figure[source]

Plots the specific star formation rate as a function of stellar mass for the specified models.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshots (list of ints) – The snapshot to be plotted for each Model in models.
  • plot_output_path (string) – Path to where the plot will be saved.
  • plot_output_format (string, default “png”) – Format the plot will be saved in, includes the full stop.
  • Generates
  • ———
  • The plot will be saved as “<plot_output_path>5.SpecificStarFormationRate.<plot_output_format>”
sage_analysis.example_plots.plot_spatial(models: List[sage_analysis.model.Model], snapshots: List[int], plot_output_path: str, plot_output_format: str = 'png') → matplotlib.figure.Figure[source]

Plots the spatial distribution of the galaxies for specified models.

Parameters:
  • models (List of Model class instance) – Models that will be plotted. These instances contain the properties necessary to create the plot, accessed via Model.properties["snapshot_<snapshot>"]["property_name"].
  • snapshots (list of ints) – The snapshot to be plotted for each Model in models.
  • plot_output_path (string) – Path to where the plot will be saved.
  • plot_output_format (string, default “png”) – Format the plot will be saved in, includes the full stop.
  • Generates
  • ———
  • A plot will be saved as ``”<plot_output_path>13.SpatialDistribution<model.label>.<plot_output_format>”`` for each
  • model.
sage_analysis.example_plots.plot_spatial_3d(pos, output_file, box_size) → matplotlib.figure.Figure[source]

Plots the 3D spatial distribution of galaxies.

Parameters:
  • pos (numpy 3D array with length equal to the number of galaxies) – The position (in Mpc/h) of the galaxies.
  • output_file (String) – Name of the file the plot will be saved as.
Returns:

Return type:

None. A plot will be saved as output_file.

sage_analysis.example_plots.setup_matplotlib_options()[source]

Set the default plotting parameters.