sidpy/viz/jupyter_utils.py
def save_fig_filebox_button(fig, filename):
    """
    Create ipython widgets to allow the user to save a figure to the
    specified file.

    Parameters
    ----------
    fig : matplotlib.Figure
        The figure to be saved.
    filename : str
        The filename the figure should be saved to

    Returns
    -------
    widget_box : ipywidgets.HBox
        Widget box holding the text entry and save button

    """
    filename = os.path.abspath(filename)
    file_dir, filename = os.path.split(filename)

    name_box = widgets.Text(value=filename,
                            placeholder='Type something',
                            description='Output Filename:',
                            disabled=False,
                            layout={'width': '50%'})
    save_button = widgets.Button(description='Save figure')

    def _save_fig(*args):
        filename = name_box.value
        save_path = os.path.join(file_dir, filename)
        _, ext = os.path.splitext(filename)
        if ext == '.txt':
            export_fig_data(fig, save_path, True)
        else:
            fig.savefig(save_path, dpi='figure')
        print('Figure saved to "{}".'.format(save_path))

    widget_box = widgets.HBox([name_box, save_button])

    save_button.on_click(_save_fig)

    return widget_box

    Create ipython widgets to allow the user to save a figure to the
    specified file.

    Parameters
    ----------
    fig : matplotlib.Figure
        The figure to be saved.
    filename : str
        The filename the figure should be saved to

    Returns
    -------
    widget_box : ipywidgets.HBox
        Widget box holding the text entry and save button

    
Create ipython widgets to allow the user to save a figure to the
specified file.

Parameters

fig : matplotlib.Figure
The figure to be saved.
filename : str
The filename the figure should be saved to

Returns

widget_box : ipywidgets.HBox
Widget box holding the text entry and save button
Create ipython widgets to allow the user to save a figure to the specified file . Parameters fig : matplotlib . Figure The figure to be saved . filename : str The filename the figure should be saved to Returns widget_box : ipywidgets . HBox Widget box holding the text entry and save button
def save_fig_filebox_button(fig, filename):
    filename = os.path.abspath(filename)
    file_dir, filename = os.path.split(filename)
    name_box = widgets.Text(value=filename,
                            placeholder='Type something',
                            description='Output Filename:',
                            disabled=False,
                            layout={'width': '50%'})
    save_button = widgets.Button(description='Save figure')
    def _save_fig(*args):
        filename = name_box.value
        save_path = os.path.join(file_dir, filename)
        _, ext = os.path.splitext(filename)
        if ext == '.txt':
            export_fig_data(fig, save_path, True)
        else:
            fig.savefig(save_path, dpi='figure')
        print('Figure saved to "{}".'.format(save_path))
    widget_box = widgets.HBox([name_box, save_button])
    save_button.on_click(_save_fig)
    return widget_box
def save_fig_filebox_button ( fig , filename ) : filename = os . path . abspath ( filename ) file_dir , filename = os . path . split ( filename ) name_box = widgets . Text ( value = filename , placeholder = 'Type something' , description = 'Output Filename:' , disabled = False , layout = { 'width' : '50%' } ) save_button = widgets . Button ( description = 'Save figure' ) def _save_fig ( * args ) : filename = name_box . value save_path = os . path . join ( file_dir , filename ) _ , ext = os . path . splitext ( filename ) if ext == '.txt' : export_fig_data ( fig , save_path , True ) else : fig . savefig ( save_path , dpi = 'figure' ) print ( 'Figure saved to "{}".' . format ( save_path ) ) widget_box = widgets . HBox ( [ name_box , save_button ] ) save_button . on_click ( _save_fig ) return widget_box
Create ipython widgets to allow the user to save a figure to the
specified file.
Create ipython widgets to allow the user to save a figure to the specified file .
"""
    Create ipython widgets to allow the user to save a figure to the
    specified file.

    Parameters
    ----------
    fig : matplotlib.Figure
        The figure to be saved.
    filename : str
        The filename the figure should be saved to

    Returns
    -------
    widget_box : ipywidgets.HBox
        Widget box holding the text entry and save button

    """
fig
filename