galaxychop.plot module

Plot helper for the galaxy object.

class galaxychop.plot.GalaxyPlotter(galaxy)[source]

Bases: object

Make plots of DecisionMatrix.

get_df_and_hue(ptypes, attributes, labels, lmap)[source]

Dataframe and Hue constructor for plot implementations.

Parameters
  • ptypes (keys of ParticleSet class parameters.) – Particle type.

  • attributes (keys of ParticleSet class parameters.) – Names of ParticleSet class parameters.

  • labels (keys of ParticleSet class parameters.) – Variable to map plot aspects to different colors.

  • lmap (dicts) – Name assignment to the label.

Returns

  • df (pandas.DataFrame) – DataFrame of galaxy properties with labels added.

  • hue (keys of ParticleSet class parameters.) – Labels of all galaxy particles.

pairplot(ptypes=None, attributes=None, labels='ptype', lmap=None, **kwargs)[source]

Draw a pairplot of the galaxy properties.

By default, this function will create a grid of Axes such that each numeric variable in data will by shared across the y-axes across a single row and the x-axes across a single column. The diagonal plots drow a univariate distribution to show the marginal distribution of the data in each column. This function groups the values of all galaxy particles according to some ParticleSet class parameter.

Parameters
  • ptypes (keys of ParticleSet class parameters.) – Particle type. Default value = None

  • attributes (keys of ParticleSet class parameters.) – Names of ParticleSet class parameters. Default value = None

  • labels (keys of ParticleSet class parameters.) – Variable to map plot aspects to different colors. Default value = None

  • lmap (dicts) – Name assignment to the label. Default value = None

  • **kwargs – Additional keyword arguments are passed and are documented in seaborn.pairplot.

Returns

Return type

seaborn.axisgrid.PairGrid

scatter(x, y, ptypes=None, labels=None, lmap=None, **kwargs)[source]

Draw a scatter plot of galaxy properties.

Shows the relationship between x and y. This function groups the values of all galaxy particles according to some ParticleSet class parameter.

Parameters
  • x (keys of ParticleSet class parameters.) – Variables that specify positions on the x and y axes. Default value y = None.

  • y (keys of ParticleSet class parameters.) – Variables that specify positions on the x and y axes. Default value y = None.

  • ptypes (keys of ParticleSet class parameters.) – Particle type. Default value = None

  • labels (keys of ParticleSet class parameters.) – Variable to map plot aspects to different colors. Default value = None

  • lmap (dicts) – Name assignment to the label. Default value = None

  • **kwargs – Additional keyword arguments are passed and are documented in seaborn.scatterplot.

Returns

Return type

matplotlib.axes.Axes

hist(x, y=None, ptypes=None, labels=None, lmap=None, **kwargs)[source]

Draw a histogram of galaxy properties.

Plot univariate or bivariate histograms to show distributions of datasets. This function groups the values of all galaxy particles according to some ParticleSet class parameter.

Parameters
  • x (keys of ParticleSet class parameters.) – Variables that specify positions on the x and y axes. Default value y = None.

  • y (keys of ParticleSet class parameters.) – Variables that specify positions on the x and y axes. Default value y = None.

  • ptypes (keys of ParticleSet class parameters.) – Particle type. Default value = None

  • labels (keys of ParticleSet class parameters.) – Variable to map plot aspects to different colors. Default value = None

  • lmap (dicts) – Name assignment to the label. Default value = None

  • **kwargs – Additional keyword arguments are passed and are documented in seaborn.histplot.

Returns

Return type

matplotlib.axes.Axes

kde(x, y=None, ptypes=None, labels=None, lmap=None, **kwargs)[source]

Draw a Kernel Density plot of galaxy properties.

Plot univariate or bivariate distributions using kernel density estimation (KDE). This plot represents the galaxy properties using a continuous probability density curve in one or more dimensions. This function groups the values of all galaxy particles according to some ParticleSet class parameter.

Parameters
  • x (keys of ParticleSet class parameters.) – Variables that specify positions on the x and y axes. Default value y = None.

  • y (keys of ParticleSet class parameters.) – Variables that specify positions on the x and y axes. Default value y = None.

  • ptypes (keys of ParticleSet class parameters.) – Particle type. Default value = None

  • labels (keys of ParticleSet class parameters.) – Variable to map plot aspects to different colors. Default value = None

  • lmap (dicts) – Name assignment to the label. Default value = None

  • **kwargs – Additional keyword arguments are passed and are documented in seaborn.kdeplot.

Returns

Return type

matplotlib.axes.Axes

get_circ_df_and_hue(cbins, attributes, labels, lmap)[source]

Dataframe and Hue constructor for plot implementations.

Parameters
  • cbins (tuple) – It contains the two widths of bins necessary for the calculation of the circular angular momentum. Shape: (2,). Dafult value = (0.05, 0.005).

  • attributes (keys of JCirc tuple.) – Keys of the normalized specific energy, the circularity parameter (J_z/J_circ) and/or the projected circularity parameter (J_p/J_circ) of the stellar particles.

  • labels (keys of JCirc tuple.) – Variable to map plot aspects to different colors.

  • lmap (dicts) – Name assignment to the label.

Returns

  • df (pandas.DataFrame) – DataFrame of the normalized specific energy, the circularity parameter (J_z/J_circ) and/or the projected circularity parameter (J_p/J_circ) of the stellar particles with labels added.

  • hue (keys of JCirc tuple.) – Labels of stellar particles.

circ_pairplot(cbins=(0.05, 0.005), attributes=None, labels=None, lmap=None, **kwargs)[source]

Draw a pairplot of circularity and normalized energy.

By default, this function will create a grid of Axes such that each numeric variable in data will by shared across the y-axes across a single row and the x-axes across a single column. The diagonal plots drow a univariate distribution to show the marginal distribution of the data in each column. This function groups the values of stellar particles according to some keys of JCirc tuple.

Parameters
  • cbins (tuple) – It contains the two widths of bins necessary for the calculation of the circular angular momentum. Shape: (2,). Dafult value = (0.05, 0.005).

  • attributes (keys of ParticleSet class parameters.) – Names of ParticleSet class parameters. Default value = None

  • labels (keys of JCirc tuple.) – Variable to map plot aspects to different colors. Default value = None

  • lmap (dicts) – Name assignment to the label. Default value = None

  • **kwargs – Additional keyword arguments are passed and are documented in seaborn.pairplot.

Returns

Return type

seaborn.axisgrid.PairGrid

circ_scatter(x, y, cbins=(0.05, 0.005), labels=None, lmap=None, **kwargs)[source]

Draw a scatter plot of circularity and normalized energy.

Shows the relationship between x and y. This function groups the values of stellar particles according to some keys of JCirc tuple.

Parameters
  • x (keys of JCirc tuple.) – Variables that specify positions on the x and y axes. Default value y = None.

  • y (keys of JCirc tuple.) – Variables that specify positions on the x and y axes. Default value y = None.

  • cbins (tuple) – It contains the two widths of bins necessary for the calculation of the circular angular momentum. Shape: (2,). Dafult value = (0.05, 0.005).

  • labels (keys of JCirc tuple.) – Variable to map plot aspects to different colors. Default value = None

  • lmap (dicts) – Name assignment to the label. Default value = None

  • **kwargs – Additional keyword arguments are passed and are documented in seaborn.scatterplot.

Returns

Return type

matplotlib.axes.Axes

circ_hist(x, y=None, cbins=(0.05, 0.005), labels=None, lmap=None, **kwargs)[source]

Draw a histogram of circularity and normalized energy.

Plot univariate or bivariate histograms to show distributions of datasets. This function groups the values of stellar particles according to some keys of JCirc tuple.

Parameters
  • x (keys of JCirc tuple.) – Variables that specify positions on the x and y axes. Default value y = None.

  • y (keys of JCirc tuple.) – Variables that specify positions on the x and y axes. Default value y = None.

  • cbins (tuple) – It contains the two widths of bins necessary for the calculation of the circular angular momentum. Shape: (2,). Dafult value = (0.05, 0.005).

  • labels (keys of JCirc tuple.) – Variable to map plot aspects to different colors. Default value = None

  • lmap (dicts) – Name assignment to the label. Default value = None

  • **kwargs – Additional keyword arguments are passed and are documented in seaborn.histplot.

Returns

Return type

matplotlib.axes.Axes

circ_kde(x, y=None, cbins=(0.05, 0.005), labels=None, lmap=None, **kwargs)[source]

Draw a Kernel Density plot of circularity and normalized energy.

Plot univariate or bivariate distributions using kernel density estimation (KDE). This plot represents normalized specific energy, the circularity parameter (J_z/J_circ) and/or the projected circularity parameter (J_p/J_circ) of the stellar particles using a continuous probability density curve in one or more dimensions. This function groups the values of stellar particles according to some keys of JCirc tuple.

Parameters
  • x (keys of JCirc tuple.) – Variables that specify positions on the x and y axes. Default value y = None.

  • y (keys of JCirc tuple.) – Variables that specify positions on the x and y axes. Default value y = None.

  • cbins (tuple) – It contains the two widths of bins necessary for the calculation of the circular angular momentum. Shape: (2,). Dafult value = (0.05, 0.005).

  • labels (keys of JCirc tuple.) – Variable to map plot aspects to different colors. Default value = None

  • lmap (dicts) – Name assignment to the label. Default value = None

  • **kwargs – Additional keyword arguments are passed and are documented in seaborn.kdeplot.

Returns

Return type

matplotlib.axes.Axes