Plot lsst.afw.display on a matplotlib axis?

Hello,
I am analyzing full focal plane images taken with the CCOB narrow beam with the goal to analyze secondary spots.
I found afw.display very useful to keep make nice stamps around each “ghost”, and keep plenty of useful information about the absolute stamp position within the focal plane.
I would like to make a gallery of ghost spots with their fit in one matplotlib figure, which basically means having a figure with 20 subplots and be able to plot all my nice afw.display on the different figure axis.
Is there a way to do so?
I have tried different things but failed so far.

I have successfully created a lsst.afw.display.utils.mosaic of ghosts stamps, but that’s not exactly what I want.

Thanks for you help
Johan

Hi @johan.bregeon,

I think DP0.2 tutorial notebook 10 might have a useful example for you. The tutorial is about deblended data products, and in Section 3.2 it uses matplotlib and afw.display to make a 3x5 mosaic of image stamps which each contain the footprint of one of the deblended children of a parent object. In this particular example the axes are suppressed, but you could change that. I think something similar might work for you to make a gallery of ghost stamps?

Rendered html version of the executed notebook.

Let me know if that worked for you?

Thanks Melissa, it’s exactly what I was looking for, it works perfectly.

Actually, here is the one line that I was missing:

display = afwDisplay.Display(frame=fig)

Thanks again !