credible.plot

Plotting support for our curves.

Functions

curve_ci(curve, lower, upper[, alpha_multiplier])

Plot the ROC curve with confidence interval bounds.

tight_layout(axis_labels[, title])

Generate a somewhat fancy canvas to draw ROC/DET-style curves.

tight_layout_f1iso(axis_labels[, title])

Generate a somewhat fancy canvas to draw Precision-Recall-style curves.

credible.plot.tight_layout(axis_labels, title=None)[source]

Generate a somewhat fancy canvas to draw ROC/DET-style curves.

Works like a context manager, yielding a figure and an axes set in which the ROC curves should be added to. Once the context is finished, matplotlib.pyplot.tight_layout() is called.

Parameters:
  • axis_labels (tuple[str, str]) – Labels for the x and y axes, in this order.

  • title (str | None) – Optional title to add to this plot.

Yields:
  • A 2-tuple containing the following entries

  • * figure (The figure that should be finally returned to the user)

  • * axes (An axis set where to precision-recall plots should be added to)

Return type:

Generator[tuple[Figure, Axes], None, None]

credible.plot.tight_layout_f1iso(axis_labels, title=None)[source]

Generate a somewhat fancy canvas to draw Precision-Recall-style curves.

Works like a context manager, yielding a figure and an axes set in which the PR curves should be added to. Once the context is finished, matplotlib.pyplot.tight_layout() is called.

The generated figure canvas contains F1-iso lines on the background.

Parameters:
  • axis_labels (tuple[str, str]) – Labels for the x and y axes, in this order.

  • title (str | None) – Optional title to add to this plot.

Yields:
  • A 2-tuple containing the following entries

  • * figure (The figure that should be finally returned to the user)

  • * axes (An axis set where to precision-recall plots should be added to)

Return type:

Generator[tuple[Figure, Axes], None, None]

credible.plot.curve_ci(curve, lower, upper, alpha_multiplier=0.3, **kwargs)[source]

Plot the ROC curve with confidence interval bounds.

This method will call matplotlib to plot the ROC curve for a system which contains a particular set of negatives and positives scores, including its credible/confidence interval bounds. We use the standard matplotlib.pyplot.plot() command. All parameters passed with exception of the three first parameters of this method will be directly passed to the plot command.

Note

This function does not initiate and save the figure instance, it only issues the plotting command. You are the responsible for setting up and saving the figure as you see fit.

Parameters:
Return type:

tuple[Line2D, Polygon]

Returns:

A 2-tuple with the line and fill objects drawing the curve.