How to use the plotly.graph_objs.Scatter 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 vpc-ccg / calib / slurm_scripts / calib_scalability_tests_plotting.py View on Github external
trace = go.Scatter(
        name='Time for molNum = {}'.format(num_molecules),
        x=x_list,
        y=y1_list,
        mode='markers+lines',
        marker=dict(
            symbol=key_to_symbol[(num_molecules,'wall_time')],
            size=10,
        ),
        line=dict(
            color='black',
            dash='solid',
        )
    )
    data.append(trace)
    trace = go.Scatter(
        name='RAM for molNum = {}'.format(num_molecules),
        x=x_list,
        y=y2_list,
        yaxis='y2',
        mode='markers+lines',
        marker=dict(
            symbol=key_to_symbol[(num_molecules,'mem')],
            size=10,
        ),
        line=dict(
            color='black',
            dash='longdash',
        )
    )
    print(key_to_symbol[(num_molecules,'mem')],)
    data.append(trace)
github darwinex / darwin-api-tutorials / PYTHON / MINIONS / dwx_graphics_helpers.py View on Github external
def _generate_scatter_single_(self, _df, _name):
        return go.Scatter(
                        x = _df.index,
                        y = _df,
                        name = _name)
github danhper / bigcode-tools / bigcode-embeddings / bigcode_embeddings / visualization.py View on Github external
def create_interactive_scatter_plot(embeddings_2d, labels, output=None):
    clusters_count = compute_clusters_count(labels)
    data = []
    for i in range(clusters_count):
        indexes = labels[labels.Cluster == i].index.values
        label_column = "value" if "value" in labels.columns else "type"
        trace = go.Scatter(
            x=embeddings_2d[indexes, 0],
            y=embeddings_2d[indexes, 1],
            mode="markers",
            text=labels.loc[indexes][label_column].values,
            marker={"color": SVG_COLORS[i]}
        )
        data.append(trace)

    kwargs = {"filename": output} if output else {}
    plotly.offline.plot(data, **kwargs)
github erp12 / pyshgp / gp / reporting.py View on Github external
def plot_piano_roll():
	plotly.offline.plot({
    	"data": [go.Scatter(x=range(len(total_errors_in_evalutaion_order)),
    					 	y=total_errors_in_evalutaion_order,
    						mode = 'markers',
    						marker = dict(
						        color = 'rgba(85, 109, 255, .3)')
    						)],
    	"layout": go.Layout(xaxis= dict(title = 'Evaluation'),
    						yaxis = dict(title = 'Total Error',
    							         type='log'))
    })
github rlworkgroup / garage / garage / viskit / frontend.py View on Github external
if use_median:
            p25.append(np.mean(plt.percentile25))
            p50.append(np.mean(plt.percentile50))
            p75.append(np.mean(plt.percentile75))
            x = list(range(len(plt.percentile50)))
            y = list(plt.percentile50)
            y_upper = list(plt.percentile75)
            y_lower = list(plt.percentile25)
        else:
            x = list(range(len(plt.means)))
            y = list(plt.means)
            y_upper = list(plt.means + plt.stds)
            y_lower = list(plt.means - plt.stds)

        data.append(
            go.Scatter(
                x=x + x[::-1],
                y=y_upper + y_lower[::-1],
                fill='tozerox',
                fillcolor=core.hex_to_rgb(color, 0.2),
                line=go.Line(color='transparent'),
                showlegend=False,
                legendgroup=plt.legend,
                hoverinfo='none'))
        data.append(
            go.Scatter(
                x=x,
                y=y,
                name=plt.legend,
                legendgroup=plt.legend,
                line=dict(color=core.hex_to_rgb(color)),
            ))
github ecell / ecell4 / ecell4 / plotting / _plotly.py View on Github external
color_scale = plotly_color_scale()

    plotly.offline.init_notebook_mode()
    fig = go.Figure()

    data = None
    xidx = 0
    for obs in args:
        if isinstance(obs, types.FunctionType):
            if data is None:
                raise ValueError("A function must be given after an observer.")
            y = [obs(xi) for xi in data[xidx]]
            label = obs.__name__
            showlegend = (label not in color_scale.get_config())
            trace = go.Scatter(x=data[xidx], y=y, name=label, line_color=color_scale.get_color(label), legendgroup=label, showlegend=showlegend)
            fig.add_trace(trace)
            continue

        data = numpy.array(obs.data()).T

        targets = [sp.serial() for sp in obs.targets()]
        targets = list(enumerate(targets))

        for idx, serial in targets:
            showlegend = (serial not in color_scale.get_config())
            trace = go.Scatter(x=data[xidx], y=data[idx + 1], name=serial, line_shape=('linear' if not step else 'hv'), line_color=color_scale.get_color(serial), legendgroup=serial, showlegend=showlegend)
            fig.add_trace(trace)

    layout_ = dict(xaxis_title='Time', yaxis_title='The Number of Molecules')
    if layout is not None:
        layout_.update(layout)
github negrinho / deep_architect / explorer / darch_app.py View on Github external
def search_scatter2d(graph_id, ds, key_x, key_y):
    return dcc.Graph(
        id='arch-1d-over-time',
        figure={
            'data': [
                go.Scatter(
                    x=range(1, len(ds) + 1),
                    y=[d['validation_accuracy'] for d in ds],
                    # text=df[df['continent'] == i]['country'],
                    mode='markers',
                    opacity=0.7,
                    marker={
                        'size': 15,
                        'line': {'width': 0.5, 'color': 'white'}
                    },
                ),
                go.Scatter(
                    x=range(1, len(ds) + 1),
                    y=vi.running_max([d['validation_accuracy'] for d in ds]),
                    # text=df[df['continent'] == i]['country'],
                    mode='line',
                    # opacity=0.7,
github GenomicParisCentre / toulligQC / toulligqc / plotly_graph_generator.py View on Github external
digitized = np.digitize(time, bins, right=True) 
        
        bin_means = [time[digitized == i].mean() for i in range(1, len(bins))]
        
        # Interpolation
        length = dataframe_dict.get('sequence.length')
        f = interp1d(time, length, kind="linear")
        x_int = np.linspace(time[0],time[-1], 150)
        y_int = f(x_int)
        
        # Plot of mean values Y axis
        length_filt = length.loc[length >= 0].dropna()
    
        fig = go.Figure()
        
        fig.append_trace(go.Scatter(
        x=x_int,
        y=y_int,
        mode='lines',
        name='interpolation curve',
        line=dict(color='#205b47', width=3, shape="linear"))
        )

        
        fig.update_layout(    
                title={
                'text': "<b>Read length over experiment time</b>",
                'y':1.0,
                'x':0.45,
                'xanchor': 'center',
                'yanchor': 'top',
                'font' : dict(
github HewlettPackard / zing-stats / zingstats / zing_stats.py View on Github external
def plot_changes(df_plot, group):
    created_line = go.Scatter(
        name='Created',
        x=df_plot.index,
        y=df_plot['created'])
    submitted_line = go.Scatter(
        name='Merged',
        x=df_plot.index,
        y=df_plot['merged'])
    updated_line = go.Scatter(
        name='Updated',
        x=df_plot.index,
        y=df_plot['updated'])
    plot_title = "Changes/PRs (%s projects)" % group
    changes_plot = plotly.offline.plot(
        {
            "data": [created_line, submitted_line, updated_line],
            "layout": go.Layout(title=plot_title)
        },
        show_link=False,
        output_type='div',
        include_plotlyjs='False')
    return changes_plot
github mwouts / jupytext / demo / World population.lgt.py View on Github external
plt.figure(figsize=(10, 5), dpi=100)
plt.stackplot(population.index, population.values.T / 1e9)
plt.legend(population.columns, loc='upper left')
plt.ylabel('Population count (B)')
plt.show()

# ## Stacked bar plot with plotly

# region
import plotly.offline as offline
import plotly.graph_objs as go

offline.init_notebook_mode()
# endregion

data = [go.Scatter(x=population.index, y=population[zone], name=zone, stackgroup='World')
        for zone in zones]
fig = go.Figure(data=data,
                layout=go.Layout(title='World population'))
offline.iplot(fig)