pair_plot#

cinnabar.plotting.pair_plot(x: ndarray, y: ndarray, title: str = '', xerr: ndarray | None = None, yerr: ndarray | None = None, method_name: str = '', target_name: str = '', quantity: str = '$\\Delta\\Delta$G', xlabel: str = 'Experimental', ylabel: str = 'Calculated', units: str = '$\\mathrm{kcal\\,mol^{-1}}$', guidelines: bool | tuple[float, float] = True, guideline_colors: tuple[str, str] | None = None, origins: bool = True, color: str | None = None, statistics: list[Literal['RMSE', 'NRMSE', 'MUE', 'RAE', 'R2', 'rho', 'KTAU', 'PI']] | None = None, filename: str | None = None, centralizing: bool = True, shift: float = 0.0, figsize: float = 3.25, dpi: float | str = 300, data_labels: list[str] | None = None, axis_padding: float = 0.5, xy_lim: tuple[float, float] | None = None, font_sizes: dict[str, int] | None = None, bootstrap_x_uncertainty: bool = False, bootstrap_y_uncertainty: bool = False, statistic_type: Literal['mle', 'mean'] = 'mle', scatter_kwargs: dict[str, float | int | str] | None = None)[source]#

Handles the aesthetics of the pair plots in one place.

Parameters:
  • x (np.ndarray) – Values to plot on the x-axis.

  • y (np.ndarray) – Values to plot on the y-axis

  • title (str, default “”) – Title for the plot.

  • xerr (np.ndarray | None , default None) – Error bars for x values if available.

  • yerr (np.ndarray | None , default None) – Error bars for y values if available.

  • method_name (str, default “”) – Name of method associated with results, e.g. “openfe”.

  • target_name (str, default “”) – Name of system for results, e.g. “Thrombin”.

  • quantity (str, default r”$DeltaDelta$G”) – Metric that is being plotted, which will be included in the axis labels.

  • xlabel (str, default “Experimental”) – Main abel for the x-axis.

  • ylabel (str, default “Calculated”) – Main label for the y-axis.

  • units (str, default r”$mathrm{kcal,mol^{-1}}$”) – String value of units to label axis with.

  • guidelines (bool | tuple[float, float], default True) – Controls the shaded guideline bands drawn around the x=y line.

    • True: draw the default two bands at 0.5 and 1.0 kcal/mol.

    • False: no guidelines are drawn.

    • tuple of up to 2 floats: draw a band for each value, e.g. (0.5,) for a single band or (0.5, 1.0) for two bands.

    When calling the high-level plotting functions (plot_DDGs, plot_DGs, plot_all_DDGs) with observable_type="pic50", the default distances are automatically converted to pIC50 units so the bands remain physically meaningful. Pass an explicit guidelines tuple to override this.

  • guideline_colors (tuple[str, str], default None) – Colors for each guideline band, corresponding positionally to each distance in guidelines. If None, or fewer colors than bands are provided, the remaining bands default to "grey". Example: ("blue", "red") colors the inner band blue and the outer band red.

  • origins (bool, default True) – Toggles plotting of x and y-axis.

  • color (str, default None) – The name of the colour scheme for the scatter plots. If None, will be coloured according to distance from unity

  • statistics (list[{‘RMSE’, ‘NRMSE’, ‘MUE’, ‘RAE’, ‘R2’, ‘rho’, ‘KTAU’, ‘PI’}] | None, default None) – List of statistics to calculate and report on the plot, if None “RMSE” and “MUE” will be reported.

  • filename (str | None, default None) – Filename for plot, if not provided the plot will be displayed.

  • centralizing (bool, default True) – Offset the free energies True or report raw values False.

  • shift (float, default 0.) – Shift both the x and y-axis by a constant.

  • figsize (float, default 3.25) – Size of figure for matplotlib.

  • dpi (float | str, default 300) – The resolution in dots per inch if ‘figure’, uses the figure’s dpi value (this behavior is copied from https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.savefig.html)

  • data_labels (list[str] | None, default None) – List of labels for each data point.

  • axis_padding (float, default 0.5) – Padding to add to maximum axis value and subtract from the minimum axis value.

  • xy_lim (tuple[float, float] | None, default None) – Contains the minimum and maximum values to use for the x and y-axis. if specified, axis_padding is ignored.

  • font_sizes (dict[str, int] | None, default None) – Font sizes to use for the title (“title”), the data labels (“labels”), and the rest of the plot (“other”). Defaults to {“title”: 12, “labels”: 9, “other”: 12}

  • bootstrap_x_uncertainty (bool, default False) – Whether to account for uncertainty in x when bootstrapping.

  • bootstrap_y_uncertainty (bool, default False) – Whether to account for uncertainty in y when bootstrapping.

  • statistic_type ({“mle”, “mean”}, default “mle”) – The type of statistic to use, either “mle” (i.e. sample statistic) or “mean” (i.e. bootstrapped mean statistic)

  • scatter_kwargs (dict[str, float | int | str] | None, default None) – Arguments to control plt.scatter(), these will override the default cinnabar settings.

Return type:

plt.Figure

Raises:

ValueError – If more than 2 values are supplied to the guidelines argument.