Hi! I'm unable to get some of my old code (written in the Sage notebook around 2011) to work on CoCalc. I found very similar code on the SageMath wiki for interact/graphics (I am not able to post the link because I don't have enough 'karma'). Scroll down to "Interact with matplotlib". That code also doesn't work for me in CoCalc: no image gets displayed, just the two slider bars. Is there a simple change that needs to be made?
In general, should I expect Sage code to work in a CoCalc Sage worksheet? I admit that I don't know to what extent the two are compatible. Thanks for any advice!
Here is the code from that SageMath Wiki:
# Simple example demonstrating how to interact with matplotlib directly.
# Comment plt.clf() to get the plots overlay in each update.
# Gokhan Sever & Harald Schilly (2010-01-24)
from scipy import stats
import numpy as np
import matplotlib.pyplot as plt
@interact
def plot_norm(loc=(0,(0,10)), scale=(1,(1,10))):
rv = stats.norm(loc, scale)
x = np.linspace(-10,10,1000)
plt.plot(x,rv.pdf(x))
plt.grid(True)
plt.savefig('plt.png')
plt.clf()