If you are using IPython, you could try the %%capture magic to get the plot data:
https://ipython.readthedocs.io/en/stable/interactive/magics.html#cellmagic-capture
If you are using IPython, you could try the %%capture magic to get the plot data:
https://ipython.readthedocs.io/en/stable/interactive/magics.html#cellmagic-capture