Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ipywidgets and interact #132

Open
Thomzoy opened this issue Nov 4, 2024 · 1 comment
Open

Ipywidgets and interact #132

Thomzoy opened this issue Nov 4, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Thomzoy
Copy link

Thomzoy commented Nov 4, 2024

Description

I'm using jupyter lite with xeus kernel. I'm using a simple script:

import numpy as np
import matplotlib.pyplot as plt
from ipywidgets import interact, FloatSlider
import ipywidgets as widgets

# Function to plot the sine wave
def plot_sine_wave(amplitude, frequency):
    x = np.linspace(0, 2 * np.pi, 100)
    y = amplitude * np.sin(frequency * x)
    plt.figure(figsize=(8, 4))
    plt.plot(x, y, label=f'Sine wave: amplitude={amplitude}, frequency={frequency}')
    plt.xlabel('x')
    plt.ylabel('y')
    plt.title('Interactive Sine Wave')
    plt.grid(True)
    plt.legend()
    plt.show()

amplitude_slider = FloatSlider(min=0.1, max=2.0, step=0.1, value=1.0, description='Amplitude:')
frequency_slider = FloatSlider(min=0.5, max=3.0, step=0.1, value=1.0, description='Frequency:')

interact(plot_sine_wave, amplitude=amplitude_slider, frequency=frequency_slider)

This works fine in jupyterlite's lab (the plot updates on slider change), but not on voici (no plot update).
Should it work as is ?

As a sidenote, using a simple IntSlider correctly updates the displayed number on the side of the widget, so some kind of interaction still works.

Thanks !

@Thomzoy Thomzoy added the bug Something isn't working label Nov 4, 2024
@Thomzoy Thomzoy changed the title Ipywidgets and interact Ipywidgets and interact Nov 4, 2024
@Thomzoy
Copy link
Author

Thomzoy commented Nov 4, 2024

Related to #127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant