Coloring - BETA -

Classes related to coloring.

API

Classes:

Coloring(config[, minr, maxr, nr, nl])

Class to hold coloring (population data) related routines

class coloring.Coloring(config, minr='auto', maxr='auto', nr=50, nl=61)

Class to hold coloring (population data) related routines

This class provides methods for Voronoi binning of orbits in the radius-circularity phase space, fitting Bayesian models to the observed data, and calculating orbital decomposition of the population data. It also includes methods for plotting the results of the Voronoi binning and the orbital decomposition.

The methods and code in this DYNAMITE class are inspired and partly adapted from Zhu et al., 2020, MNRAS, 496, 1579 and Zhu et al., 2022, A&A, 664, A115. Many thanks to Ling Zhu for sharing her code, which was instrumental for developing this class. The Voronoi orbit binning makes use of the vorbin package by Michele Cappellari (M. Cappellari, Y. Copin, 2003, MNRAS 342, 345).

Parameters:
configa dyn.config_reader.Configuration object

the configuration object containing the model and system settings.

minrfloat or str, optional

the minimum radius [kpc] considered in the binning. If ‘auto’, minr is set to zero. The default is ‘auto’.

maxrfloat or str, optional

the maximum radius [kpc] considered in the binning. If ‘auto’, maxr is set to the config file’s orblib_settings: logrmax value, converted to kpc. The default is ‘auto’.

nrint, optional

number of radial bins. The default is 50.

nlint, optional

number of circularity bins. The default is 61.

Methods:

bin_phase_space([model, vor_weight, ...])

Perform Voronoi binning of orbits in the radius-circularity phase space.

bin_phase_space_powerbin([model, ...])

EXPERIMENTAL POWERBIN IMPLEMENTATION TO REPLACE DEPRECATED VORBIN - NOT FOR PRODUCTIVE USE YET!!

circularity_pop_plot(weights, pop_data, *[, ...])

Orbit probability distribution in the (population data, circularity) plane and fraction of disk orbits as a function of the population data

fit_bayesian(prior_dist, prior_par, ...)

Fit orbit bundle population data maps to the observed data using Bayesian inference.

get_pop_orbital_decomp(models, ...)

Calculate orbital decomposition of the population data

get_rl_distribution(model)

Calculate the orbit distribution in the \((r, \lambda_z)\) bins

orbit_bundle_plot([orbit_distribution, ...])

Create a plot of the orbit bundle distribution in the radius-circularity phase space.

pop_decomp_plot(orbit_data[, plot_labels, ...])

Population decomposition plot, averaging the data of multiple models

pop_maps(pop_data, model_data, flux_norm[, ...])

Plot population data maps for observed and model data

pop_pop_plot(x_posterior, y_posterior[, ...])

Create a population data vs population data plot with smoothing

bin_phase_space(model=None, vor_weight=0.01, vor_ignore_zeros=False, make_diagnostic_plots=False, extra_diagnostic_output=False, cvt=False, wvt=False, use_noise=False, use_cache=True)

Perform Voronoi binning of orbits in the radius-circularity phase space. The goal is to group the “original” n_orbits orbit bundles into fewer n_bundle “Voronoi” bundles with each of these Voronoi bundles accounting for a weight of at least vor_weight. The resulting orbit bundle mapping is returned and written to the model directory. This method uses the vorbin package by Michele Cappellari (M. Cappellari, Y. Copin, 2003, MNRAS 342, 345).

Parameters:
modela dynamite.model.Model object, optional

the model used for the binning. If None, choose the minimum \(\chi^2\) model (the configuration setting which_chi2 determines the \(\chi^2\) type). The default is None.

vor_weightfloat, optional

the target total orbital weight in each Voronoi bin. The default is 0.01.

vor_ignore_zerosbool, optional

If True, then radius-circularity bins that have zero total weight will be ignored in the binning process. The default is False.

make_diagnostic_plotsbool, optional

If True, both vorbin and DYNAMITE will produce diagnostic plots visualizing the binning result. The default is False.

extra_diagnostic_outputbool, optional

If True, vorbin will print details on the binning to stdout. The default is False.

cvtbool, optional

If True, the Voronoi binning will be performed using the CVT (Centroidal Voronoi Tessellation) algorithm. For details, refer to the vorbin documentation. The default is False.

wvtbool, optional

If True, the Voronoi binning will be performed using the WVT (Weighted Voronoi Tessellation) algorithm (Diehl & Statler 2006, MNRAS, 368, 497). For details, refer to the vorbin documentation. The default is False.

use_noisebool, optional

If True, Poissonian noise will be assumed for the signal (=orbit weights). The weights will be multiplied by 1e4, the Poissonian noise = sqrt(weights), and vor_weight will be replaced by np.sqrt(vor_weight*10000) for the purpose of Voronoi binning. Also, adding Voronoi bin weights will follow equation (2) of Cappellari & Copin, 2003, MNRAS 342, 345). If False, the aggregate Voronoi bin weights will simply be the sum of the respective \((r, \lambda_z)\) bin weights. The default is False.

use_cachebool, optional

If True, the method will read cached results if available. If the Voronoi binning has already been performed, the results will be loaded from the cache in the model directory instead of recalculating them. Note that irrespective of use_cache, the binning results will always be written to the model directory. The default is True.

Returns:
(vor_bundle_mapping, phase_space_binning)tuple, where
vor_bundle_mappingnp.array of shape (n_bundle, n_orbits)

Mapping between the “original” orbit bundles and the Voronoi orbit bundles: vor_bundle_mapping(i_bundle, i_orbit) is the fraction of i_orbit assigned to i_bundle, multiplied by i_orbit’s weight.

phase_space_binningdict

‘out’: np.array of shape (3, n_bundle), the Voronoi binning output: weighted Voronoi bin centroid coordinates r_bar, lambda_bar and Voronoi bin total weights ‘map’: np.array of shape (self.nr * self.nl,) the phase space mapping: Voronoi bin numbers for each input bin. Input bins without Voronoi bin (zero weight and vor_ignore_zeros=True) are set np.nan.

bin_phase_space_powerbin(model=None, vor_weight=0.01, make_diagnostic_plots=False, verbose=0, use_cache=False)

EXPERIMENTAL POWERBIN IMPLEMENTATION TO REPLACE DEPRECATED VORBIN - NOT FOR PRODUCTIVE USE YET!!

Perform PowerBin binning of orbits in the radius-circularity phase space. The goal is to group the “original” n_orbits orbit bundles into fewer n_bundle “Voronoi” bundles with each of these Voronoi bundles accounting for a weight of at least vor_weight. The resulting orbit bundle mapping is returned and written to the model directory. This method uses the powerbin package by Michele Cappellari (M. Cappellari, 2025, MNRAS, subm.) which supersedes the deprecated vorbin package used earlier.

Parameters:
modela dynamite.model.Model object, optional

the model used for the binning. If None, choose the minimum \(\chi^2\) model (the configuration setting which_chi2 determines the \(\chi^2\) type). The default is None.

vor_weightfloat, optional

the target total orbital weight in each Voronoi bin. The default is 0.01.

make_diagnostic_plotsbool, optional

If True, both vorbin and DYNAMITE will produce diagnostic plots visualizing the binning result. The default is False.

verboseint, optional

Passed to powerbin. Controls the level of printed output. Supported values in increasing verbosity are 0, 1, and 2. The most detailed setting (3) currectly crashes. The default is 0.

use_cachebool, optional

If True, the method will use cached results if available. If the Voronoi binning has already been performed, the results will be loaded from the cache in the model directory instead of recalculating them. The default is True.

Returns:
(vor_bundle_mapping, phase_space_binning)tuple, where
vor_bundle_mappingnp.array of shape (n_bundle, n_orbits)

Mapping between the “original” orbit bundles and the Voronoi orbit bundles: vor_bundle_mapping(i_bundle, i_orbit) is the fraction of i_orbit assigned to i_bundle, multiplied by i_orbit’s weight.

phase_space_binningdict

‘out’: np.array of shape (3, n_bundle), the Voronoi binning output: weighted Voronoi bin centroid coordinates r_bar, lambda_bar and Voronoi bin total weights ‘map’: np.array of shape (self.nr * self.nl,) the phase space mapping: Voronoi bin numbers for each input bin

circularity_pop_plot(weights, pop_data, *, pop_label='Stellar age [Gyr]', pop_scale='linear', prob_scale='linear', n_pop_bins=14, interpolation='none', disk_fraction=True, lz_disk=0.8, figtype='.png', dpi=100)

Orbit probability distribution in the (population data, circularity) plane and fraction of disk orbits as a function of the population data

Create and save a plot showing the orbit probability distribution in the (population data, circularity) plane, averaged over multiple DYNAMITE models. If disk_fraction is True, the cold orbit fraction as a function of the population data is plotted in a separate panel above the main plot. The cold orbit fraction is defined as the fraction of orbits with circularity \(\lambda_z\) greater than a specified threshold lz_disk (default is 0.8) within each population data bin. A dashed line indicates the disk fraction threshold and a vertical dashed line indicates the population data value at which the cold orbit fraction crosses 50%. The plot is saved in the specified file format and resolution.

Parameters:
weightsnp.array of shape (nr, nl, n_models)

Array with the total orbit weight in each \((r, \lambda_z)\) phase space bin for each DYNAMITE model. Can directly use the first slice of the output of get_pop_orbital_decomp().

pop_datanp.array of shape (nr, nl, n_models)

Array with the population data distribution in each \((r, \lambda_z)\) phase space bin for each DYNAMITE model. Can directly use a slice of the output of get_pop_orbital_decomp().

pop_labelstr, optional

Label for the population data axis. The default ‘Stellar age [Gyr]’ assumes that a circularity-age plot is the common case.

pop_scalestr, optional

Scale of the population data axis, either ‘linear’ or ‘log’, by default ‘linear’.

prob_scalestr, optional

Scale of the probability density colorbar, either ‘linear’ or ‘log’, by default ‘linear’.

n_pop_binsint, optional

Number of population data bins; determines the resolution along the population data axis of both the orbit distribution and cold orbit fraction subplots. The bins will be evenly and linearly spaced between the minimum and maximum population data values in pop_data. The default is 14.

interpolationstr, optional

Interpolation method for the imshow plot of the orbit distribution. See https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.imshow.html for available options. The default is ‘none’.

disk_fractionbool, optional

Whether to plot the cold orbit fraction as a function of the population data in a separate panel above the main plot. If False, the plot will have only one pane showing the orbit probability distribution. The default is True.

lz_diskfloat, optional

Circularity threshold for the disk fraction, above which orbits are considered as part of the disk. This is used to calculate the cold orbit fraction. The default value is 0.8.

figtypestr, optional

Determines the file format of the saved figure, by default ‘.png’.

dpiint, optional

The resolution of saved figure, by default 100.

Returns:
(figure, disk_50)tuple, where
figurematplotlib.figure.Figure

The created figure object.

disk_50float or np.nan

The population data value at which the cold orbit fraction crosses 50% (disk fraction threshold). Calculated via linear interpolation between the two population data bins that cross the threshold. Set to np.nan if the cold orbit fraction does not cross the threshold in the given population data range or if disk_fraction is False.

Raises:
ValueError

If pop_scale or prob_scale is invalid, or if the shapes of weights and pop_data do not match. The error message will indicate the issue.

fit_bayesian(prior_dist, prior_par, flux_data_norm, obs_data, sample)

Fit orbit bundle population data maps to the observed data using Bayesian inference.

Employs Probabilistic Programming with PyMC to fit the observed quantity (e.g., age or metallicity) based on the normalized flux data for the spatial bins. The model uses a truncated normal or lognormal distribution for the prior of the observed quantity and a Student’s t distribution with fixed sigma (Half-Cauchy distributed with beta=5) and nu (Exponential distributed with parameter 1/30) parameters for the likelihood of the observed data. This method uses the Markov chain Monte Carlo (MCMC) sampling algorithm NUTS (No-U-Turn Sampler), initialized with the ADVI (Automatic Differentiation Variational Inference) method. The code has been strongly inspired by a similar implementation provided by Ling Zhu as used in e.g., Zhu et al. 2022, A&A, 664, A115.

Parameters:
prior_diststr

Distribution for the prior of the observed quantity (e.g., age or metallicity). Currently implemented: ‘normal’: truncated normal distribution ‘lognormal’: truncated lognormal distribution Other distributions will raise a NotImplementedError.

prior_pardict

Parameters for the prior distribution. For ‘normal’, it should contain ‘mu’, ‘sigma’, ‘lower’, and ‘upper’ keys, where ‘mu’ and ‘sigma’ are the mean and standard deviation of the normal distribution, and ‘lower’ and ‘upper’ are the truncation limits. For ‘lognormal’, it should contain ‘mu’, ‘sigma’, ‘lower’, and ‘upper’ keys, where ‘mu’ and ‘sigma’ are the parameters of the lognormal distribution, and ‘lower’ and ‘upper’ are the truncation limits. The ‘mu’ values should be a 1d numpy array of length equal to the number of orbit bundles fitted to the observed data. The rest of the parameters should be scalars.

flux_data_normnp.array of shape (n_spatial_bins, n_bundle)

Normalized flux data for the spatial bins, where each column corresponds to an orbit bundle and each row corresponds to a spatial bin. This data is used to compute the expected value of the observed quantity based on the fitted model. The normalization is done such that the sum of fluxes in each spatial bin is equal to 1. This is typically the result of orbit bundle maps calculated from a Voronoi binning process of the phase space.

obs_datanp.array of shape (n_spatial_bins,)

Observed data for the spatial bins, which is the quantity to be fitted. This data is used as the observed values in the Bayesian inference process. Typical examples are age or metallicity.

sampledict

Parameters for the sampling process, including: - ‘n_draws’: int, number of draws for the MCMC sampling. - ‘n_tune’: int, number of tuning steps for the MCMC sampling. - ‘advi_init’: int, number of initialization steps for ADVI.

Returns:
(model, trace)tuple, where
modelpymc.Model

The PyMC model object containing the Bayesian model specification.

tracearviz.data.inference_data.InferenceData

The trace of the MCMC sampling, containing the posterior distributions of the model parameters.

Raises:
NotImplementedError

If the distribution specified in prior_dist is not implemented.

get_pop_orbital_decomp(models, vor_bundle_mappings, pop_data)

Calculate orbital decomposition of the population data

This method calculates the orbital decomposition of the population data for a set of DYNAMITE models, given the Voronoi bundle mappings and population datasets. For each model, it computes the total orbit weight in each \((r, \lambda_z)\) phase space bin and the population datasets’ distribution in those bins. The method assumes that all DYNAMITE models have the same number of population datasets and that the Voronoi orbital bundle mappings and population datasets are provided in the same order as the models. It returns an array of shape (n_pop_data + 1, nr, nl, n_models) with the total orbit weight and n_pop_data population data distributions in each of the nr * nl \((r, \lambda_z)\) bins for each of the n_models DYNAMITE models.

Parameters:
modelslist of dynamite.model.Model objects

List of DYNAMITE models for which the orbital decomposition is calculated.

vor_bundle_mappingslist of np.arrays

List of Voronoi orbit bundle mappings for each model. Each mapping is a 2D numpy array where the first dimension corresponds to the Voronoi orbit bundles and the second dimension corresponds to the original orbit bundles: its shape is (n_bundle, n_orbits).

pop_datalist of lists of np.arrays

Population data in a list. There is one entry per model. Those entries are again lists; their length is n_pop_data. They consist of 1D numpy arrays of shape (n_bundle,), each of which holds data of one population dataset in the Voronoi orbit bundles for that model. The order of the population datasets must be the same for each model. Example for 2 models and 2 population datasets ‘age’ and ‘metallicity’: pop_data = [[age_model1, met_model1], [age_model2, met_model2]]

Returns:
orbit_weight_and_pop_data_distribution

np.array of shape (n_pop_data + 1, nr, nl, n_models) Array containing both the total orbit weight and the population data distribution in each \((r, \lambda_z)\) phase space bin for each model. The first slice along the first dimension contains the orbit weight, and the subsequent slices contain the population data distributions. In \((r, \lambda_z)\) bins without any orbits, the distribution will contain np.nan values.

Raises:
ValueError

If the number of population datasets is not the same for all models, or if the number of models in the arguments do not match. The error message will indicate the issue.

get_rl_distribution(model)

Calculate the orbit distribution in the \((r, \lambda_z)\) bins

Parameters:
modela dynamite.model.Model object

the model used for the calculation.

Returns:
orbit_distribution, orbit_projectiontuple of np.arrays
orbit_distributionnp.array of shape (self.nr, self.nl)

Stellar orbits probability density in the \((r, \lambda_z)\) bins.

orbit_projectionscipy.sparse.csr_matrix of shape

(self.nr, self.nl, n_orbits) Projection matrix mapping the orbits to the \((r, \lambda_z)\) bins.

orbit_bundle_plot(orbit_distribution=None, model=None, phase_space_mapping=None, figtype='.png', dpi=100)

Create a plot of the orbit bundle distribution in the radius-circularity phase space.

Parameters:
orbit_distributionnp.array of shape (self.nr, self.nl), optional

Probability density of stellar orbits in the \((r, \lambda_z)\) bins. If None, the orbit distribution is calculated from the model parameter. The default is None.

modela dynamite.model.Model object, optional

The model used for the binning if orbit_distribution is not specified or None. This parameter is ignored if orbit_distribution is given. If model is None, choose the minimum \(\chi^2\) model (the configuration setting which_chi2 determines the \(\chi^2\) type). The default is None.

phase_space_mappingnp.array of shape (self.nr * self.nl,)

The phase space mapping: Voronoi bin numbers for each input bin. np.nan indicates that no Voronoi bin is assigned (THIS IS STILL BUGGY: does not work properly if bin_phase_space was run with vor_ignore_zeros=True…). Can otherwise directly use the bin_phase_space() output phase_space_binning[‘map’].

figtypestr, optional

Determines the file format of the saved figure, by default ‘.png’.

dpiint, optional

The resolution of saved figure, by default 100.

Returns:
matplotlib.figure.Figure

The created figure object.

Raises:
ValueError

If phase_space_binning is None.

pop_decomp_plot(orbit_data, plot_labels=None, colorbar_scale='linear', rcut_kpc=3.5, lz_disk=0.8, lz_warm=0.5, figtype='.png', dpi=100)

Population decomposition plot, averaging the data of multiple models

Create and save an orbital decomposition plot in the \((r, \lambda_z)\) phase space, consisting of multiple panels: the first panel shows the orbit probability density distribution, the subsequent panels show the population dataset distributions. Dashed lines indicate the orbit-based division into four components: disk, warm, bulge, and hot inner stellar halo (can be switched off). The plot averages the data of multiple DYNAMITE models.

Parameters:
orbit_datanp.array of shape (n_pop_data + 1, nr, nl, n_models)

Array containing both the total orbit weight and the population data distribution in each \((r, \lambda_z)\) phase space bin for each of the n_models DYNAMITE models. The first slice along the first dimension contains the orbit weight, and the subsequent slices contain the population data distributions. Can directly use the output of get_pop_orbital_decomp().

plot_labelslist of str or None, optional

Labels for the individual plots. Must have length of n_pop_data + 1. If None, the default labels will be used: ‘Orbit PDF’, ‘Pop dataset 1’, ‘Pop dataset 2’, etc. The default is None.

colorbar_scalestr or list of str, optional

Scale of the colorbar, either ‘linear’ or ‘log’. If a string, it applies to all plots. If a list of strings of length n_pop_data + 1, it sets the scale of each plot individually. The default is ‘linear’.

Cuts for stellar components:
  • disk (lambda_z > lz_disk)

  • bulge (lambda_z < lz_disk, r < rcut_kpc)

  • warm (lz_warm < lambda_z < lz_disk, rcut_kpc < r)

  • hot inner stellar halo (lambda_z < lz_warm, rcut_kpc < r)

If one of the cuts is None, no lines will be drawn.

rcut_kpcfloat or None, optional

by default 3.5

lz_diskfloat or None, optional

by default 0.8

lz_warmfloat or None, optional

by default 0.5

figtypestr, optional

Determines the file format of the saved figure, by default ‘.png’.

dpiint, optional

The resolution of saved figure, by default 100.

Returns:
matplotlib.figure.Figure

The created figure object.

Raises:
ValueError

If colorbar_scale is invalid. The error message will indicate the issue.

pop_maps(pop_data, model_data, flux_norm, cbar_lims='data', figtype='.png', dpi=100)

Plot population data maps for observed and model data

Create and save population data maps for the observed and model data, along with the residuals defined by residual = (model - data) / data_error. The method generates a grid of subplots with the individual population datasets in the columns and observed data, model data, and residuals in the three rows, respectively. If the provided model data includes errors, the observation and model errors will be plotted next to the data. The population data maps are generated using the cmasher library, and the colorbar limits can be derived from the data or model values, or automatically set.

Parameters:
pop_datadict

Dictionary that defines the population datasets to be plotted. The keys are the dataset descriptors and must match the column names in the observed data (in any order). The values are the descriptions of those datasets and are used in the plot titles. Note, that unlike for the observed data columns, the ORDER MATTERS for the model data: model_data needs to provide the data in the same order as the pop_data dictionary. Example: {‘age’: ‘Stellar age [Gyr]’, ‘met’: ‘Metallicity’}.

model_datalist of np.arrays of shape (n_bundle,)

List of model data arrays where each array corresponds to a dataset in the pop_data dictionary. The length of the list determines whether errors are to be plotted: If the length matches the number of datasets in the pop_data dictionary, errors are not plotted. If the length is twice the number of population datasets, errors are plotted and error data is expected in every other column. Each array in the list should be a 1D numpy array of shape (n_bundle,), where n_bundle is the number of Voronoi orbit bundles in the model. The order of the arrays must match the order of the datasets in the pop_data dictionary. Example with errors plotted: [age, dage, met, dmet], without errors plotted: [age, met]. Each array has shape (n_bundle,).

flux_normnp.array of shape (n_spatial_bins, n_bundle)

Normalized flux data for the spatial bins. Each column corresponds to an orbit bundle and each row corresponds to a spatial bin. It is normalized such that the sum of fluxes in each spatial bin is equal to 1. This is typically the result of orbit bundle maps calculated from a Voronoi binning process of the phase space.

cbar_limsstr, optional

Determines the limits for the colorbar. Can be ‘data’, ‘model’, or ‘auto’. If ‘data’, the limits are based on the observed data. If ‘model’, the limits are based on the model data. If ‘auto’, the limits adapt for each population dataset. The default is ‘data’.

figtypestr, optional

Determines the file format of the saved figure, by default ‘.png’.

dpiint, optional

The resolution of saved figure, by default 100.

Returns:
matplotlib.figure.Figure

The created figure object containing the population data maps.

Raises:
ValueError

If the number of population datasets does not match the number of model data columns, or if the provided cbar_lims is not one of the expected values. The error message will indicate the issue.

pop_pop_plot(x_posterior, y_posterior, weights=1, *, x_label='Stellar age [Gyr]', y_label='$Z/Z_\\odot$', x_scale='linear', y_scale='linear', n_smooth=100, figtype='.png', dpi=100)

Create a population data vs population data plot with smoothing

Create and save a plot showing the relation of two population datasets (e.g. age vs metallicity, AMR) for a set of stellar bundles, averaged over multiple MCMC chains and draws. The plot includes the probability density distribution in the population data values and a scatter plot with diamonds indicating the average population data values of each orbit bundle. The diamond sizes are proportional to the orbit bundles’ weights. The plot is saved in the specified file format and resolution.

Parameters:
x_posteriorxarray or np.array of shape (n_chain, n_draw, n_bundle)

Posterior distribution of the population dataset plotted on the x axis for the orbit bundles, where n_chain is the number of MCMC chains, n_draw is the number of draws per chain, and n_bundle is the number of orbit bundles.

y_posteriorxarray or np.array of shape (n_chain, n_draw, n_bundle)

Posterior distribution of the population dataset plotted on the y axis for the orbit bundles, with the same shape as x_posterior.

weightsnp.array of shape (n_bundle,) or 1, optional

Weight of each stellar bundle, used to determine the size of the symbols in the scatter plot. If 1, all symbols will have the same size. The default is 1.

x_labelstr, optional

Label for the x axis. The default is ‘Stellar age [Gyr]’ and can be used for an AMR (age vs metallicity) plot.

y_labelstr, optional

Label for the y axis. The default is ‘\(Z/Z_\odot\)’ and can be used for an AMR (age vs metallicity) plot.

x_scalestr, optional

Scale of the x axis, either ‘linear’ or ‘log’, by default ‘linear’.

y_scalestr, optional

Scale of the y axis, either ‘linear’ or ‘log’, by default ‘linear

n_smoothint, optional

Number of points for each orbit bundle to smooth the posterior distributions over. If n_smooth is greater than the number of available points, it will be set to the number of available points. The default is 100.

figtypestr, optional

Determines the file format of the saved figure, by default ‘.png’.

dpiint, optional

The resolution of saved figure, by default 100.

Returns:
matplotlib.figure.Figure

The created figure object.

Raises:
ValueError

If the shapes of x_posterior and y_posterior do not match, if the length of weight does not match the number of bundles in the posterior distributions, or if x_scale or y_scale are invalid. The error message will indicate the issue.

Inheritance Diagram

Inheritance diagram of coloring