docarray.array.mixins.plot module#
- class docarray.array.mixins.plot.PlotMixin[source]#
Bases:
object
Helper functions for plotting the arrays.
- summary()[source]#
Print the structure and attribute summary of this DocumentArray object.
Warning
Calling {meth}`.summary` on large DocumentArray can be slow.
- plot_embeddings(title='MyDocumentArray', path=None, image_sprites=False, min_image_size=16, channel_axis=- 1, start_server=True, host='127.0.0.1', port=None, image_source='tensor')[source]#
Interactively visualize
embeddings
using the Embedding Projector.- Parameters
title (
str
) – the title of this visualization. If you want to compare multiple embeddings at the same time, make sure to give different names each time and setpath
to the same value.host (
str
) – if set, bind the embedding-projector frontend to given host. Otherwise localhost is used.port (
Optional
[int
]) – if set, run the embedding-projector frontend at given port. Otherwise a random port is used.image_sprites (
bool
) – if set, visualize the dots usinguri
andtensor
.path (
Optional
[str
]) – if set, then append the visualization to an existing folder, where you can compare multiple embeddings at the same time. Make sure to use a differenttitle
each time .min_image_size (
int
) – only used when image_sprites=True. the minimum size of the imagechannel_axis (
int
) – only used when image_sprites=True. the axis id of the color channel,-1
indicates the color channel info at the last axisstart_server (
bool
) – if set, start a HTTP server and open the frontend directly. Otherwise, you need to rely onreturn
path and serve by yourself.image_source (
str
) – specify where the image comes from, can beuri
ortensor
. empty tensor will fallback to uri
- Return type
str
- Returns
the path to the embeddings visualization info.
- plot_image_sprites(output=None, canvas_size=512, min_size=16, channel_axis=- 1, image_source='tensor', skip_empty=False, show_progress=False, show_index=False, fig_size=None)[source]#
Generate a sprite image for all image tensors in this DocumentArray-like object.
An image sprite is a collection of images put into a single image. It is always square-sized. Each sub-image is also square-sized and equally-sized.
- Parameters
output (
Optional
[str
]) – Optional path to store the visualization. If not given, show in UIcanvas_size (
int
) – the size of the canvasmin_size (
int
) – the minimum size of the imagechannel_axis (
int
) – the axis id of the color channel,-1
indicates the color channel info at the last axisimage_source (
str
) – specify where the image comes from, can beuri
ortensor
. empty tensor will fallback to uriskip_empty (
bool
) – skip Document who has no .uri or .tensor.show_progress (
bool
) – show a progresbar.
- Return type
None