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

Unexpected behavior using ipympl called from sympy_plot_backends, same code works as expected using pyodide kernel #64

Open
felixlen opened this issue Dec 12, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@felixlen
Copy link

Description

With sympy_plot_backends I create an interactive plot that shows the graph of a parameter dependent function. With a slider it is possible to change the parameter value. After changing the slider value, the plot should be updated. In sympy_plot_backends interactive matplotlib is used.

With pyodide-kernel for jupyterlite this feature is working as expected. With xeus-python there is a glitch: After changing the slider value, the graph is not directly updated. As soon as I click into the drawing pane, the graph gets updated.

Reproduce

Execute the following code in a notebook:

import sympy
%matplotlib widget
import spb

x = sympy.Symbol('x', real=True)
a = sympy.Symbol('a', real=True)

f = sympy.cos(x)/(x**2 + 1)

spb.plot(
    f.subs(x, x-a),
    params = {
        a: (0, -5, 5)
    }
)
  • Now change the slider value for a from the default 0.0 to something nonzero.
  • Observe that the plot does not change.
  • Click into the plot.
  • Observe that now the plot has been updated as expected.

Expected behavior

The plot should update without clicking into the plot pane. With pyodide kernel it is working as expected.

Context

Xeus Python Environment file:

name: xeus-python-kernel

channels:
  - https://repo.mamba.pm/emscripten-forge
  - conda-forge

dependencies:
  - ipympl
  - matplotlib
  - numpy
  - sympy
  - sympy_plot_backends
  • JupyterLite version: 0.2.1
  • Operating System and version: OS X
  • Browser and version: Chrome 120.0.6099.71 and Safari 17.2 (19617.1.17.11.9)
@felixlen felixlen added the bug Something isn't working label Dec 12, 2023
@jtpio jtpio transferred this issue from jupyterlite/xeus-python-kernel Feb 14, 2024
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