fiftyone.core.plots#
- fiftyone.core.plots.base
plot_confusion_matrix()
plot_regressions()
plot_pr_curve()
plot_pr_curves()
plot_roc_curve()
lines()
scatterplot()
location_scatterplot()
Plot
ResponsivePlot
ViewPlot
InteractivePlot
InteractivePlot.selection_mode
InteractivePlot.init_view
InteractivePlot.selected_ids
InteractivePlot.recommend_link_type()
InteractivePlot.register_selection_callback()
InteractivePlot.register_sync_callback()
InteractivePlot.register_disconnect_callback()
InteractivePlot.select_ids()
InteractivePlot.connect()
InteractivePlot.disconnect()
InteractivePlot.freeze()
InteractivePlot.is_connected
InteractivePlot.is_disconnected
InteractivePlot.is_frozen
InteractivePlot.link_type
InteractivePlot.save()
InteractivePlot.show()
InteractivePlot.supports_session_updates
InteractivePlot.reset()
- fiftyone.core.plots.manager
PlotManager
PlotManager.summary()
PlotManager.keys()
PlotManager.items()
PlotManager.values()
PlotManager.is_connected
PlotManager.is_disconnected
PlotManager.has_view_links
PlotManager.has_sample_links
PlotManager.has_frame_links
PlotManager.has_label_links
PlotManager.attach()
PlotManager.remove()
PlotManager.clear()
PlotManager.pop()
PlotManager.connect()
PlotManager.disconnect()
PlotManager.sync()
PlotManager.freeze()
- fiftyone.core.plots.matplotlib
plot_confusion_matrix()
plot_regressions()
plot_pr_curve()
plot_pr_curves()
plot_roc_curve()
lines()
scatterplot()
location_scatterplot()
InteractiveMatplotlibPlot
InteractiveMatplotlibPlot.supports_session_updates
InteractiveMatplotlibPlot.show()
InteractiveMatplotlibPlot.save()
InteractiveMatplotlibPlot.connect()
InteractiveMatplotlibPlot.disconnect()
InteractiveMatplotlibPlot.freeze()
InteractiveMatplotlibPlot.init_view
InteractiveMatplotlibPlot.is_connected
InteractiveMatplotlibPlot.is_disconnected
InteractiveMatplotlibPlot.is_frozen
InteractiveMatplotlibPlot.link_type
InteractiveMatplotlibPlot.recommend_link_type()
InteractiveMatplotlibPlot.register_disconnect_callback()
InteractiveMatplotlibPlot.register_selection_callback()
InteractiveMatplotlibPlot.register_sync_callback()
InteractiveMatplotlibPlot.reset()
InteractiveMatplotlibPlot.select_ids()
InteractiveMatplotlibPlot.selected_ids
InteractiveMatplotlibPlot.selection_mode
InteractiveCollection
InteractiveCollection.connect()
InteractiveCollection.disconnect()
InteractiveCollection.freeze()
InteractiveCollection.init_view
InteractiveCollection.is_connected
InteractiveCollection.is_disconnected
InteractiveCollection.is_frozen
InteractiveCollection.link_type
InteractiveCollection.recommend_link_type()
InteractiveCollection.register_disconnect_callback()
InteractiveCollection.register_selection_callback()
InteractiveCollection.register_sync_callback()
InteractiveCollection.reset()
InteractiveCollection.save()
InteractiveCollection.select_ids()
InteractiveCollection.selected_ids
InteractiveCollection.selection_mode
InteractiveCollection.show()
InteractiveCollection.supports_session_updates
- fiftyone.core.plots.plotly
plot_confusion_matrix()
plot_regressions()
plot_pr_curve()
plot_pr_curves()
plot_roc_curve()
lines()
scatterplot()
location_scatterplot()
get_colormap()
PlotlyWidgetMixin
PlotlyNotebookPlot
PlotlyInteractivePlot
PlotlyInteractivePlot.update_layout()
PlotlyInteractivePlot.show()
PlotlyInteractivePlot.connect()
PlotlyInteractivePlot.disconnect()
PlotlyInteractivePlot.freeze()
PlotlyInteractivePlot.init_view
PlotlyInteractivePlot.is_connected
PlotlyInteractivePlot.is_disconnected
PlotlyInteractivePlot.is_frozen
PlotlyInteractivePlot.link_type
PlotlyInteractivePlot.recommend_link_type()
PlotlyInteractivePlot.register_disconnect_callback()
PlotlyInteractivePlot.register_selection_callback()
PlotlyInteractivePlot.register_sync_callback()
PlotlyInteractivePlot.reset()
PlotlyInteractivePlot.save()
PlotlyInteractivePlot.select_ids()
PlotlyInteractivePlot.selected_ids
PlotlyInteractivePlot.selection_mode
PlotlyInteractivePlot.supports_session_updates
InteractiveScatter
InteractiveScatter.supports_session_updates
InteractiveScatter.connect()
InteractiveScatter.disconnect()
InteractiveScatter.freeze()
InteractiveScatter.init_view
InteractiveScatter.is_connected
InteractiveScatter.is_disconnected
InteractiveScatter.is_frozen
InteractiveScatter.link_type
InteractiveScatter.recommend_link_type()
InteractiveScatter.register_disconnect_callback()
InteractiveScatter.register_selection_callback()
InteractiveScatter.register_sync_callback()
InteractiveScatter.reset()
InteractiveScatter.save()
InteractiveScatter.select_ids()
InteractiveScatter.selected_ids
InteractiveScatter.selection_mode
InteractiveScatter.show()
InteractiveScatter.update_layout()
InteractiveHeatmap
InteractiveHeatmap.supports_session_updates
InteractiveHeatmap.init_view
InteractiveHeatmap.connect()
InteractiveHeatmap.disconnect()
InteractiveHeatmap.freeze()
InteractiveHeatmap.is_connected
InteractiveHeatmap.is_disconnected
InteractiveHeatmap.is_frozen
InteractiveHeatmap.link_type
InteractiveHeatmap.recommend_link_type()
InteractiveHeatmap.register_disconnect_callback()
InteractiveHeatmap.register_selection_callback()
InteractiveHeatmap.register_sync_callback()
InteractiveHeatmap.reset()
InteractiveHeatmap.save()
InteractiveHeatmap.select_ids()
InteractiveHeatmap.selected_ids
InteractiveHeatmap.selection_mode
InteractiveHeatmap.show()
InteractiveHeatmap.update_layout()
- fiftyone.core.plots.utils
- fiftyone.core.plots.views
PlotlyViewPlot
PlotlyViewPlot.show()
PlotlyViewPlot.connect()
PlotlyViewPlot.disconnect()
PlotlyViewPlot.freeze()
PlotlyViewPlot.is_connected
PlotlyViewPlot.is_disconnected
PlotlyViewPlot.is_frozen
PlotlyViewPlot.link_type
PlotlyViewPlot.reset()
PlotlyViewPlot.save()
PlotlyViewPlot.supports_session_updates
PlotlyViewPlot.update_view()
ViewGrid
CategoricalHistogram
CategoricalHistogram.connect()
CategoricalHistogram.disconnect()
CategoricalHistogram.freeze()
CategoricalHistogram.is_connected
CategoricalHistogram.is_disconnected
CategoricalHistogram.is_frozen
CategoricalHistogram.link_type
CategoricalHistogram.reset()
CategoricalHistogram.save()
CategoricalHistogram.show()
CategoricalHistogram.supports_session_updates
CategoricalHistogram.update_view()
NumericalHistogram
NumericalHistogram.connect()
NumericalHistogram.disconnect()
NumericalHistogram.freeze()
NumericalHistogram.is_connected
NumericalHistogram.is_disconnected
NumericalHistogram.is_frozen
NumericalHistogram.link_type
NumericalHistogram.reset()
NumericalHistogram.save()
NumericalHistogram.show()
NumericalHistogram.supports_session_updates
NumericalHistogram.update_view()
Module contents#
Plotting framework.
Functions:
|
Plots a confusion matrix. |
|
Plots the given regression results. |
|
Plots a precision-recall (PR) curve. |
|
Plots a set of per-class precision-recall (PR) curves. |
|
Plots a receiver operating characteristic (ROC) curve. |
|
Plots the given lines(s) data. |
|
Generates an interactive scatterplot of the given points. |
|
Generates an interactive scatterplot of the given location coordinates with a map rendered in the background of the plot. |
Classes:
|
Base class for all plots. |
|
Base class for all responsive plots that can push/pull updates to a linked object. |
|
Base class for plots that support selection of their points. |
|
Base class for plots that can be automatically populated given a |
|
Class that manages communication between a |
|
A grid of |
|
A histogram of a categorial field. |
|
A histogram of a numerical field. |
- fiftyone.core.plots.plot_confusion_matrix(confusion_matrix, labels, ids=None, samples=None, eval_key=None, gt_field=None, pred_field=None, backend='plotly', **kwargs)#
Plots a confusion matrix.
If
ids
are provided and you are working in a notebook environment with the default plotly backend, this method returns an interactivefiftyone.core.plots.plotly.InteractiveHeatmap
that you can attach to an App session via itsfiftyone.core.session.Session.plots
attribute, which will automatically sync the sessionβs view with the currently selected cells in the confusion matrix.- Parameters:
confusion_matrix β a
num_true x num_preds
confusion matrixlabels β a
max(num_true, num_preds)
array-like of class labelsids (None) β an array-like of same shape as
confusion_matrix
containing lists of IDs corresponding to each cellsamples (None) β the
fiftyone.core.collections.SampleCollection
for which the confusion matrix was generatedeval_key (None) β the evaluation key of the evaluation
gt_field (None) β the name of the ground truth field
pred_field (None) β the name of the predictions field
backend ("plotly") β the plotting backend to use. Supported values are
("plotly", "matplotlib")
**kwargs β
keyword arguments for the backend plotting method:
βplotlyβ backend:
fiftyone.core.plots.plotly.plot_confusion_matrix()
βmatplotlibβ backend:
fiftyone.core.plots.matplotlib.plot_confusion_matrix()
- Returns:
one of the following
a
fiftyone.core.plots.plotly.InteractiveHeatmap
, if IDs are available and the plotly backend is useda
fiftyone.core.plots.plotly.PlotlyNotebookPlot
, if no IDs are available but you are working in a Jupyter notebook with the plotly backenda plotly or matplotlib figure, otherwise
- fiftyone.core.plots.plot_regressions(ytrue, ypred, samples=None, ids=None, labels=None, sizes=None, classes=None, gt_field=None, pred_field=None, backend='plotly', **kwargs)#
Plots the given regression results.
If IDs are provided and you are working in a notebook environment with the default plotly backend, this method returns an interactive
fiftyone.core.plots.plotly.InteractiveScatter
that you can attach to an App session via itsfiftyone.core.session.Session.plots
attribute, which will automatically sync the sessionβs view with the currently selected points in the plot.- Parameters:
ytrue β an array-like of ground truth values
ypred β an array-like of predicted values
samples (None) β the
fiftyone.core.collections.SampleCollection
for which the results were generated. Only used by the βplotlyβ backend when IDs are providedids (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 sampleslabels (None) β
data to use to color the points. Can be any of the following:
the name of a sample field or
embedded.field.name
ofsamples
from which to extract numeric or string valuesa
fiftyone.core.expressions.ViewExpression
defining numeric or string values to compute fromsamples
viafiftyone.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
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
ofsamples
from which to extract numeric valuesa
fiftyone.core.expressions.ViewExpression
defining numeric values to compute fromsamples
viafiftyone.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 stringsgt_field (None) β the name of the ground truth field
pred_field (None) β the name of the predictions field
backend ("plotly") β the plotting backend to use. Supported values are
("plotly", "matplotlib")
**kwargs β
keyword arguments for the backend plotting method:
βplotlyβ backend:
fiftyone.core.plots.plotly.plot_confusion_matrix()
βmatplotlibβ backend:
fiftyone.core.plots.matplotlib.plot_confusion_matrix()
- Returns:
one of the following
a
fiftyone.core.plots.plotly.InteractiveScatter
, if IDs are available and the plotly backend is useda
fiftyone.core.plots.plotly.PlotlyNotebookPlot
, if no IDs are available but you are working in a Jupyter notebook with the plotly backenda plotly or matplotlib figure, otherwise
- fiftyone.core.plots.plot_pr_curve(precision, recall, thresholds=None, label=None, backend='plotly', **kwargs)#
Plots a precision-recall (PR) curve.
- Parameters:
precision β an array-like of precision values
recall β an array-like of recall values
thresholds (None) β an array-like of decision thresholds
label (None) β a label for the curve
backend ("plotly") β the plotting backend to use. Supported values are
("plotly", "matplotlib")
**kwargs β
keyword arguments for the backend plotting method:
βplotlyβ backend:
fiftyone.core.plots.plotly.plot_pr_curve()
βmatplotlibβ backend:
fiftyone.core.plots.matplotlib.plot_pr_curve()
- Returns:
one of the following
a
fiftyone.core.plots.plotly.PlotlyNotebookPlot
, if you are working in a Jupyter notebook and the plotly backend is useda plotly or matplotlib figure, otherwise
- fiftyone.core.plots.plot_pr_curves(precisions, recall, classes, thresholds=None, backend='plotly', **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 valuesrecall β an array-like of recall values
classes β the list of classes
thresholds (None) β an
num_classes x num_recalls
array-like of decision thresholdsbackend ("plotly") β the plotting backend to use. Supported values are
("plotly", "matplotlib")
**kwargs β
keyword arguments for the backend plotting method:
βplotlyβ backend:
fiftyone.core.plots.plotly.plot_pr_curves()
βmatplotlibβ backend:
fiftyone.core.plots.matplotlib.plot_pr_curves()
- Returns:
one of the following
a
fiftyone.core.plots.plotly.PlotlyNotebookPlot
, if you are working in a Jupyter notebook and the plotly backend is useda plotly or matplotlib figure, otherwise
- fiftyone.core.plots.plot_roc_curve(fpr, tpr, thresholds=None, roc_auc=None, backend='plotly', **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
thresholds (None) β an array-like of decision thresholds
roc_auc (None) β the area under the ROC curve
backend ("plotly") β the plotting backend to use. Supported values are
("plotly", "matplotlib")
**kwargs β
keyword arguments for the backend plotting method:
βplotlyβ backend:
fiftyone.core.plots.plotly.plot_roc_curve()
βmatplotlibβ backend:
fiftyone.core.plots.matplotlib.plot_roc_curve()
- Returns:
one of the following
a
fiftyone.core.plots.plotly.PlotlyNotebookPlot
, if you are working in a Jupyter notebook and the plotly backend is useda plotly or matplotlib figure, otherwise
- fiftyone.core.plots.lines(x=None, y=None, samples=None, ids=None, link_field=None, sizes=None, backend='plotly', **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
attribute, which will automatically sync the sessionβs view with the currently selected points in the plot. To enable this functionality, you must passsamples
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 lengthnum_lines
of array-likes of values for multiple line tracesthe name of a sample field or
embedded.field.name
ofsamples
from which to extract values for a single linethe name of a frame field or
frames.embedded.field.name
ofsamples
from which to extract values for per-sample line tracesa
fiftyone.core.expressions.ViewExpression
that resolves to a list (one line plot) or list of lists (multiple line plots) of numeric values to compute fromsamples
viafiftyone.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 lengthnum_lines
of array-likes of values for multiple line tracesthe name of a sample field or
embedded.field.name
ofsamples
from which to extract values for a single linethe name of a frame field or
frames.embedded.field.name
ofsamples
from which to extract values for per-sample line tracesa
fiftyone.core.expressions.ViewExpression
that resolves to a list (one line plot) or list of lists (multiple line plots) of numeric values to compute fromsamples
viafiftyone.core.collections.SampleCollection.values()
samples (None) β the
fiftyone.core.collections.SampleCollection
whose data is being visualizedids (None) β an array-like of IDs of same shape as
y
. If not provided butsamples
are provided, the appropriate IDs will be extracted from the sampleslink_field (None) β
a field of
samples
whose data corresponds toy
. 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 plottedthe name of a
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
defining sample-level (single trace) or frame-level (multiple traces) numeric values to compute fromsamples
viafiftyone.core.collections.SampleCollection.values()
backend ("plotly") β the plotting backend to use. Supported values are
("plotly", "matplotlib")
**kwargs β
keyword arguments for the backend plotting method:
βplotlyβ backend:
fiftyone.core.plots.plotly.lines()
βmatplotlibβ backend:
fiftyone.core.plots.matplotlib.lines()
- Returns:
one of the following
an
InteractivePlot
, if IDs are availablea
fiftyone.core.plots.plotly.PlotlyNotebookPlot
, if IDs are not available but you are working with the plotly backend in a Jupyter notebooka plotly or matplotlib figure, otherwise
- fiftyone.core.plots.scatterplot(points, samples=None, ids=None, link_field=None, labels=None, sizes=None, classes=None, backend='plotly', **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
attribute, which will automatically sync the sessionβs view with the currently selected points in the plot. To enable this functionality, you must passsamples
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 thesizes
parameter to scale the sizes of the points.- Parameters:
points β a
num_points x num_dims
array-like of pointssamples (None) β the
fiftyone.core.collections.SampleCollection
whose data is being visualizedids (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 sampleslink_field (None) β
a field of
samples
whose data corresponds topoints
. Can be any of the following:None, if the points correspond to samples
"frames"
, if the points correspond to framesthe name of a
fiftyone.core.labels.Label
field, if the points linked 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
ofsamples
from which to extract numeric or string valuesa
fiftyone.core.expressions.ViewExpression
defining numeric or string values to compute fromsamples
viafiftyone.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 a label list field likefiftyone.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
ofsamples
from which to extract numeric valuesa
fiftyone.core.expressions.ViewExpression
defining numeric values to compute fromsamples
viafiftyone.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 a label list field likefiftyone.core.labels.Detections
classes (None) β an list of classes whose points to plot. Only applicable when
labels
contains stringsbackend ("plotly") β the plotting backend to use. Supported values are
("plotly", "matplotlib")
**kwargs β
keyword arguments for the backend plotting method:
βplotlyβ backend:
fiftyone.core.plots.plotly.scatterplot()
βmatplotlibβ backend:
fiftyone.core.plots.matplotlib.scatterplot()
- Returns:
one of the following
an
InteractivePlot
, if IDs are availablea
fiftyone.core.plots.plotly.PlotlyNotebookPlot
, if IDs are not available but you are working with the plotly backend in a Jupyter notebooka plotly or matplotlib figure, otherwise
- fiftyone.core.plots.location_scatterplot(locations=None, samples=None, ids=None, labels=None, sizes=None, classes=None, backend='plotly', **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
attribute, which will automatically sync the sessionβs view with the currently selected points in the plot. To enable this functionality, you must passsamples
to this method.You can use the
labels
parameters to define a coloring for the points, and you can use thesizes
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 singlefiftyone.core.labels.GeoLocation
field whosepoint
attribute contains location dataa
num_locations x 2
array of(longitude, latitude)
coordinatesthe name of a
fiftyone.core.labels.GeoLocation
field ofsamples
with(longitude, latitude)
coordinates in itspoint
attribute
samples (None) β the
fiftyone.core.collections.SampleCollection
whose data is being visualizedids (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 sampleslabels (None) β
data to use to color the points. Can be any of the following:
the name of a sample field or
embedded.field.name
ofsamples
from which to extract numeric or string valuesa
fiftyone.core.expressions.ViewExpression
defining numeric or string values to compute fromsamples
viafiftyone.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
ofsamples
from which to extract numeric valuesa
fiftyone.core.expressions.ViewExpression
defining numeric values to compute fromsamples
viafiftyone.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 stringsbackend ("plotly") β the plotting backend to use. Supported values are
("plotly", "matplotlib")
**kwargs β
keyword arguments for the backend plotting method:
βplotlyβ backend:
fiftyone.core.plots.plotly.location_scatterplot()
βmatplotlibβ backend:
fiftyone.core.plots.matplotlib.location_scatterplot()
- Returns:
one of the following
an
InteractivePlot
, if IDs are availablea
fiftyone.core.plots.plotly.PlotlyNotebookPlot
, if IDs are not available but you are working with the plotly backend in a Jupyter notebooka plotly or matplotlib figure, otherwise
- class fiftyone.core.plots.Plot#
Bases:
object
Base class for all plots.
Attributes:
Whether this plot is currently frozen.
Methods:
show
(**kwargs)Shows the plot.
save
(path,Β **kwargs)Saves the plot.
freeze
()Freezes the plot, replacing it with a static image.
- property is_frozen#
Whether this plot is currently frozen.
- show(**kwargs)#
Shows the plot.
- Parameters:
**kwargs β subclass-specific keyword arguments
- save(path, **kwargs)#
Saves the plot.
- Parameters:
path β the path to write the plot
**kwargs β subclass-specific keyword arguments
- freeze()#
Freezes the plot, replacing it with a static image.
Only applicable in notebook contexts.
- class fiftyone.core.plots.ResponsivePlot(link_type)#
Bases:
Plot
Base class for all responsive plots that can push/pull updates to a linked object.
- Parameters:
link_type β the link type of the plot
Attributes:
The link type between this plot and a connected session.
Whether this plot supports automatic updates in response to session changes.
Whether this plot is currently connected.
Whether this plot is currently disconnected.
Whether this plot is currently frozen.
Methods:
connect
()Connects this plot, if necessary.
show
(**kwargs)Shows the plot.
reset
()Resets the plot to its default state.
freeze
()Freezes the plot, replacing it with a static image.
Disconnects the plot, if necessary.
save
(path,Β **kwargs)Saves the plot.
- property link_type#
The link type between this plot and a connected session.
- property supports_session_updates#
Whether this plot supports automatic updates in response to session changes.
- 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.
- connect()#
Connects this plot, if necessary.
- show(**kwargs)#
Shows the plot.
The plot will be connected if necessary.
- Parameters:
**kwargs β subclass-specific keyword arguments
- reset()#
Resets the plot to its default state.
- freeze()#
Freezes the plot, replacing it with a static image.
The plot will also be disconnected.
Only applicable in notebook contexts.
- disconnect()#
Disconnects the plot, if necessary.
- save(path, **kwargs)#
Saves the plot.
- Parameters:
path β the path to write the plot
**kwargs β subclass-specific keyword arguments
- class fiftyone.core.plots.InteractivePlot(link_type='samples', init_view=None, label_fields=None, selection_mode=None, init_fcn=None)#
Bases:
ResponsivePlot
Base class for plots that support selection of their points.
Whenever a selection is made in an
InteractivePlot
, the plot will invoke any selection callback(s) registered on it, reporting to its listeners the IDs of its selected points.Conversely, the state of an
InteractivePlot
can be updated by external parties by calling itsselect_ids()
method.- Parameters:
link_type ("samples") β whether this plot is linked to
"samples"
,"frames"
, or"labels"
init_view (None) β a
fiftyone.core.collections.SampleCollection
defining an 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)label_fields (None) β a label field or list of label fields to which points in this plot correspond. Only applicable when
link_type == "labels"
selection_mode (None) β the initial selection mode to use when updating connected sessions in response to selections in this plot. See
selection_mode()
for detailsinit_fcn (None) β a function that can be called with
init_view
as its argument that returns afiftyone.core.collections.SampleCollection
defining an initial view from which to derive certain types of selection views. Seeselection_mode()
for details
Attributes:
The current selection mode of the plot.
A
fiftyone.core.collections.SampleCollection
defining the initial view from which to derive selection views when points are selected in the plot.A list of IDs of the currently selected points.
Whether this plot is currently connected.
Whether this plot is currently disconnected.
Whether this plot is currently frozen.
The link type between this plot and a connected session.
Whether this plot supports automatic updates in response to session changes.
Methods:
recommend_link_type
([label_field,Β samples])Recommends a link type for the given info.
register_selection_callback
(callback)Registers a selection callback for this plot.
register_sync_callback
(callback)Registers a callback that can sync this plot with a
SessionPlot
connected to it.register_disconnect_callback
(callback)Registers a callback that can disconnect this plot from a
SessionPlot
connected to it.select_ids
(ids[,Β view])Selects the points with the given IDs in this plot.
connect
()Connects this plot, if necessary.
Disconnects the plot, if necessary.
freeze
()Freezes the plot, replacing it with a static image.
save
(path,Β **kwargs)Saves the plot.
show
(**kwargs)Shows the plot.
reset
()Resets the plot to its default state.
- 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 aninit_fcn
when constructing this plot that defines how to create the base patches view. This usually involvesto_patches()
orto_evaluation_patches()
Note
In order to use
"frames"
selection mode, you must have provided aninit_fcn
when constructing this plot that defines how to create the base frames view. This usually involvesto_frames()
- 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.This view will also be shown when the plot is in its default state (no selection).
- 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.
- 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
, if known
- Returns:
a
(link_type, label_fields, selection_mode, init_fcn)
tuple
- 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
- 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
- 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
corresponding to the given IDs, if available
- 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 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.
- save(path, **kwargs)#
Saves the plot.
- Parameters:
path β the path to write the plot
**kwargs β subclass-specific keyword arguments
- show(**kwargs)#
Shows the plot.
The plot will be connected if necessary.
- Parameters:
**kwargs β subclass-specific keyword arguments
- property supports_session_updates#
Whether this plot supports automatic updates in response to session changes.
- reset()#
Resets the plot to its default state.
- class fiftyone.core.plots.ViewPlot(init_view=None)#
Bases:
ResponsivePlot
Base class for plots that can be automatically populated given a
fiftyone.core.collections.SampleCollection
instance.The state of
ViewPlot
instances can also be updated by external parties by calling itsupdate_view()
method.- Parameters:
init_view (None) β an initial
fiftyone.core.collections.SampleCollection
to load
Attributes:
Whether this plot supports automatic updates in response to session changes.
Whether this plot is currently connected.
Whether this plot is currently disconnected.
Whether this plot is currently frozen.
The link type between this plot and a connected session.
Methods:
update_view
(view[,Β agg_results])Updates the plot based on the provided view.
reset
()Resets the plot to its default state.
connect
()Connects this plot, if necessary.
Disconnects the plot, if necessary.
freeze
()Freezes the plot, replacing it with a static image.
save
(path,Β **kwargs)Saves the plot.
show
(**kwargs)Shows the plot.
- property supports_session_updates#
Whether this plot supports automatic updates in response to session changes.
- update_view(view, agg_results=None)#
Updates the plot based on the provided view.
- Parameters:
view β a
fiftyone.core.collections.SampleCollection
agg_results (None) β a list of pre-computed aggregation results
- reset()#
Resets the plot to its default state.
- 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 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.
- save(path, **kwargs)#
Saves the plot.
- Parameters:
path β the path to write the plot
**kwargs β subclass-specific keyword arguments
- show(**kwargs)#
Shows the plot.
The plot will be connected if necessary.
- Parameters:
**kwargs β subclass-specific keyword arguments
- class fiftyone.core.plots.PlotManager(session)#
Bases:
object
Class that manages communication between a
fiftyone.core.session.Session
and one or morefiftyone.core.plots.base.ResponsivePlot
instances.Each plot can be linked to either the view, samples, frames, or labels of a session:
View links: When a plot has
link_type == "view"
, then, when the sessionβs view changes, the plot is updated based on the content of the viewSample links: When points are selected in a plot with
link_type == "samples"
, a view containing the corresponding samples is loaded in the App. Conversely, when the sessionβs view changes, the corresponding points are selected in the plotFrame links: When points are selected in a plot with
link_type == "frames"
, a view containing the corresponding frames is loaded in the App. Conversely, when the sessionβs view changes, the corresponding points are selected in the plotLabel links: When points are selected in a plot with
link_type == "labels"
, a view containing the corresponding labels is loaded in the App. Conversely, when the sessionβs view changes, the points in the plot corresponding to all labels in the view are selected in the plot
- Parameters:
session β a
fiftyone.core.session.Session
Methods:
summary
()Returns a string summary of this manager.
keys
()Returns an iterator over the names of plots in this manager.
items
()Returns an iterator over the
(name, plot)
pairs in this manager.values
()Returns an iterator over the plots in this manager.
attach
(plot[,Β name,Β connect,Β overwrite])Attaches a plot to this manager.
remove
(name)Removes the plot from this manager.
clear
()Removes all plots from this manager.
pop
(name)Removes the plot from this manager and returns it.
connect
()Connects this manager to its session and all plots.
Disconnects this manager from its session and all plots.
sync
()Syncs all connected plots with the session's current view.
freeze
()Freezes all connected plots, replacing them with static images.
Attributes:
Whether this manager is currently connected to its plots.
Whether this manager is currently disconnected from its plots.
Whether this manager has plots linked to views.
Whether this manager has plots linked to samples.
Whether this manager has plots linked to frames.
Whether this manager has plots linked to labels.
- summary()#
Returns a string summary of this manager.
- Returns:
a string summary
- keys()#
Returns an iterator over the names of plots in this manager.
- Returns:
an iterator over plot names
- items()#
Returns an iterator over the
(name, plot)
pairs in this manager.- Returns:
an iterator that emits
(name, ResponsivePlot)
tuples
- values()#
Returns an iterator over the plots in this manager.
- Returns:
an iterator that emits
fiftyone.core.plots.base.ResponsivePlot
instances
- property is_connected#
Whether this manager is currently connected to its plots.
- property is_disconnected#
Whether this manager is currently disconnected from its plots.
- property has_view_links#
Whether this manager has plots linked to views.
- property has_sample_links#
Whether this manager has plots linked to samples.
- property has_frame_links#
Whether this manager has plots linked to frames.
- property has_label_links#
Whether this manager has plots linked to labels.
- attach(plot, name=None, connect=True, overwrite=True)#
Attaches a plot to this manager.
- Parameters:
plot β a
fiftyone.core.plots.base.ResponsivePlot
name (None) β an optional name for the plot
connect (True) β whether to immediately connect the plot
overwrite (True) β whether to overwrite an existing plot of the same name
- remove(name)#
Removes the plot from this manager.
- Parameters:
name β the name of a plot
- clear()#
Removes all plots from this manager.
- pop(name)#
Removes the plot from this manager and returns it.
- Parameters:
name β the name of a plot
- Returns:
- connect()#
Connects this manager to its session and all plots.
- disconnect()#
Disconnects this manager from its session and all plots.
- sync()#
Syncs all connected plots with the sessionβs current view.
- freeze()#
Freezes all connected plots, replacing them with static images.
Only applicable in notebook contexts.
- class fiftyone.core.plots.ViewGrid(plots, shape=None, hgap=None, vgap=None, init_view=None, **kwargs)#
Bases:
PlotlyViewPlot
A grid of
PlotlyViewPlot
instances.- Parameters:
plots β a
PlotlyViewPlot
or iterable ofPlotlyViewPlot
instancesshape (None) β the
(rows, cols)
shape to use for the gridhgap (None) β a horizontal spacing between the subplots, in
[0, 1]
vgap (None) β a vertical spacing between the subplots, in
[0, 1]
init_view (None) β an optional initial
fiftyone.core.collections.SampleCollection
to load**kwargs β optional parameters for
plotly.graph_objects.Figure.update_layout()
Methods:
connect
()Connects this plot, if necessary.
Disconnects the plot, if necessary.
freeze
()Freezes the plot, replacing it with a static image.
reset
()Resets the plot to its default state.
save
(path[,Β width,Β height,Β scale])Saves the plot as an image or HTML.
show
(**kwargs)Shows this plot.
update_view
(view[,Β agg_results])Updates the plot based on the provided view.
Attributes:
Whether this plot is currently connected.
Whether this plot is currently disconnected.
Whether this plot is currently frozen.
The link type between this plot and a connected session.
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 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.
- reset()#
Resets the plot to its default state.
- save(path, width=None, height=None, scale=None, **kwargs)#
Saves the plot as an image or HTML.
- Parameters:
path β the path to write the image or HTML
width (None) β a desired width in pixels when saving as an image. By default, the layout width is used
height (None) β a desired height in pixels when saving as an image. By default, the layout height is used
scale (None) β a scale factor to apply to the layout dimensions. By default, this is 1.0
**kwargs β keyword arguments for
plotly:plotly.graph_objects.Figure.to_image()
orplotly:plotly.graph_objects.Figure.write_html()
- show(**kwargs)#
Shows this plot.
- Parameters:
**kwargs β optional parameters for
plotly.graph_objects.Figure.update_layout()
- property supports_session_updates#
Whether this plot supports automatic updates in response to session changes.
- update_view(view, agg_results=None)#
Updates the plot based on the provided view.
- Parameters:
view β a
fiftyone.core.collections.SampleCollection
agg_results (None) β a list of pre-computed aggregation results
- class fiftyone.core.plots.CategoricalHistogram(field_or_expr, expr=None, order='alphabetical', xlabel=None, log=None, bargap=None, color=None, opacity=None, init_view=None, **kwargs)#
Bases:
PlotlyViewPlot
A histogram of a categorial field.
- Parameters:
field_or_expr β a field name,
embedded.field.name
,fiftyone.core.expressions.ViewExpression
, or MongoDB expression defining the field or expression to plotexpr (None) β
an optional
fiftyone.core.expressions.ViewExpression
or MongoDB expression to apply tofield_or_expr
(which must be a field) before plottingorder ("alphabetical") β the x-axis ordering strategy to use. Can be βalphabeticalβ to sort by field value, or βfrequencyβ to sort in descending order of frequency, or a function suitable for
sorted(items, key=order)
, whereitems
is a list of(value, count)
tuplesxlabel (None) β an optional x-label for the plot
log (False) β whether to use a log scale y-axis
bargap (None) β relative spacing between bars in
[0, 1]
color (None) β a color for the bars. Can be any color supported by
plotly:plotly.graph_objects.bar.Marker.color()
opacity (None) β an optional opacity for the bars in
[0, 1]
init_view (None) β an optional initial
fiftyone.core.collections.SampleCollection
to load**kwargs β optional parameters for
plotly.graph_objects.Figure.update_layout()
Methods:
connect
()Connects this plot, if necessary.
Disconnects the plot, if necessary.
freeze
()Freezes the plot, replacing it with a static image.
reset
()Resets the plot to its default state.
save
(path[,Β width,Β height,Β scale])Saves the plot as an image or HTML.
show
(**kwargs)Shows this plot.
update_view
(view[,Β agg_results])Updates the plot based on the provided view.
Attributes:
Whether this plot is currently connected.
Whether this plot is currently disconnected.
Whether this plot is currently frozen.
The link type between this plot and a connected session.
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 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.
- reset()#
Resets the plot to its default state.
- save(path, width=None, height=None, scale=None, **kwargs)#
Saves the plot as an image or HTML.
- Parameters:
path β the path to write the image or HTML
width (None) β a desired width in pixels when saving as an image. By default, the layout width is used
height (None) β a desired height in pixels when saving as an image. By default, the layout height is used
scale (None) β a scale factor to apply to the layout dimensions. By default, this is 1.0
**kwargs β keyword arguments for
plotly:plotly.graph_objects.Figure.to_image()
orplotly:plotly.graph_objects.Figure.write_html()
- show(**kwargs)#
Shows this plot.
- Parameters:
**kwargs β optional parameters for
plotly.graph_objects.Figure.update_layout()
- property supports_session_updates#
Whether this plot supports automatic updates in response to session changes.
- update_view(view, agg_results=None)#
Updates the plot based on the provided view.
- Parameters:
view β a
fiftyone.core.collections.SampleCollection
agg_results (None) β a list of pre-computed aggregation results
- class fiftyone.core.plots.NumericalHistogram(field_or_expr, expr=None, bins=None, range=None, xlabel=None, log=None, color=None, opacity=None, init_view=None, **kwargs)#
Bases:
PlotlyViewPlot
A histogram of a numerical field.
- Parameters:
field_or_expr β
a field name,
embedded.field.name
,fiftyone.core.expressions.ViewExpression
, or MongoDB expression defining the field or expression to plotexpr (None) β
an optional
fiftyone.core.expressions.ViewExpression
or MongoDB expression to apply tofield_or_expr
(which must be a field) before plottingbins (None) β can be either an integer number of bins to generate or a monotonically increasing sequence specifying the bin edges to use. By default, 10 bins are created. If
bins
is an integer and norange
is specified, bin edges are automatically computed from the bounds of the fieldrange (None) β a
(lower, upper)
tuple specifying a range in which to generate equal-width bins. Only applicable whenbins
is an integer orNone
xlabel (None) β an optional x-label for the plot
log (False) β whether to use a log scale y-axis
color (None) β a color for the bars. Can be any color supported by
plotly:plotly.graph_objects.bar.Marker.color()
opacity (None) β an optional opacity for the bars in
[0, 1]
init_view (None) β an optional initial
fiftyone.core.collections.SampleCollection
to load**kwargs β optional parameters for
plotly.graph_objects.Figure.update_layout()
Methods:
connect
()Connects this plot, if necessary.
Disconnects the plot, if necessary.
freeze
()Freezes the plot, replacing it with a static image.
reset
()Resets the plot to its default state.
save
(path[,Β width,Β height,Β scale])Saves the plot as an image or HTML.
show
(**kwargs)Shows this plot.
update_view
(view[,Β agg_results])Updates the plot based on the provided view.
Attributes:
Whether this plot is currently connected.
Whether this plot is currently disconnected.
Whether this plot is currently frozen.
The link type between this plot and a connected session.
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 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.
- reset()#
Resets the plot to its default state.
- save(path, width=None, height=None, scale=None, **kwargs)#
Saves the plot as an image or HTML.
- Parameters:
path β the path to write the image or HTML
width (None) β a desired width in pixels when saving as an image. By default, the layout width is used
height (None) β a desired height in pixels when saving as an image. By default, the layout height is used
scale (None) β a scale factor to apply to the layout dimensions. By default, this is 1.0
**kwargs β keyword arguments for
plotly:plotly.graph_objects.Figure.to_image()
orplotly:plotly.graph_objects.Figure.write_html()
- show(**kwargs)#
Shows this plot.
- Parameters:
**kwargs β optional parameters for
plotly.graph_objects.Figure.update_layout()
- property supports_session_updates#
Whether this plot supports automatic updates in response to session changes.
- update_view(view, agg_results=None)#
Updates the plot based on the provided view.
- Parameters:
view β a
fiftyone.core.collections.SampleCollection
agg_results (None) β a list of pre-computed aggregation results