Thermo Plotter

Plotting support for KBThermo.

class kbkit.visualization.thermo.ThermoPlotter(thermo: KBThermo, molecule_map: dict[str, str] | None = None)[source]

Bases: object

Plot properties from KBThermo.

Parameters:
  • thermo (KBThermo) – KBThermo object for a set of systems.

  • molecule_map (dict[str, str]) – Dictionary mapping molecule names to desired names for figures.

plot(x: ndarray, y: ndarray, xlabel: str | None = None, ylabel: str | None = None, xlim: tuple | None = None, ylim: tuple | None = None, cmap: str = 'jet', figsize: tuple = (5, 4.5), savepath: str | Path | None = None, show: bool = True, **kwargs) None[source]

Create a plot for a given x and y arrays.

Parameters:
  • x (np.ndarray) – x-values to plot.

  • y (np.ndarray) – y-values to plot.

  • xlabel (str, optional) – Label for x-axis.

  • ylabel (str, optional) – Label for y-axis.

  • xlim (tuple, optional) – Limits for x-axis.

  • ylim (tuple, optional) – Limits for y-axis.

  • cmap (str, optional) – Matplotlib colormap.

  • figsize (tuple, optional) – Size of the figure to display (height, width).

  • savepath (str | Path, optional) – Path to save figure.

  • show (bool, optional) – Display the figure.

plot_property(name: str, units: str | None = None, ylabel: str | None = None, xmol: str | None = None, xlim: tuple | None = None, ylim: tuple | None = None, cmap: str = 'jet', figsize: tuple = (5, 4.5), savepath: str | Path | None = None, show: bool = True, **kwargs) None[source]

Create a plot for a given property name in KBThermo.

Parameters:
  • name (str) – Name of property to plot.

  • units (str, optional) – Units of property.

  • ylabel (str) – Label for y-axis.

  • xmol (str, optional) – Name of molecule to use for x-axis.

  • xlim (tuple, optional) – Limits for x-axis.

  • ylim (tuple, optional) – Limits for y-axis.

  • cmap (str, optional) – Matplotlib colormap.

  • figsize (tuple, optional) – Size of the figure to display (height, width).

  • savepath (str | Path, optional) – Path to save figure.

  • show (bool, optional) – Display the figure.

plot_ternary(x: ndarray, y: ndarray, cbar_label: str | None = None, cmap: str = 'jet', figsize: tuple = (8, 6), savepath: str | Path | None = None, show: bool = False) None[source]

Render a ternary system plot based on the x and y input.

Parameters:
  • x (np.ndarray) – x-values to plot.

  • y (np.ndarray) – y-values to plot.

  • cbar_label (str, optional) – Label for colorbar.

  • cmap (str, optional) – Matplotlib colormap.

  • figsize (tuple, optional) – Size of the figure to display (height, width).

  • savepath (str | Path, optional) – Path to save figure.

  • show (bool, optional) – Display the figure.

plot_property_ternary(name: str, units: str | None = None, cmap: str = 'jet', figsize: tuple = (8, 6), savepath: str | Path | None = None, show: bool = False) None[source]

Render a ternary system plot based on the property name.

Parameters:
  • name (str) – Property to plot.

  • units (str, optional) – Units of property.

  • cbar_label (str, optional) – Label for colorbar.

  • cmap (str, optional) – Matplotlib colormap.

  • figsize (tuple, optional) – Size of the figure to display (height, width).

  • savepath (str | Path, optional) – Path to save figure.

  • show (bool, optional) – Display the figure.

plot_activity_coef_deriv_fits(xlim: tuple | None = None, ylim: tuple | None = None, cmap: str = 'jet', figsize: tuple = (5, 4.5), savepath: str | Path | None = None, show: bool = True, **kwargs) None[source]

Plot the fits to activity coefficient derivatives, for the polynomial integration_type.

Parameters:
  • xlim (tuple, optional) – Limits for x-axis.

  • ylim (tuple, optional) – Limits for y-axis.

  • cmap (str, optional) – Matplotlib colormap.

  • figsize (tuple, optional) – Size of the figure to display (height, width).

  • savepath (str | Path, optional) – Path to save figure.

  • show (bool, optional) – Display the figure.

plot_binary_mixing(xmol, xlim: tuple | None = None, ylim: tuple | None = None, cmap: str = 'jet', figsize: tuple = (5, 4.5), savepath: str | Path | None = None, show: bool = True, **kwargs) None[source]

Plots the contributions to Gibbs mixing free energy for binary mixtures.

Parameters:
  • xmol (str) – Molecule for x-axis.

  • xlim (tuple, optional) – Limits for x-axis.

  • ylim (tuple, optional) – Limits for y-axis.

  • cmap (str, optional) – Matplotlib colormap.

  • figsize (tuple, optional) – Size of the figure to display (height, width).

  • savepath (str | Path, optional) – Path to save figure.

  • show (bool, optional) – Display the figure.

make_figures(savepath: str | Path, xmol: str | None = None, cmap: str = 'jet', **kwargs) None[source]

Create default figures for a binary or ternary system.

Parameters:
  • xmol (str, optional) – Molecule for x-axis.

  • cmap (str, optional) – Matplotlib colormap.

  • savepath (str | Path, optional) – File location to save figure.