Sidecar interface

Hello,

I am a newbie, and I wish to seek for your help in developing matplotlib in Jupyter-Lab, sidecar.

I have no problem in developing a simple application via matplotlib, but, when I tried to transfer the codes to sidecar, the plot appears in two places, i.e.: the output block, and the sidecar. I can set the figure visibility to False for not displaying the figure in the output block, but my control widgets appear on the sidecar as graphics (figure), and not the controls.

My questions:

a) Is it possible to transfer all the control widgets and matplotlib figure to sidecar?
b) how to develop the plot and have it display on the sidecar, but not on the output block?

I appreciate very much if you could help me understand the processes. Thank you very much.

Yup this is absolutely possible! You can do this with a combination of ioff to turn to off the autodisplay and the sidecar to capture outputs:

%matplotlib ipympl
import matplotlib.pyplot as plt
import sidecar
sc = sidecar.Sidecar()
with plt.ioff():
    with sc:
        fig = plt.figure()
        display(fig.canvas)

Perfect solution; I successfully ported my app to sidecar. Thank you very much.