Created
September 5, 2019 17:41
-
-
Save davidcorbin/1cd6e46d9cc42310dbf8ae5394a591f2 to your computer and use it in GitHub Desktop.
Interactive Plots in Jupyter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib widget | |
from ipywidgets import * | |
import numpy as np | |
import matplotlib.pyplot as plt | |
x = np.linspace(0, 2 * np.pi) | |
fig = plt.figure() | |
ax = fig.add_subplot(1, 1, 1) | |
line, = ax.plot(x, np.sin(x)) | |
def update(w = 1.0): | |
line.set_ydata(np.sin(w * x)) | |
fig.canvas.draw_idle() | |
interact(update); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment