Utilities

Plotting

Utilities for plotting.

pyrast.utilities.plotting.plot_isotherm(isotherms, *, withfit=True, xlogscale=False, ylogscale=False, pressures=None, xlim=None, ylim=None)[source]

Plots isotherm data and fit for one or more isotherms.

This function is useful for visualizing the quality of isotherm fits. It is important to visualize your isotherms to ensure that your data adequately covers the pressure range of interest and that your isotherm fits are accurate.

Parameters:
  • isotherms (list or isotherm object) – A single isotherm or list of isotherms to plot.

  • withfit (bool, optional) – Whether to plot the isotherm fit in addition to the data. Default is True.

  • xlogscale (bool, optional) – Whether to use a logarithmic scale for the x-axis. Default is False.

  • ylogscale (bool, optional) – Whether to use a logarithmic scale for the y-axis. Default is False.

  • pressures (array-like, optional) – Array of pressures to plot the isotherm fit over. If not provided, the fit will be plotted over the range of pressures in the isotherm data. Default is None.

  • xlim (tuple, optional) – Tuple of the lower and upper limits for the x-axis. Default is None.

  • ylim (tuple, optional) – Tuple of the lower and upper limits for the y-axis. Default is None.

Returns:

This function displays a plot and does not return anything.

Return type:

None

Raises:

ValueError – If isotherms is not a list or a valid isotherm object.

pyrast.utilities.plotting.plot_p0(isotherms, *, xlogscale=False, ylogscale=False, pressures=None, xlim=None, ylim=None)[source]

Plots p0 vs. spreading pressure for one or more isotherms.

This function is useful for visualizing the p0 vs. spreading pressure relationship of isotherms, which is the inverse of plot_spreading_pressure.

Parameters:
  • isotherms (list or isotherm object) – A single isotherm or list of isotherms to plot p0 for.

  • xlogscale (bool, optional) – Whether to use a logarithmic scale for the x-axis. Default is False.

  • ylogscale (bool, optional) – Whether to use a logarithmic scale for the y-axis. Default is False.

  • pressures (array-like, optional) – Array of pressures to plot p0 over. If not provided, the fit will be plotted over the range of pressures in the isotherm data. Default is None.

  • xlim (tuple, optional) – Tuple of the lower and upper limits for the x-axis. Default is None.

  • ylim (tuple, optional) – Tuple of the lower and upper limits for the y-axis. Default is None.

Returns:

This function displays a plot and does not return anything.

Return type:

None

Raises:

ValueError – If isotherms is not a list or a valid isotherm object.

pyrast.utilities.plotting.plot_spreading_pressure(isotherms, *, xlogscale=False, ylogscale=False, pressures=None, xlim=None, ylim=None)[source]

Plots spreading pressure vs. pressure for one or more isotherms.

This function is useful for visualizing the spreading pressure of isotherms, which is important for IAST and RAST calculations. Spreading pressure should be a continuous and monotonically increasing function of pressure.

Parameters:
  • isotherms (list or isotherm object) – A single isotherm or list of isotherms to plot spreading pressure for.

  • xlogscale (bool, optional) – Whether to use a logarithmic scale for the x-axis. Default is False.

  • ylogscale (bool, optional) – Whether to use a logarithmic scale for the y-axis. Default is False.

  • pressures (array-like, optional) – Array of pressures to plot the spreading pressure integral over. If not provided, the fit will be plotted over the range of pressures in the isotherm data. Default is None.

  • xlim (tuple, optional) – Tuple of the lower and upper limits for the x-axis. Default is None.

  • ylim (tuple, optional) – Tuple of the lower and upper limits for the y-axis. Default is None.

Returns:

This function displays a plot and does not return anything.

Return type:

None

Raises:

ValueError – If isotherms is not a list or a valid isotherm object.