class documentation

An interactive Plotly heatmap.

Unfortunately, the Plotly team has not gotten around to adding native selection utilities to plot types such as heatmaps: https://github.com/plotly/plotly.js/issues/170.

In lieu of this feature, we provide a homebrewed heatmap that supports two types of interactivity:

  • Individual cells can be selected by clicking on them
  • Groups of cells can be lasso- or box-selected by including their cell centers in a selection

The following events will cause the selection to be cleared:

  • Clicking any cell, if there are currently multiple cells selected
  • Clicking the selected cell, if there is only one cell selected

When heatmap contents are selected via InteractiveHeatmap.select_ids, the heatmap is updated to reflect the proportions of each cell included in the selection.

Parameters
Za num_cols x num_rows array-like of heatmap values
idsan array-like of same shape as Z whose elements contain lists of IDs for the heatmap cells
xlabelsa num_rows array of x labels
ylabelsa num_cols array of y labels
zlima [zmin, zmax] limit to use for the colorbar
values_titlethe semantic meaning of the heatmap values. Used for tooltips
gt_fieldthe name of the ground truth field, if known. Used for tooltips
pred_fieldthe name of the predictions field, if known. Used for tooltips
colorscalea plotly colorscale to use
grid_opacityan opacity value for the grid points
bg_opacityan opacity value for background (unselected) cells
**kwargskeyword arguments for the fiftyone.core.plots.base.InteractivePlot constructor
Method __init__ Undocumented
Instance Variable bg_opacity Undocumented
Instance Variable colorscale Undocumented
Instance Variable grid_opacity Undocumented
Instance Variable gt_field Undocumented
Instance Variable ids Undocumented
Instance Variable pred_field Undocumented
Instance Variable values_title Undocumented
Instance Variable xlabels Undocumented
Instance Variable ylabels Undocumented
Instance Variable Z Undocumented
Instance Variable zlim Undocumented
Property init_view A fiftyone.core.collections.SampleCollection defining the initial view from which to derive selection views when points are selected in the plot.
Property supports_session_updates Whether this plot supports automatic updates in response to session changes.
Method _connect Undocumented
Method _deselect Undocumented
Method _disconnect Undocumented
Method _init_cells_map Undocumented
Method _make_heatmap Undocumented
Method _make_widget Undocumented
Method _on_click Undocumented
Method _on_selection Undocumented
Method _reopen Undocumented
Method _select_cells Undocumented
Method _select_ids Undocumented
Method _update_heatmap Undocumented
Instance Variable _bgw Undocumented
Instance Variable _cells_map Undocumented
Instance Variable _curr_ids Undocumented
Instance Variable _curr_view Undocumented
Instance Variable _curr_Z Undocumented
Instance Variable _curr_zlim Undocumented
Instance Variable _figure Undocumented
Instance Variable _gridw Undocumented
Instance Variable _selected_cells Undocumented
Instance Variable _selectedw Undocumented
Instance Variable _widget Undocumented
Property _selected_ids Undocumented

Inherited from PlotlyInteractivePlot:

Method show Shows the plot.
Method update_layout Updates the layout of the plot.

Inherited from PlotlyWidgetMixin (via PlotlyInteractivePlot):

Method save Saves the plot as an image or HTML.
Method _freeze Undocumented
Method _screenshot Undocumented
Method _show Undocumented
Method _update_layout Undocumented
Instance Variable _handle Undocumented

Inherited from InteractivePlot (via PlotlyInteractivePlot, PlotlyWidgetMixin):

Static Method recommend_link_type Recommends a link type for the given info.
Method register_disconnect_callback Registers a callback that can disconnect this plot from a SessionPlot connected to it.
Method register_selection_callback Registers a selection callback for this plot.
Method register_sync_callback Registers a callback that can sync this plot with a SessionPlot connected to it.
Method reset Resets the plot to its default state.
Method select_ids Selects the points with the given IDs in this plot.
Method selection_mode.setter Undocumented
Instance Variable label_fields Undocumented
Property selected_ids A list of IDs of the currently selected points.
Property selection_mode The current selection mode of the plot.
Method _register_disconnect_callback Undocumented
Method _register_selection_callback Undocumented
Method _register_sync_callback Undocumented
Instance Variable _disconnect_callback Undocumented
Instance Variable _init_fcn Undocumented
Instance Variable _init_fcn_view Undocumented
Instance Variable _init_view Undocumented
Instance Variable _selection_callback Undocumented
Instance Variable _selection_mode Undocumented
Instance Variable _sync_callback Undocumented

Inherited from ResponsivePlot (via PlotlyInteractivePlot, PlotlyWidgetMixin, InteractivePlot):

Method connect Connects this plot, if necessary.
Method disconnect Disconnects the plot, if necessary.
Method freeze Freezes the plot, replacing it with a static image.
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.
Instance Variable _connected Undocumented
Instance Variable _disconnected Undocumented
Instance Variable _frozen Undocumented
Instance Variable _link_type Undocumented

Inherited from Plot (via PlotlyInteractivePlot, PlotlyWidgetMixin, InteractivePlot, ResponsivePlot):

Method _repr_pretty_ Undocumented
def __init__(self, Z, ids, xlabels=None, ylabels=None, zlim=None, values_title='count', gt_field=None, pred_field=None, colorscale=None, grid_opacity=0.1, bg_opacity=0.25, **kwargs): (source)
bg_opacity: 0.25 = (source)

Undocumented

colorscale: None = (source)

Undocumented

grid_opacity: 0.1 = (source)

Undocumented

gt_field: None = (source)

Undocumented

Undocumented

pred_field: None = (source)

Undocumented

values_title: "count" = (source)

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

A 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
supports_session_updates = (source)

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

def _deselect(self): (source)

Undocumented

def _init_cells_map(self): (source)

Undocumented

def _make_heatmap(self): (source)

Undocumented

def _make_widget(self): (source)

Undocumented

def _on_click(self, point_inds): (source)

Undocumented

def _on_selection(self, point_inds): (source)

Undocumented

def _select_cells(self, cells): (source)

Undocumented

def _select_ids(self, ids, view=None): (source)
def _update_heatmap(self, cells, Z_active, Z_bg, zlim): (source)

Undocumented

Undocumented

_cells_map: dict = (source)

Undocumented

_curr_ids = (source)

Undocumented

_curr_view = (source)

Undocumented

Undocumented

_curr_zlim = (source)

Undocumented

Undocumented

Undocumented

_selected_cells = (source)

Undocumented

_selectedw = (source)

Undocumented