-
Notifications
You must be signed in to change notification settings - Fork 157
Using geomdl with Jupyter notebooks
NURBS-Python supports Matplotlib and Plotly visualization systems for on-the-fly visualization of curves and surfaces. Although I personally feel not so comfortable with Jupyter (that's why I am maintaining a repository containing example scripts), it seems to be the de-facto coding environment for most people.
NURBS-Python's Matplotlib and Plotly visualization modules require some extra steps for Jupyter (and IPython) support. I would like to discuss how you can enable it below.
Jupyter support for Matplotlib visualization module works out-of-the-box in NURBS-Python v4.0+ versions by default. The only necessary update is adding the following line on top of the first cell of your Jupyter notebook:
%matplotlib notebook
The interactive plot will be automatically loaded on your Jupyter notebook after running the cell containing render()
method.
Jupyter support for Plotly visualization module is added with the version v4.1.0. The Plotly visualization module will automatically detect if it is currently running on a Jupyter notebook and automatically show the interactive plot inside the Jupyter notebook.
It is possible to change the image size using the configuration class:
#
# Assuming that you have already generated an instance
# of Surface class using the variable name "surf"
#
# configuration module setting the figure size
vis_config = VisPlotly.VisConfig(figure_size=[1280, 720])
# surface visualization module w/ config module
vis_component = VisPlotly.VisSurface(vis_config)
# set surface visualization component
surf.vis = vis_component
# plot the surface
surf.render()