I had almost decided to hack the Function grapher at https://github.com/stemkoski/stemkoski.github.com
when I came across https://github.com/K3D-tools/K3D-jupyter/
One puzzle remains: The graph is added to a pn.pane.Pane.
Setting a size for the pane displays the plot, but the actual plot size
is slightly larger than the pn pane for some reason.
Any clue how to fix this would be appreciated!!
The notebook with the code is on gitlab:
Really Nice. Thanks for sharing.
have you tried setting the margin of the Pane to 0? Does it work?
yes! margin=15 did the trick! Thank you @Marc
Great you got it working @ea42gh.
How does the K3D-jupyter control compare to VTK? Could you do the same with VTK?
I have not used VTK in a very long time…
K3D-jupyter proved very simple.
From its documentation, it is supposed to play nicely with VTK.
When I add
.servable() to the notebook and run it via `panel serve QuadricSurfaceDisplay.ipynb’ it looks like
and there are errors in the console.
Do you know why that is?. And how to solve it?
no, I have not seen that yet.
What I do see:
- the repository code works in Chromium
- the repository code does not work in firefox:
it fails to load with an error
failed to load https://unpkg.com/@holoviz/panel@^0.10.2/dist/panel.min.js
in the console…
- what change did you make to the notebook before serving it?
I’d like to see if I can duplicate what you are seeing
The only thing I’ve done is to add
.servable() like below
Then I run it with
panel serve QuadricSurfaceDisplay.ipynb and get the errors.
For reference I’ve attached the modified notebook.
QuadricSurfaceDisplay.ipynb (48.2 KB)
I don’t need it working for work. But it would be nice to show case that it’s possible to serve apps using k3d. There are a lot of cool examples in their docs.
Any help is appreciated. Even just a bug report on Github
when I try to serve the notebook and open it in either Firefox or Chromium, I get
b1f0>: No module named 'ipywidgets_bokeh'
File "ipywidget.py", line 23, in _get_ipywidget:
from ipywidgets_bokeh.widget import IPyWidget Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/bokeh/application/handlers/code_runner.py", line 197, in run
File "/home/user/CODE/Langs/Julia/elementary-linear-algebra/QuadricSurfaceDisplay.ipynb", line 153, in <module>
File "/home/user/.local/lib/python3.8/site-packages/panel/viewable.py", line 313, in servable
File "/home/user/.local/lib/python3.8/site-packages/panel/viewable.py", line 749, in server_doc
model = self.get_root(doc)
File "/home/user/.local/lib/python3.8/site-packages/panel/viewable.py", line 482, in get_root
root = self._get_model(doc, comm=comm)
File "/home/user/.local/lib/python3.8/site-packages/panel/layout/base.py", line 112, in _get_model
objects = self._get_objects(model, , doc, root, comm)
File "/home/user/.local/lib/python3.8/site-packages/panel/layout/base.py", line 102, in _get_objects
child = pane._get_model(doc, root, model, comm)
File "/home/user/.local/lib/python3.8/site-packages/panel/pane/ipywidget.py", line 38, in _get_model
model = self._get_ipywidget(self.object, doc, root, comm, **kwargs)
File "/home/user/.local/lib/python3.8/site-packages/panel/pane/ipywidget.py", line 23, in _get_ipywidget
from ipywidgets_bokeh.widget import IPyWidget
ModuleNotFoundError: No module named 'ipywidgets_bokeh'
So I installed ipywidgets_bokeh.
Now I get:
Model 'ipywidgets_bokeh.widget.IPyWidget' does not exist. This could be due to a widget or a custom model not being registered before first usage.
Really weird: upgraded some libraries. Current status:
- chromium partially displays the GUI. The plot appears to be a tiny little area at the top left.
ipywidgets_bokeh.js:1 TypeError: Cannot read property resizeHelper of undefined
at r.handleResize (k3d.js:563)
- Firefox yields an empty display with
Uncaught ReferenceError: requirejs is not defined