How can I combine plots from Sage and Matplotlib into a single plot without one overlaying the other?
Here's an example script where I attempt to combine Sage and Matplotlib plots:
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
x = [1, 2, 3, 4, 5]
y = [1, 2, 3, 4, 5]
ax.plot(x, y)
c = circle((1,1),1)
c_matplotlib = c.matplotlib(figure=fig) # this Returns matplotlib.figure.Figure object
plt.show()
However, when I run this script, Sage just puts another image on top of the canvas of Matplotlib. Is there a way to update the canvas of Matplotlib to combine the two plots into one?
Image
Reference
- Link to sage cell: https://sagecell.sagemath.org/?q=uoezbs

Working Solution by JohanC