clophfit.fitting.plotting ========================= .. py:module:: clophfit.fitting.plotting .. autoapi-nested-parse:: Provide utilities for creating various types of plots used in this project. Primary functions encompassed are: plot_spectra: Develops a plot for spectral data. Each line is colored based on a designated colormap. plot_autovectors: Plots the autovectors. plot_autovalues: Plots the singular values from SVD. plot_fit: Plots residuals for each dataset with uncertainty. plot_pca: Plots the first two principal components. plot_spectra_distributed: Plots spectra from titration distributing on the figure top. plot_emcee: Plots emcee result. plot_emcee_k_on_ax: Plots emcee result for a specific parameter on an axis. distribute_axes: Positions axes evenly along the horizontal axis of the figure. The module uses several dependencies such as ArviZ, numpy, pandas, seaborn, lmfit, matplotlib, and uncertainties. Moreover, it includes a range of internal project modules and a specific color map for PCA components and LM fit. Helper Functions: _apply_common_plot_style: Applies grid style, title, and labels to a plot. _create_spectra_canvas: Creates figure and axes for spectra plot. Classes: PlotParameters: Parameters for plotting, depending on whether the data is pH or Cl. Classes ------- .. autoapisummary:: clophfit.fitting.plotting.PlotParameters Functions --------- .. autoapisummary:: clophfit.fitting.plotting.distribute_axes clophfit.fitting.plotting.plot_autovalues clophfit.fitting.plotting.plot_autovectors clophfit.fitting.plotting.plot_pca clophfit.fitting.plotting.plot_spectra clophfit.fitting.plotting.plot_spectra_distributed clophfit.fitting.plotting.plot_emcee clophfit.fitting.plotting.plot_emcee_k_on_ax clophfit.fitting.plotting.plot_fit clophfit.fitting.plotting.plot_fit_gemini clophfit.fitting.plotting.print_emcee Module Contents --------------- .. py:class:: PlotParameters Parameters for plotting, depending on whether the data is pH or Cl. .. py:function:: distribute_axes(fig, num_axes) Position axes evenly along the horizontal axis of the figure. :param fig: The Figure object on which the Axes objects are drawn. :type fig: Figure :param num_axes: The number of Axes objects to position. :type num_axes: int :returns: A list of positioned Axes objects. :rtype: list[Axes] .. py:function:: plot_autovalues(ax, s) Plot the singular values from SVD. :param ax: The mpl.axes.axes on which to plot the singular values. :type ax: Axes :param s: The singular values from the SVD. :type s: ArrayF .. py:function:: plot_autovectors(ax, wl, u) Plot autovectors. :param ax: The mpl.axes.Axes object to which the plot should be added. :type ax: Axes :param wl: The index of spectra data frame. :type wl: pd.Index[int] :param u: The left singular vectors obtained from SVD. :type u: ArrayF .. py:function:: plot_pca(ax, v, conc, pp) Plot the first two principal components. :param ax: The mpl.axes.Axes object to which the plot should be added. :type ax: Axes :param v: The matrix containing the principal components. :type v: ArrayF :param conc: The concentrations used for the titration. :type conc: ArrayF :param pp: The PlotParameters object containing plot parameters. :type pp: PlotParameters .. py:function:: plot_spectra(ax, spectra, pp) Plot spectra. :param ax: The Mpl.Axes.Axes object to which the plot should be added. :type ax: Axes :param spectra: The DataFrame containing spectral data. :type spectra: pd.DataFrame :param pp: The PlotParameters object containing plot parameters. :type pp: PlotParameters .. py:function:: plot_spectra_distributed(fig, titration, pp, dbands = None) Plot spectra from titration distributing on the top of the figure top. .. py:function:: plot_emcee(flatchain) Plot emcee result. .. py:function:: plot_emcee_k_on_ax(ax, res_emcee, p_name = 'K') Plot emcee result. .. py:function:: plot_fit(ax, ds, params, nboot = 0, pp = None) Plot fitted curves and data points with uncertainty on a given Axes. :param ax: The matplotlib axis to plot on. :type ax: Axes :param ds: The dataset containing the data points. :type ds: Dataset :param params: The fitted parameters from lmfit. :type params: Parameters :param nboot: Number of bootstrap samples to generate confidence bands. :type nboot: int :param pp: Plotting parameters for consistent styling. :type pp: PlotParameters | None .. py:function:: plot_fit_gemini(ax, ds, params, nboot = 0, pp = None) Plot fitted curves and data points on a given axis. :param ax: The matplotlib axis to plot on. :type ax: axes.Axes :param ds: The dataset containing the data points. :type ds: Dataset :param params: The fitted parameters from lmfit. :type params: Parameters :param nboot: Number of bootstrap samples to generate confidence bands. :type nboot: int :param pp: Plotting parameters for consistent styling. :type pp: PlotParameters | None .. py:function:: print_emcee(result_emcee) Print maximum likelihood estimation (MLE) results from an emcee fitting.