How to use the plotly.offline.iplot function in plotly

To help you get started, we’ve selected a few plotly examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github janba / GEL / src / PyGEL / PyGEL3D / js.py View on Github external
if h < m.opposite_halfedge(h):
                p0 = pos[m.incident_vertex(m.opposite_halfedge(h))]
                p1 = pos[m.incident_vertex(h)]
                xyze.append(array(p0))
                xyze.append(array(p1))
                xyze.append(array([None, None, None]))
        xyze = array(xyze)
        trace1=go.Scatter3d(x=xyze[:,0],y=xyze[:,1],z=xyze[:,2],
                   mode='lines',
                   line=dict(color='rgb(125,0,0)', width=1),
                   hoverinfo='none')
        mesh_data += [trace1]
    lyt = go.Layout(width=850,height=800)
    lyt.scene.aspectmode="data"
    if EXPORT_MODE:
        py.iplot(dict(data=mesh_data,layout=lyt))
    else:
        return go.FigureWidget(mesh_data,lyt)
github kengz / SLM-Lab / slm_lab / lib / viz.py View on Github external
def plot(*args, **kwargs):
    if util.is_jupyter():
        return iplot(*args, **kwargs)
github darwinex / darwin-api-tutorials / PYTHON / MINIONS / dwx_graphics_helpers.py View on Github external
title=_y_title,
                titlefont=dict(
                    family='Courier New, monospace',
                    size=18,
                    color='#7f7f7f'
                )
            ),
            hoverlabel = dict(namelength = -1),
            annotations=_annotations
        )
                
        # Create figure
        fig = go.Figure(data=_data, layout=_layout)
        
        if _plot_only:
            po.iplot(fig)
        else:
            # Set output filename and plot
            if _custom_filename != '':
                po.plot(fig, filename=_dir_prefix + _custom_filename)
            else:
                po.plot(fig, filename=_dir_prefix + _main_title + '.html')
github brycefrank / pyfor / pyfor / plot.py View on Github external
width=600,
        height=600,
        margin=dict(
            l=65,
            r=50,
            b=65,
            t=90
        ),
        scene=dict(
            aspectmode="data"
        )
    )
    offline.init_notebook_mode(connected=True)
    fig = go.Figure(data=data, layout=layout)
    offline.iplot(fig)
github badlands-model / badlands-companion / badlands_companion / morphoGrid.py View on Github external
shape='spline',
                width = linesize,
                color = 'rgb(0, 0, 0)'
            ),
            name='mean'
        )
        data = [trace0,trace1,trace2]

        layout = dict(
            title=title,
            width=width,
            height=height
        )

        fig = Figure(data=data, layout=layout)
        plotly.offline.iplot(fig)

        return viZ, veZ, vaZ
github smu160 / PvsNP / analysis_utils.py View on Github external
"""Plots a line plot of neuron activity over time
    
    This is a wrapper function for the plotly library line
    plot functionality. It takes any amount of neurons and
    will plot their time series data over a single line, 
    for each individual neuron.

    Args: 
        dataframe: a pandas DataFrame that contains the neuron(s)
        activity time series datato be plotted as lines
    """
    data = list()
    for neuron in neurons:
        data.append(go.Scatter(x=list(range(0, len(dataframe))), y=dataframe[neuron], name=neuron))

    plotly.offline.iplot(data)
github jcmgray / xyzpy / xyzpy / plot / plotter_plotly.py View on Github external
def ishow(figs, nb=True, **kwargs):
    """Show multiple plotly figures in notebook or on web.
    """
    if isinstance(figs, (list, tuple)):
        fig_main = figs[0]
        for fig in figs[1:]:
            fig_main["data"] += fig["data"]
    else:
        fig_main = figs
    if nb:
        from plotly.offline import iplot as plot
        init_plotly_nb()
    else:
        from plotly.plotly import plot
    plot(fig_main, **kwargs)
github Chandlercjy / OnePy / OnePy / builtin_module / plotters / by_plotly.py View on Github external
total_holding_pnl = pd.DataFrame(total_holding_pnl)
        total_holding_pnl.columns = ['total_holding_pnl']
        self.append_trace(fig, total_holding_pnl, 2, 1)

        fig['layout']['yaxis'].update(
            dict(overlaying='y3', side='right', showgrid=False))
        # fig['layout']['xaxis']['type'] = 'category'
        # fig['layout']['xaxis']['rangeslider']['visible'] = False
        # fig['layout']['xaxis']['tickangle'] = 45
        fig['layout']['xaxis']['visible'] = False
        fig['layout']['hovermode'] = 'closest'
        fig['layout']['xaxis']['rangeslider']['visible'] = False

        if notebook:
            plotly.offline.init_notebook_mode()
            py.iplot(fig, filename='OnePy_plot.html', validate=False)
        else:
            py.plot(fig, filename='OnePy_plot.html', validate=False)
github MolSSI / QCFractal / qcfractal / interface / visualization.py View on Github external
def _configure_return(figure, filename, return_figure):
    import plotly

    if return_figure is None:
        return_figure = not _isnotebook()

    if return_figure:
        return figure
    else:
        return plotly.offline.iplot(figure, filename=filename)
github mwouts / world_bank_data / examples / A sunburst plot of the world population.py View on Github external
level2 = df.groupby('region').population.sum().reset_index()[['region', 'region', 'population']]
level2.columns = columns
level2['parents'] = 'World'
# move value to text for this level
level2['text'] = level2['values'].apply(lambda pop: '{:,.0f}'.format(pop))
level2['values'] = 0

level3 = pd.DataFrame({'parents': [''], 'labels': ['World'],
                       'values': [0.0], 'text': ['{:,.0f}'.format(population.loc['WLD'])]})

all_levels = pd.concat([level1, level2, level3], axis=0).reset_index(drop=True)
all_levels
# -

# And now we can plot the World Population
offline.iplot(dict(
    data=[dict(type='sunburst', hoverinfo='text', **all_levels)],
    layout=dict(title='World Population (World Bank, 2017)<br>Click on a region to zoom',
                width=800, height=800)),
    validate=False)