I would like to know if there is any way to include a plot which can interactively change using slider controls in a Beamer presentation.
For example, I would like to show the following ipython interactive plot
from ipywidgets import widgets, Layout, Button, Box
from IPython.display import display
import matplotlib.pyplot as plt
import numpy as np
%matplotlib notebook
x = np.linspace(0, 2 , 1000)
fig, ax =plt.subplots(1, figsize=(10,4))
plt.suptitle('Sine Wave')
def update_plot(amp, phase, freq):
ax.clear()
units = 'amp = {} $(\phi)$ \nphase = {} $s$ \nfreq = {} $Hz$'
y = amp*np.sin(2*np.pi*(freq*x+phase))
ax.plot(x,y, label=units.format(amp, phase, freq))
ax.legend(loc=1)
ax.set_xlabel('seconds')
ax.set_ylabel('Amplitud')
ax.set_xlim(x[0], x[-1])
plt.show()
amp1 = widgets.FloatSlider(min=1, max=10, value=4, description= 'Amp:')
phase1 = widgets.FloatSlider(min=0, max=5, value=0, description= 'Phase:')
freq1 = widgets.FloatSlider(min=1, max=10, value=1, description= 'Freq:')
widgets.interactive(update_plot,amp=amp1, phase=phase1, freq=freq1)
Showing a plot with three controls: amplitude, phase, and frequency of a sine function.
Beamer allows to embed movies with a multimedia package but surely it is possible to use a python code of a Jupiter notebook in a presentation.
