qiskit icon indicating copy to clipboard operation
qiskit copied to clipboard

Add support for visualisation `Annotation`

Open jakelishman opened this issue 5 months ago • 0 comments

What should we add?

Currently, the BoxOp.annotations field is ignored during visualisation. It really ought to show up somehow in the MPL drawer in particular.

This is tricky to do well, because Annotation is designed to be user subclassable, and in general may represent very complex data. Possible strategies might be:

  • just the built-in __repr__/__str__ and rely on subclasses to fill that in with something that will work in a visualisation (not ideal: this overloads the functionality heavily)
  • add some sort of subclassable Annotation.visualize method with a default implementation
  • have a global registry of "default" OQ3 serialisers/deserialisers (which annotation authors populate themselves), available for use by default by Qiskit and by users, and use that.

jakelishman avatar Jun 11 '25 13:06 jakelishman