I'm trying to display a figure, with interactive ipywidgets below it, in a RISE slide. The code I'm using to create the figure fills the screen when displayed as a slide and makes it difficult to display the figure and widgets.
I've included a shorter interaction function in the minimum working example below. Currently, to display the graph, everything in Cell 2 is also displayed in the RISE slide.
I've considered including a right scroll bar to scroll past the code (https://rise.readthedocs.io/en/maint-5.5/customize.html#enable-a-right-scroll-bar), or simply adjusting the size of the slide, but I'd prefer to display only the figure and widgets to make it more user-friendly.
Is there a method of creating a figure and associated function in one cell which can be set to 'Skip' in RISE, and displaying the figure in a subsequent cell which can be set to 'Slide'?
This is my first time using RISE, so I may have missed something obvious!
## Cell 1: Slide Type set as 'Skip'
%matplotlib nbagg
import matplotlib.pyplot as plt
import numpy as np
from ipywidgets import interact, IntSlider
## Cell 2: Slide Type set as "Slide"
fig = plt.figure()
ax = fig.add_subplot(111)
def update(seed=0):
ax.cla() # Possibly not best practice, but in my real code I have multiple data sources
# that interact with the widget variables in different ways and this has
# proved the easiest way so far
np.random.seed(seed)
x = 10*np.random.rand(10)
y = np.sin(x)
ax.plot(x, y, "o")
interact(update, seed=IntSlider(min=0, max=10, step=1))
question from:
https://stackoverflow.com/questions/65851196/how-to-display-only-a-figure-with-interactive-ipywidgets-in-rise-slide-without-a 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…