def figure(
    key=None,
    width=400,
    height=500,
    lighting=True,
    controls=True,
    controls_vr=False,
    controls_light=False,
    debug=False,
    **kwargs
):
    """Create a new figure if no key is given, or return the figure associated with key.

    :param key: Python object that identifies this figure
    :param int width: pixel width of WebGL canvas
    :param int height:  .. height ..
    :param bool lighting: use lighting or not
    :param bool controls: show controls or not
    :param bool controls_vr: show controls for VR or not
    :param bool debug: show debug buttons or not
    :return: :any:`Figure`
    """
    if key is not None and key in current.figures:
        current.figure = current.figures[key]
        current.container = current.containers[key]
    elif isinstance(key, ipv.Figure) and key in current.figures.values():
        key_index = list(current.figures.values()).index(key)
        key = list(current.figures.keys())[key_index]
        current.figure = current.figures[key]
        current.container = current.containers[key]
    else:
        current.figure = ipv.Figure(width=width, height=height, **kwargs)
        current.container = ipywidgets.VBox()
        current.container.children = [current.figure]
        if key is None:
            key = uuid.uuid4().hex
        current.figures[key] = current.figure
        current.containers[key] = current.container
        if controls:
            # stereo = ipywidgets.ToggleButton(value=current.figure.stereo, description='stereo', icon='eye')
            # l1 = ipywidgets.jslink((current.figure, 'stereo'), (stereo, 'value'))
            # current.container.children += (ipywidgets.HBox([stereo, ]),)
            pass  # stereo and fullscreen are now include in the js code (per view)
        if controls_vr:
            eye_separation = ipywidgets.FloatSlider(value=current.figure.eye_separation, min=-10, max=10, icon='eye')
            ipywidgets.jslink((eye_separation, 'value'), (current.figure, 'eye_separation'))
            current.container.children += (eye_separation,)
        if controls_light:
            globals()['controls_light']()
        if debug:
            show = ipywidgets.ToggleButtons(options=["Volume", "Back", "Front", "Coordinate"])
            current.container.children += (show,)
            # ipywidgets.jslink((current.figure, 'show'), (show, 'value'))
            traitlets.link((current.figure, 'show'), (show, 'value'))
    return current.figure
def figure ( key = None , width = 400 , height = 500 , lighting = True , controls = True , controls_vr = False , controls_light = False , debug = False , ** kwargs ) : if key is not None and key in current . figures : current . figure = current . figures [ key ] current . container = current . containers [ key ] elif isinstance ( key , ipv . Figure ) and key in current . figures . values ( ) : key_index = list ( current . figures . values ( ) ) . index ( key ) key = list ( current . figures . keys ( ) ) [ key_index ] current . figure = current . figures [ key ] current . container = current . containers [ key ] else : current . figure = ipv . Figure ( width = width , height = height , ** kwargs ) current . container = ipywidgets . VBox ( ) current . container . children = [ current . figure ] if key is None : key = uuid . uuid4 ( ) . hex current . figures [ key ] = current . figure current . containers [ key ] = current . container if controls : pass if controls_vr : eye_separation = ipywidgets . FloatSlider ( value = current . figure . eye_separation , min = - 10 , max = 10 , icon = 'eye' ) ipywidgets . jslink ( ( eye_separation , 'value' ) , ( current . figure , 'eye_separation' ) ) current . container . children += ( eye_separation , ) if controls_light : globals ( ) [ 'controls_light' ] ( ) if debug : show = ipywidgets . ToggleButtons ( options = [ "Volume" , "Back" , "Front" , "Coordinate" ] ) current . container . children += ( show , ) traitlets . link ( ( current . figure , 'show' ) , ( show , 'value' ) ) return current . figure
Create a new figure if no key is given, or return the figure associated with key.

    :param key: Python object that identifies this figure
    :param int width: pixel width of WebGL canvas
    :param int height:  .. height ..
    :param bool lighting: use lighting or not
    :param bool controls: show controls or not
    :param bool controls_vr: show controls for VR or not
    :param bool debug: show debug buttons or not
    :return: :any:`Figure`