<!-- # hard line break macro for HTML -->

# fiftyone.core.plots.matplotlib

Matplotlib plots.

Copyright 2017-2026, Voxel51, Inc.
<br/>
[voxel51.com](https://voxel51.com/)
<br/>
<br/>

**Functions:**

| [`plot_confusion_matrix`](#fiftyone.core.plots.matplotlib.plot_confusion_matrix)(confusion_matrix, labels)   | Plots a confusion matrix.                                                                                                 |
|--------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------|
| [`plot_regressions`](#fiftyone.core.plots.matplotlib.plot_regressions)(ytrue, ypred[, samples, ...])         | Plots the given regression results.                                                                                       |
| [`plot_pr_curve`](#fiftyone.core.plots.matplotlib.plot_pr_curve)(precision, recall[, label, ...])            | Plots a precision-recall (PR) curve.                                                                                      |
| [`plot_pr_curves`](#fiftyone.core.plots.matplotlib.plot_pr_curves)(precisions, recall, classes)              | Plots a set of per-class precision-recall (PR) curves.                                                                    |
| [`plot_roc_curve`](#fiftyone.core.plots.matplotlib.plot_roc_curve)(fpr, tpr[, roc_auc, title, ...])          | Plots a receiver operating characteristic (ROC) curve.                                                                    |
| [`lines`](#fiftyone.core.plots.matplotlib.lines)([x, y, samples, ids, link_field, ...])                      | Plots the given lines(s) data.                                                                                            |
| [`scatterplot`](#fiftyone.core.plots.matplotlib.scatterplot)(points[, samples, ids, ...])                    | Generates an interactive scatterplot of the given points.                                                                 |
| [`location_scatterplot`](#fiftyone.core.plots.matplotlib.location_scatterplot)([locations, samples, ...])    | Generates an interactive scatterplot of the given location coordinates with a map rendered in the background of the plot. |

**Classes:**

| [`InteractiveMatplotlibPlot`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot)(figure, \*\*kwargs)   | Base class for interactive matplotlib plots.     |
|----------------------------------------------------------------------------------------------------------------|--------------------------------------------------|
| [`InteractiveCollection`](#fiftyone.core.plots.matplotlib.InteractiveCollection)(collection[, ids, ...])       | Interactive wrapper for a matplotlib collection. |

### fiftyone.core.plots.matplotlib.plot_confusion_matrix(confusion_matrix, labels, show_values=True, show_colorbar=True, cmap=None, title=None, xticks_rotation=45.0, values_format=None, ax=None, figsize=None)

Plots a confusion matrix.

* **Parameters:**
  * **confusion_matrix** – a `num_true x num_preds` confusion matrix
  * **labels** – a `max(num_true, num_preds)` array-like of class labels
  * **show_values** (*True*) – whether to show counts in the confusion matrix
    cells
  * **show_colorbar** (*True*) – whether to show a colorbar
  * **cmap** (*None*) – a colormap recognized by `matplotlib`
  * **title** (*None*) – a title for the plot
  * **xticks_rotation** (*45.0*) – a rotation for the x-tick labels. Can be
    numeric degrees, “vertical”, “horizontal”, or None
  * **values_format** (*None*) – a format string like `".2g"` or `"d"` to use
    to format the cell counts
  * **ax** (*None*) – a matplotlib axis to plot in
  * **figsize** (*None*) – a `(width, height)` for the figure, in inches
* **Returns:**
  a matplotlib figure

### fiftyone.core.plots.matplotlib.plot_regressions(ytrue, ypred, samples=None, ids=None, labels=None, sizes=None, classes=None, gt_field=None, pred_field=None, best_fit_label=None, marker_size=None, cmap=None, title=None, ax=None, figsize=None, style=None, \*\*kwargs)

Plots the given regression results.

* **Parameters:**
  * **ytrue** – an array-like of ground truth values
  * **ypred** – an array-like of predicted values
  * **samples** (*None*) – the [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection)
    whose data is being visualized
  * **ids** (*None*) – an array-like of sample or frame IDs corresponding to the
    regressions. If not provided but `samples` are provided, the
    appropriate IDs will be extracted from the samples
  * **labels** (*None*) – 

    data to use to color the points. Can be any of the
    following:
    - the name of a sample field or `embedded.field.name` of
      `samples` from which to extract numeric or string values
    - a [`fiftyone.core.expressions.ViewExpression`](fiftyone.core.expressions.md#fiftyone.core.expressions.ViewExpression) defining
      numeric or string values to compute from `samples` via
      [`fiftyone.core.collections.SampleCollection.values()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.values)
    - an array-like of numeric or string values
    - a list of array-lies of numeric or string values, if
      `link_field` refers to frames
  * **sizes** (*None*) – 

    data to use to scale the sizes of the points. Can be any
    of the following:
    - the name of a sample field or `embedded.field.name` of
      `samples` from which to extract numeric values
    - a [`fiftyone.core.expressions.ViewExpression`](fiftyone.core.expressions.md#fiftyone.core.expressions.ViewExpression) defining
      numeric values to compute from `samples` via
      [`fiftyone.core.collections.SampleCollection.values()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.values)
    - an array-like of numeric values
    - a list of array-likes of numeric or string values, if
      `link_field` refers to frames
  * **classes** (*None*) – a list of classes whose points to plot. Only applicable
    when `labels` contains strings
  * **gt_field** (*None*) – the name of the ground truth field
  * **pred_field** (*None*) – the name of the predictions field
  * **best_fit_label** (*None*) – a custom legend label for the best fit line
  * **marker_size** (*None*) – the marker size to use. If `sizes` are provided,
    this value is used as a reference to scale the sizes of all points
  * **cmap** (*None*) – a colormap recognized by `matplotlib`
  * **title** (*None*) – a title for the plot
  * **ax** (*None*) – a matplotlib axis to plot in
  * **figsize** (*None*) – a `(width, height)` for the figure, in inches
  * **style** (*None*) – a style to use for the plot
  * **\*\*kwargs** – optional keyword arguments for matplotlib’s `scatter()`
* **Returns:**
  a matplotlib figure

### fiftyone.core.plots.matplotlib.plot_pr_curve(precision, recall, label=None, title=None, ax=None, figsize=None, style=None, \*\*kwargs)

Plots a precision-recall (PR) curve.

* **Parameters:**
  * **precision** – an array-like of precision values
  * **recall** – an array-like of recall values
  * **label** (*None*) – a label for the curve
  * **title** (*None*) – a title for the plot
  * **ax** (*None*) – a matplotlib axis to plot in
  * **figsize** (*None*) – a `(width, height)` for the figure, in inches
  * **style** (*None*) – a style to use for the plot
  * **\*\*kwargs** – optional keyword arguments for matplotlib’s `plot()`
* **Returns:**
  a matplotlib figure

### fiftyone.core.plots.matplotlib.plot_pr_curves(precisions, recall, classes, title=None, ax=None, figsize=None, style=None, \*\*kwargs)

Plots a set of per-class precision-recall (PR) curves.

* **Parameters:**
  * **precisions** – a `num_classes x num_recalls` array-like of per-class
    precision values
  * **recall** – an array-like of recall values
  * **classes** – the list of classes
  * **title** (*None*) – a title for the plot
  * **ax** (*None*) – a matplotlib axis to plot in
  * **figsize** (*None*) – a `(width, height)` for the figure, in inches
  * **style** (*None*) – a style to use for the plot
  * **\*\*kwargs** – optional keyword arguments for matplotlib’s `plot()`
* **Returns:**
  a matplotlib figure

### fiftyone.core.plots.matplotlib.plot_roc_curve(fpr, tpr, roc_auc=None, title=None, ax=None, figsize=None, style=None, \*\*kwargs)

Plots a receiver operating characteristic (ROC) curve.

* **Parameters:**
  * **fpr** – an array-like of false positive rates
  * **tpr** – an array-like of true positive rates
  * **roc_auc** (*None*) – the area under the ROC curve
  * **title** (*None*) – a title for the plot
  * **ax** (*None*) – a matplotlib axis to plot in
  * **figsize** (*None*) – a `(width, height)` for the figure, in inches
  * **style** (*None*) – a style to use for the plot
  * **\*\*kwargs** – optional keyword arguments for matplotlib’s `plot()`
* **Returns:**
  a matplotlib figure

### fiftyone.core.plots.matplotlib.lines(x=None, y=None, samples=None, ids=None, link_field=None, sizes=None, labels=None, colors=None, marker_size=None, title=None, xlabel=None, ylabel=None, ax=None, ax_equal=False, figsize=None, style=None, buttons=None, \*\*kwargs)

Plots the given lines(s) data.

You can attach plots generated by this method to an App session via its
[`fiftyone.core.session.Session.plots`](fiftyone.core.session.md#fiftyone.core.session.Session.plots) attribute, which will
automatically sync the session’s view with the currently selected points in
the plot. To enable this functionality, you must pass `samples` to this
method.

You can use the `sizes` parameter to scale the sizes of the points.

* **Parameters:**
  * **x** (*None*) – 

    the x data to plot. Can be any of the following:
    - an array-like of values
    - a `num_lines x n` array-like or list of length `num_lines`
      of array-likes of values for multiple line traces
    - the name of a sample field or `embedded.field.name` of
      `samples` from which to extract values for a single line
    - the name of a frame field or `frames.embedded.field.name` of
      `samples` from which to extract values for per-sample line
      traces
    - a [`fiftyone.core.expressions.ViewExpression`](fiftyone.core.expressions.md#fiftyone.core.expressions.ViewExpression) that
      resolves to a list (one line plot) or list of lists (multiple
      line plots) of numeric values to compute from `samples` via
      [`fiftyone.core.collections.SampleCollection.values()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.values)
  * **y** (*None*) – 

    the y data to plot. Can be any of the following:
    - an array-like of values
    - a `num_lines x n` array-like or list of length `num_lines`
      of array-likes of values for multiple line traces
    - the name of a sample field or `embedded.field.name` of
      `samples` from which to extract values for a single line
    - the name of a frame field or `frames.embedded.field.name` of
      `samples` from which to extract values for per-sample line
      traces
    - a [`fiftyone.core.expressions.ViewExpression`](fiftyone.core.expressions.md#fiftyone.core.expressions.ViewExpression) that
      resolves to a list (one line plot) or list of lists (multiple
      line plots) of numeric values to compute from `samples` via
      [`fiftyone.core.collections.SampleCollection.values()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.values)
  * **samples** (*None*) – the [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection)
    whose data is being visualized
  * **ids** (*None*) – an array-like of IDs of same shape as `y`. If not
    provided but `samples` are provided, the appropriate IDs will be
    extracted from the samples
  * **link_field** (*None*) – 

    a field of `samples` whose data corresponds to
    `y`. Can be any of the following:
    - `None`, if the line data correspond to samples (single trace)
      or frames (multiple traces)
    - `"frames"`, if the line data correspond to frames (multiple
      traces). This option exists only for consistency with other
      plotting methods; in practice, it will be automatically
      inferred whenever multiple traces are being plotted
    - the name of a [`fiftyone.core.labels.Label`](fiftyone.core.labels.md#fiftyone.core.labels.Label) field, if the
      line data correspond to the labels in this field
  * **sizes** (*None*) – 

    data to use to scale the sizes of the points. Can be any
    of the following:
    - an array-like of numeric values of same shape as `y`
    - the name of a sample field (single trace) or frame field
      (multiple traces) from which to extract numeric values
    - a [`fiftyone.core.expressions.ViewExpression`](fiftyone.core.expressions.md#fiftyone.core.expressions.ViewExpression) defining
      sample-level (single trace) or frame-level (multiple traces)
      numeric values to compute from `samples` via
      [`fiftyone.core.collections.SampleCollection.values()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.values)
  * **labels** (*None*) – a label or list of labels for the line traces
  * **colors** (*None*) – a list of colors recognized by `matplotlib` to use for
    the line traces. See
    [https://matplotlib.org/stable/tutorials/colors/colormaps.html](https://matplotlib.org/stable/tutorials/colors/colormaps.html) for
    more information
  * **marker_size** (*None*) – the marker size to use. If `sizes` are provided,
    this value is used as a reference to scale the sizes of all points
  * **title** (*None*) – a title for the plot
  * **xlabel** (*None*) – an x-axis label
  * **ylabel** (*None*) – a y-axis label
  * **ax** (*None*) – a matplotlib axis to plot in
  * **ax_equal** (*False*) – whether to set `axis("equal")`
  * **figsize** (*None*) – a `(width, height)` for the figure, in inches
  * **style** (*None*) – a style to use for the plot
  * **buttons** (*None*) – a list of `(label, icon_image, callback)` tuples
    defining buttons to add to the plot
  * **\*\*kwargs** – optional keyword arguments for matplotlib’s `plot()` and
    `scatter()`
* **Returns:**
  one of the following
  - an [`InteractiveCollection`](#fiftyone.core.plots.matplotlib.InteractiveCollection), when IDs are available
  - a matplotlib figure, otherwise

### fiftyone.core.plots.matplotlib.scatterplot(points, samples=None, ids=None, link_field=None, labels=None, sizes=None, classes=None, marker_size=None, cmap=None, title=None, ax=None, ax_equal=False, figsize=None, style=None, buttons=None, \*\*kwargs)

Generates an interactive scatterplot of the given points.

You can attach plots generated by this method to an App session via its
[`fiftyone.core.session.Session.plots`](fiftyone.core.session.md#fiftyone.core.session.Session.plots) attribute, which will
automatically sync the session’s view with the currently selected points in
the plot. To enable this functionality, you must pass `samples` to this
method.

This method supports 2D or 3D visualizations, but interactive point
selection is only available in 2D.

You can use the `labels` parameters to define a coloring for the points,
and you can use the `sizes` parameter to scale the sizes of the points.

* **Parameters:**
  * **points** – a `num_points x num_dims` array-like of points
  * **samples** (*None*) – the [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection)
    whose data is being visualized
  * **ids** (*None*) – an array-like of IDs corresponding to the points. If not
    provided but `samples` are provided, the appropriate IDs will be
    extracted from the samples
  * **link_field** (*None*) – 

    a field of `samples` whose data corresponds to
    `points`. Can be any of the following:
    - None, if the points correspond to samples
    - `"frames"`, if the points correspond to frames
    - the name of a [`fiftyone.core.labels.Label`](fiftyone.core.labels.md#fiftyone.core.labels.Label) field, if the
      points correspond to the labels in this field
  * **labels** (*None*) – 

    data to use to color the points. Can be any of the
    following:
    - the name of a sample field or `embedded.field.name` of
      `samples` from which to extract numeric or string values
    - a [`fiftyone.core.expressions.ViewExpression`](fiftyone.core.expressions.md#fiftyone.core.expressions.ViewExpression) defining
      numeric or string values to compute from `samples` via
      [`fiftyone.core.collections.SampleCollection.values()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.values)
    - an array-like of numeric or string values
    - a list of array-likes of numeric or string values, if
      `link_field` refers to frames and/or a label list field like
      [`fiftyone.core.labels.Detections`](fiftyone.core.labels.md#fiftyone.core.labels.Detections)
  * **sizes** (*None*) – 

    data to use to scale the sizes of the points. Can be any
    of the following:
    - the name of a sample field or `embedded.field.name` of
      `samples` from which to extract numeric values
    - a [`fiftyone.core.expressions.ViewExpression`](fiftyone.core.expressions.md#fiftyone.core.expressions.ViewExpression) defining
      numeric values to compute from `samples` via
      [`fiftyone.core.collections.SampleCollection.values()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.values)
    - an array-like of numeric values
    - a list of array-likes of numeric or string values, if
      `link_field` refers to frames and/or a label list field like
      [`fiftyone.core.labels.Detections`](fiftyone.core.labels.md#fiftyone.core.labels.Detections)
  * **classes** (*None*) – a list of classes whose points to plot. Only applicable
    when `labels` contains strings
  * **marker_size** (*None*) – the marker size to use. If `sizes` are provided,
    this value is used as a reference to scale the sizes of all points
  * **cmap** (*None*) – a colormap recognized by `matplotlib`
  * **title** (*None*) – a title for the plot
  * **ax** (*None*) – a matplotlib axis to plot in
  * **ax_equal** (*False*) – whether to set `axis("equal")`
  * **figsize** (*None*) – a `(width, height)` for the figure, in inches
  * **style** (*None*) – a style to use for the plot
  * **buttons** (*None*) – a list of `(label, icon_image, callback)` tuples
    defining buttons to add to the plot
  * **\*\*kwargs** – optional keyword arguments for matplotlib’s `scatter()`
* **Returns:**
  one of the following
  - an [`InteractiveCollection`](#fiftyone.core.plots.matplotlib.InteractiveCollection), for 2D points and when IDs are
    available
  - a matplotlib figure, otherwise

### fiftyone.core.plots.matplotlib.location_scatterplot(locations=None, samples=None, ids=None, labels=None, sizes=None, classes=None, map_type='satellite', show_scale_bar=False, api_key=None, marker_size=None, cmap=None, title=None, ax=None, ax_equal=False, figsize=None, style=None, buttons=None, \*\*kwargs)

Generates an interactive scatterplot of the given location coordinates
with a map rendered in the background of the plot.

Location data is specified via the `locations` parameter.

You can attach plots generated by this method to an App session via its
[`fiftyone.core.session.Session.plots`](fiftyone.core.session.md#fiftyone.core.session.Session.plots) attribute, which will
automatically sync the session’s view with the currently selected points in
the plot. To enable this functionality, you must pass `samples` to this
method.

You can use the `labels` parameters to define a coloring for the points,
and you can use the `sizes` parameter to scale the sizes of the points.

* **Parameters:**
  * **locations** (*None*) – 

    the location data to plot. Can be any of the
    following:
    - None, in which case `samples` must have a single
      [`fiftyone.core.labels.GeoLocation`](fiftyone.core.labels.md#fiftyone.core.labels.GeoLocation) field whose `point`
      attribute contains location data
    - a `num_locations x 2` array-like of `(longitude, latitude)`
      coordinates
    - the name of a [`fiftyone.core.labels.GeoLocation`](fiftyone.core.labels.md#fiftyone.core.labels.GeoLocation) field
      of `samples` with `(longitude, latitude)` coordinates in
      its `point` attribute
  * **samples** (*None*) – the [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection)
    whose data is being visualized
  * **ids** (*None*) – an array-like of IDs corresponding to the locations. If not
    provided but `samples` are provided, the appropriate IDs will be
    extracted from the samples
  * **labels** (*None*) – 

    data to use to color the points. Can be any of the
    following:
    - the name of a sample field or `embedded.field.name` of
      `samples` from which to extract numeric or string values
    - a [`fiftyone.core.expressions.ViewExpression`](fiftyone.core.expressions.md#fiftyone.core.expressions.ViewExpression) defining
      numeric or string values to compute from `samples` via
      [`fiftyone.core.collections.SampleCollection.values()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.values)
    - an array-like of numeric or string values
  * **sizes** (*None*) – 

    data to use to scale the sizes of the points. Can be any
    of the following:
    - the name of a sample field or `embedded.field.name` of
      `samples` from which to extract numeric values
    - a [`fiftyone.core.expressions.ViewExpression`](fiftyone.core.expressions.md#fiftyone.core.expressions.ViewExpression) defining
      numeric values to compute from `samples` via
      [`fiftyone.core.collections.SampleCollection.values()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.values)
    - an array-like of numeric values
  * **classes** (*None*) – a list of classes whose points to plot. Only applicable
    when `labels` contains strings
  * **map_type** ( *"satellite"*) – the map type to render. Supported values are
    `("roadmap", "satellite", "hybrid", "terrain")`
  * **show_scale_bar** (*False*) – whether to render a scale bar on the plot
  * **api_key** (*None*) – a Google Maps API key to use
  * **marker_size** (*None*) – the marker size to use. If `sizes` are provided,
    this value is used as a reference to scale the sizes of all points
  * **cmap** (*None*) – a colormap recognized by `matplotlib`
  * **title** (*None*) – a title for the plot
  * **ax** (*None*) – a matplotlib axis to plot in
  * **ax_equal** (*False*) – whether to set `axis("equal")`
  * **figsize** (*None*) – a `(width, height)` for the figure, in inches
  * **style** (*None*) – a style to use for the plot
  * **buttons** (*None*) – a list of `(label, icon_image, callback)` tuples
    defining buttons to add to the plot
  * **\*\*kwargs** – optional keyword arguments for matplotlib’s `scatter()`
* **Returns:**
  one of the following
  - an [`InteractiveCollection`](#fiftyone.core.plots.matplotlib.InteractiveCollection), if IDs are available
  - a matplotlib figure, otherwise

### *class* fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot(figure, \*\*kwargs)

Bases: [`InteractivePlot`](fiftyone.core.plots.base.md#fiftyone.core.plots.base.InteractivePlot)

Base class for interactive matplotlib plots.

* **Parameters:**
  * **figure** – a `matplotlib.figure.Figure`
  * **\*\*kwargs** – keyword arguments for the
    [`fiftyone.core.plots.base.InteractivePlot`](fiftyone.core.plots.base.md#fiftyone.core.plots.base.InteractivePlot) constructor

**Attributes:**

| [`supports_session_updates`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.supports_session_updates)   | Whether this plot supports automatic updates in response to session changes.                                                                                                                                                   |
|--------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`init_view`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.init_view)                                 | A [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection) defining the initial view from which to derive selection views when points are selected in the plot. |
| [`is_connected`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.is_connected)                           | Whether this plot is currently connected.                                                                                                                                                                                      |
| [`is_disconnected`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.is_disconnected)                     | Whether this plot is currently disconnected.                                                                                                                                                                                   |
| [`is_frozen`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.is_frozen)                                 | Whether this plot is currently frozen.                                                                                                                                                                                         |
| [`link_type`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.link_type)                                 | The link type between this plot and a connected session.                                                                                                                                                                       |
| [`selected_ids`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.selected_ids)                           | A list of IDs of the currently selected points.                                                                                                                                                                                |
| [`selection_mode`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.selection_mode)                       | The current selection mode of the plot.                                                                                                                                                                                        |

**Methods:**

| [`show`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.show)()                                                         | Shows this plot.                                                                         |
|------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
| [`save`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.save)(path[, dpi])                                              | Saves the plot as an image.                                                              |
| [`connect`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.connect)()                                                   | Connects this plot, if necessary.                                                        |
| [`disconnect`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.disconnect)()                                             | Disconnects the plot, if necessary.                                                      |
| [`freeze`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.freeze)()                                                     | Freezes the plot, replacing it with a static image.                                      |
| [`recommend_link_type`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.recommend_link_type)([label_field, samples])     | Recommends a link type for the given info.                                               |
| [`register_disconnect_callback`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.register_disconnect_callback)(callback) | Registers a callback that can disconnect this plot from a `SessionPlot` connected to it. |
| [`register_selection_callback`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.register_selection_callback)(callback)   | Registers a selection callback for this plot.                                            |
| [`register_sync_callback`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.register_sync_callback)(callback)             | Registers a callback that can sync this plot with a `SessionPlot` connected to it.       |
| [`reset`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.reset)()                                                       | Resets the plot to its default state.                                                    |
| [`select_ids`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot.select_ids)(ids[, view])                                  | Selects the points with the given IDs in this plot.                                      |

#### *property* supports_session_updates

Whether this plot supports automatic updates in response to session
changes.

#### show()

Shows this plot.

#### save(path, dpi=None, \*\*kwargs)

Saves the plot as an image.

* **Parameters:**
  * **path** – the path to write the image
  * **dpi** (*None*) – a resolution in dots per inch
  * **\*\*kwargs** – keyword arguments for `matplotlib.pyplot.savefig`

#### connect()

Connects this plot, if necessary.

#### disconnect()

Disconnects the plot, if necessary.

#### freeze()

Freezes the plot, replacing it with a static image.

The plot will also be disconnected.

Only applicable in notebook contexts.

#### *property* init_view

A [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection) defining the
initial view from which to derive selection views when points are
selected in the plot.

This view will also be shown when the plot is in its default state (no
selection).

#### *property* is_connected

Whether this plot is currently connected.

#### *property* is_disconnected

Whether this plot is currently disconnected.

#### *property* is_frozen

Whether this plot is currently frozen.

#### *property* link_type

The link type between this plot and a connected session.

#### *static* recommend_link_type(label_field=None, samples=None)

Recommends a link type for the given info.

* **Parameters:**
  * **label_field** (*None*) – the label field, if any
  * **samples** (*None*) – the
    [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection), if known
* **Returns:**
  a `(link_type, label_fields, selection_mode, init_fcn)` tuple

#### register_disconnect_callback(callback)

Registers a callback that can disconnect this plot from a
`SessionPlot` connected to it.

The typical use case for this function is to serve as the callback for
a `disconnect` button on the plot.

* **Parameters:**
  **callback** – a function with no arguments

#### register_selection_callback(callback)

Registers a selection callback for this plot.

Selection callbacks are functions that take a single argument
containing the list of currently selected IDs.

If a selection callback is registered, this plot should invoke it each
time their selection is updated.

* **Parameters:**
  **callback** – a selection callback

#### register_sync_callback(callback)

Registers a callback that can sync this plot with a
`SessionPlot` connected to it.

The typical use case for this function is to serve as the callback for
a `sync` button on the plot.

* **Parameters:**
  **callback** – a function with no arguments

#### reset()

Resets the plot to its default state.

#### select_ids(ids, view=None)

Selects the points with the given IDs in this plot.

* **Parameters:**
  * **ids** – a list of IDs, or None to reset the plot to its default state
  * **view** (*None*) – the [`fiftyone.core.view.DatasetView`](fiftyone.core.view.md#fiftyone.core.view.DatasetView)
    corresponding to the given IDs, if available

#### *property* selected_ids

A list of IDs of the currently selected points.

An empty list means all points are deselected, and None means default
state (nothing selected or unselected).

If the plot is not connected, returns None.

#### *property* selection_mode

The current selection mode of the plot.

This property controls how the current view is updated in response to
updates from `InteractivePlot` instances that are linked to
labels or frames.

When `link_type` is `"frames"`, the supported values are:

- `"select"`: show video samples with labels only for the selected
  frames
- `"match"`: show unfiltered video samples containing at least one
  selected frame
- `"frames"`: show only the selected frames in a frames view

When `link_type` is `"labels"`, the supported values are:

- `"select"`: show only the selected labels
- `"match"`: show unfiltered samples containing at least one
  selected label
- `"patches"`: show the selected labels in a patches view

#### NOTE
In order to use `"patches"` selection mode, you must have
provided an `init_fcn` when constructing this plot that defines
how to create the base patches view. This usually involves
[`to_patches()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.to_patches)
or
[`to_evaluation_patches()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.to_evaluation_patches)

#### NOTE
In order to use `"frames"` selection mode, you must have
provided an `init_fcn` when constructing this plot that defines
how to create the base frames view. This usually involves
[`to_frames()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.to_frames)

### *class* fiftyone.core.plots.matplotlib.InteractiveCollection(collection, ids=None, buttons=None, alpha_other=0.25, expand_selected=3.0, click_tolerance=0.02, \*\*kwargs)

Bases: [`InteractiveMatplotlibPlot`](#fiftyone.core.plots.matplotlib.InteractiveMatplotlibPlot)

Interactive wrapper for a matplotlib collection.

This class enables collection points to be lasso-ed and click selected.

The currently selected points are given a visually distinctive style, and
you can modify your selection by either clicking on individual points or
drawing a lasso around new points.

When the shift key is pressed, new selections are added to the selected
set, or subtracted if the new selection is a subset of the current
selection.

* **Parameters:**
  * **collection** – a `matplotlib.collections.Collection` to select points
    from
  * **ids** (*None*) – an array-like of IDs corresponding to the points in
    `collection`
  * **buttons** (*None*) – a list of `(label, icon_image, callback)` tuples
    defining buttons to add to the plot
  * **alpha_other** (*0.25*) – a transparency value for unselected points
  * **expand_selected** (*3.0*) – expand the size of selected points by this
    multiple
  * **click_tolerance** (*0.02*) – a click distance tolerance in `[0, 1]` when
    clicking individual points
  * **\*\*kwargs** – keyword arguments for the
    [`fiftyone.core.plots.base.InteractivePlot`](fiftyone.core.plots.base.md#fiftyone.core.plots.base.InteractivePlot) constructor

**Methods:**

| [`connect`](#fiftyone.core.plots.matplotlib.InteractiveCollection.connect)()                                                   | Connects this plot, if necessary.                                                        |
|--------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|
| [`disconnect`](#fiftyone.core.plots.matplotlib.InteractiveCollection.disconnect)()                                             | Disconnects the plot, if necessary.                                                      |
| [`freeze`](#fiftyone.core.plots.matplotlib.InteractiveCollection.freeze)()                                                     | Freezes the plot, replacing it with a static image.                                      |
| [`recommend_link_type`](#fiftyone.core.plots.matplotlib.InteractiveCollection.recommend_link_type)([label_field, samples])     | Recommends a link type for the given info.                                               |
| [`register_disconnect_callback`](#fiftyone.core.plots.matplotlib.InteractiveCollection.register_disconnect_callback)(callback) | Registers a callback that can disconnect this plot from a `SessionPlot` connected to it. |
| [`register_selection_callback`](#fiftyone.core.plots.matplotlib.InteractiveCollection.register_selection_callback)(callback)   | Registers a selection callback for this plot.                                            |
| [`register_sync_callback`](#fiftyone.core.plots.matplotlib.InteractiveCollection.register_sync_callback)(callback)             | Registers a callback that can sync this plot with a `SessionPlot` connected to it.       |
| [`reset`](#fiftyone.core.plots.matplotlib.InteractiveCollection.reset)()                                                       | Resets the plot to its default state.                                                    |
| [`save`](#fiftyone.core.plots.matplotlib.InteractiveCollection.save)(path[, dpi])                                              | Saves the plot as an image.                                                              |
| [`select_ids`](#fiftyone.core.plots.matplotlib.InteractiveCollection.select_ids)(ids[, view])                                  | Selects the points with the given IDs in this plot.                                      |
| [`show`](#fiftyone.core.plots.matplotlib.InteractiveCollection.show)()                                                         | Shows this plot.                                                                         |

**Attributes:**

| [`init_view`](#fiftyone.core.plots.matplotlib.InteractiveCollection.init_view)                               | A [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection) defining the initial view from which to derive selection views when points are selected in the plot.   |
|--------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [`is_connected`](#fiftyone.core.plots.matplotlib.InteractiveCollection.is_connected)                         | Whether this plot is currently connected.                                                                                                                                                                                        |
| [`is_disconnected`](#fiftyone.core.plots.matplotlib.InteractiveCollection.is_disconnected)                   | Whether this plot is currently disconnected.                                                                                                                                                                                     |
| [`is_frozen`](#fiftyone.core.plots.matplotlib.InteractiveCollection.is_frozen)                               | Whether this plot is currently frozen.                                                                                                                                                                                           |
| [`link_type`](#fiftyone.core.plots.matplotlib.InteractiveCollection.link_type)                               | The link type between this plot and a connected session.                                                                                                                                                                         |
| [`selected_ids`](#fiftyone.core.plots.matplotlib.InteractiveCollection.selected_ids)                         | A list of IDs of the currently selected points.                                                                                                                                                                                  |
| [`selection_mode`](#fiftyone.core.plots.matplotlib.InteractiveCollection.selection_mode)                     | The current selection mode of the plot.                                                                                                                                                                                          |
| [`supports_session_updates`](#fiftyone.core.plots.matplotlib.InteractiveCollection.supports_session_updates) | Whether this plot supports automatic updates in response to session changes.                                                                                                                                                     |

#### connect()

Connects this plot, if necessary.

#### disconnect()

Disconnects the plot, if necessary.

#### freeze()

Freezes the plot, replacing it with a static image.

The plot will also be disconnected.

Only applicable in notebook contexts.

#### *property* init_view

A [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection) defining the
initial view from which to derive selection views when points are
selected in the plot.

This view will also be shown when the plot is in its default state (no
selection).

#### *property* is_connected

Whether this plot is currently connected.

#### *property* is_disconnected

Whether this plot is currently disconnected.

#### *property* is_frozen

Whether this plot is currently frozen.

#### *property* link_type

The link type between this plot and a connected session.

#### *static* recommend_link_type(label_field=None, samples=None)

Recommends a link type for the given info.

* **Parameters:**
  * **label_field** (*None*) – the label field, if any
  * **samples** (*None*) – the
    [`fiftyone.core.collections.SampleCollection`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection), if known
* **Returns:**
  a `(link_type, label_fields, selection_mode, init_fcn)` tuple

#### register_disconnect_callback(callback)

Registers a callback that can disconnect this plot from a
`SessionPlot` connected to it.

The typical use case for this function is to serve as the callback for
a `disconnect` button on the plot.

* **Parameters:**
  **callback** – a function with no arguments

#### register_selection_callback(callback)

Registers a selection callback for this plot.

Selection callbacks are functions that take a single argument
containing the list of currently selected IDs.

If a selection callback is registered, this plot should invoke it each
time their selection is updated.

* **Parameters:**
  **callback** – a selection callback

#### register_sync_callback(callback)

Registers a callback that can sync this plot with a
`SessionPlot` connected to it.

The typical use case for this function is to serve as the callback for
a `sync` button on the plot.

* **Parameters:**
  **callback** – a function with no arguments

#### reset()

Resets the plot to its default state.

#### save(path, dpi=None, \*\*kwargs)

Saves the plot as an image.

* **Parameters:**
  * **path** – the path to write the image
  * **dpi** (*None*) – a resolution in dots per inch
  * **\*\*kwargs** – keyword arguments for `matplotlib.pyplot.savefig`

#### select_ids(ids, view=None)

Selects the points with the given IDs in this plot.

* **Parameters:**
  * **ids** – a list of IDs, or None to reset the plot to its default state
  * **view** (*None*) – the [`fiftyone.core.view.DatasetView`](fiftyone.core.view.md#fiftyone.core.view.DatasetView)
    corresponding to the given IDs, if available

#### *property* selected_ids

A list of IDs of the currently selected points.

An empty list means all points are deselected, and None means default
state (nothing selected or unselected).

If the plot is not connected, returns None.

#### *property* selection_mode

The current selection mode of the plot.

This property controls how the current view is updated in response to
updates from `InteractivePlot` instances that are linked to
labels or frames.

When `link_type` is `"frames"`, the supported values are:

- `"select"`: show video samples with labels only for the selected
  frames
- `"match"`: show unfiltered video samples containing at least one
  selected frame
- `"frames"`: show only the selected frames in a frames view

When `link_type` is `"labels"`, the supported values are:

- `"select"`: show only the selected labels
- `"match"`: show unfiltered samples containing at least one
  selected label
- `"patches"`: show the selected labels in a patches view

#### NOTE
In order to use `"patches"` selection mode, you must have
provided an `init_fcn` when constructing this plot that defines
how to create the base patches view. This usually involves
[`to_patches()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.to_patches)
or
[`to_evaluation_patches()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.to_evaluation_patches)

#### NOTE
In order to use `"frames"` selection mode, you must have
provided an `init_fcn` when constructing this plot that defines
how to create the base frames view. This usually involves
[`to_frames()`](fiftyone.core.collections.md#fiftyone.core.collections.SampleCollection.to_frames)

#### show()

Shows this plot.

#### *property* supports_session_updates

Whether this plot supports automatic updates in response to session
changes.
