Summary in table#

You are already familiar with summary(), which prints a summary table for a DocumentArray and its attributes:

from docarray import DocumentArray

da = DocumentArray.empty(3)

        Documents Summary         
  Length                 3        
  Homogenous Documents   True     
  Common Attributes      ('id',)  
                     Attributes Summary                     
  Attribute   Data type   #Unique values   Has empty value  
  id          ('str',)    3                False            

Image sprites#

If a DocumentArray contains only image Documents, you can plot them all in one sprite image using plot_image_sprites().

from docarray import DocumentArray

docs = DocumentArray.from_files('*.jpg')

Plot Matches#

If an image Document contains images in its .matches attribute, you can visualise the matching results using plot_matches_sprites().

import numpy as np
from docarray import DocumentArray

da = DocumentArray.from_files('*.jpg')
da.embeddings = np.random.random([len(da), 10])
da[0].plot_matches_sprites(top_k=5, channel_axis=-1, inv_normalize=False)

Embedding projector#


This feature requires fastapi dependency. You can run pip install "docarray[full]" to install it.

If a DocumentArray has .embeddings, you can visualize them interactively using plot_embeddings().

import numpy as np
from docarray import DocumentArray

docs = DocumentArray.empty(1000)
docs.embeddings = np.random.random([len(docs), 256])


For an image DocumentArray, you can pass the image_sprites parameter to set the visualization points to images.



If you have a lot of metadata, plotting may be slow since that metadata is stored in a corresponding TSV file. You can speed up plotting with the exclude_fields_metas parameter, preventing fields (like chunks or matches) from being written to the TSV.