当前位置: 首页>>代码示例>>Python>>正文


Python graph_objs.Data方法代码示例

本文整理汇总了Python中plotly.graph_objs.Data方法的典型用法代码示例。如果您正苦于以下问题:Python graph_objs.Data方法的具体用法?Python graph_objs.Data怎么用?Python graph_objs.Data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在plotly.graph_objs的用法示例。


在下文中一共展示了graph_objs.Data方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: render

# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Data [as 别名]
def render(self):
        """ Plot the figure. Call this last."""
        traces = list(self.getScatterGOs())

        data = Data(traces)
        plotly.offline.iplot({
            'data': data,
            'layout': self.makeLayout()
        }) 
开发者ID:sys-bio,项目名称:tellurium,代码行数:11,代码来源:engine_plotly.py

示例2: plotMultipleDetectors

# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Data [as 别名]
def plotMultipleDetectors(plot,
                          resultsPaths,
                          detectors,
                          scoreProfile):

  traces = []
  traces.append(plot._addValues(plot.rawData))

  # Anomaly detections traces:
  for i, d in enumerate(detectors):
    threshold = plot.thresholds[d][scoreProfile]["threshold"]
    resultsData = getCSVData(os.path.join(plot.resultsDir, resultsPaths[i]))
    FP, TP = plot._parseDetections(resultsData, threshold)
    fpTrace, tpTrace = plot._addDetections("Detection by " + d,
                                           MARKERS[i], FP, TP)
    traces.append(fpTrace)
    traces.append(tpTrace)

  traces.append(plot._addWindows())
  traces.append(plot._addProbation())

  # Create plotly Data and Layout objects:
  data = Data(traces)
  layout = plot._createLayout("Anomaly Detections for " + plot.dataName)

  # Query plotly
  fig = Figure(data=data, layout=layout)
  plot_url = plot.py.plot(fig)

  return plot_url



# Create the list of result filenames for each detector 
开发者ID:numenta,项目名称:htmpapers,代码行数:36,代码来源:fig9.py

示例3: setup_metric_streams

# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Data [as 别名]
def setup_metric_streams(self, local_stream_ids, metric_name, num_channels):

        for i in range(num_channels):
            stream_id = local_stream_ids[i]
            self.stream_ids.append(stream_id)
            py_stream = py.Stream(stream_id)
            py_stream.open()
            self.py_streams.append(py_stream)

            go_stream = go.Stream(token=stream_id, maxpoints=self.max_points)
            self.go_streams.append(go_stream)

        traces = []
        for i in range(num_channels):
            channel_name = "channel_%s" % i
            go_stream = self.go_streams[i]

            trace = go.Scatter(
                x=[],
                y=[],
                mode='splines',
                stream=go_stream,
                name=channel_name
            )
            traces.append(trace)

        data = go.Data(traces)
        layout = go.Layout(title=metric_name)
        fig = go.Figure(data=data, layout=layout)
        py.iplot(fig, filename=metric_name) 
开发者ID:marionleborgne,项目名称:cloudbrain,代码行数:32,代码来源:plotly_stream.py

示例4: _plot_plotly

# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Data [as 别名]
def _plot_plotly(subset_sizes, data_list, mmr):
    """ Plots learning curve using plotly backend.
    Args:
        subset_sizes: list of dataset sizes on which the evaluation was done
        data_list: list of ROC AUC scores corresponding to subset_sizes
        mmr: what MMR the data is taken from
    """
    if mmr:
        title = 'Learning curve plot for %d MMR' % mmr
    else:
        title = 'Learning curve plot'

    trace0 = go.Scatter(
        x=subset_sizes,
        y=data_list[0],
        name='Cross validation error'
    )
    trace1 = go.Scatter(
        x=subset_sizes,
        y=data_list[1],
        name='Test error'
    )
    data = go.Data([trace0, trace1])

    layout = go.Layout(
        title=title,

        xaxis=dict(
            title='Dataset size (logspace)',
            type='log',
            autorange=True,
            titlefont=dict(
                family='Courier New, monospace',
                size=15,
                color='#7f7f7f'
            )
        ),
        yaxis=dict(
            title='Error',
            titlefont=dict(
                family='Courier New, monospace',
                size=15,
                color='#7f7f7f'
            )
        )
    )
    fig = go.Figure(data=data, layout=layout)
    py.iplot(fig, filename='learning_curve_%dMMR' % mmr) 
开发者ID:andreiapostoae,项目名称:dota2-predictor,代码行数:50,代码来源:learning_curve.py

示例5: _update_graph

# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Data [as 别名]
def _update_graph(map_style, region):
    dff = dataframe
    radius_multiplier = {'inner': 1.5, 'outer': 3}

    layout = go.Layout(
        title=metadata['title'],
        autosize=True,
        hovermode='closest',
        height=750,
        font=dict(family=theme['font-family']),
        margin=go.Margin(l=0, r=0, t=45, b=10),
        mapbox=dict(
            accesstoken=mapbox_access_token,
            bearing=0,
            center=dict(
                lat=regions[region]['lat'],
                lon=regions[region]['lon'],
            ),
            pitch=0,
            zoom=regions[region]['zoom'],
            style=map_style,
        ),
    )

    data = go.Data([
        # outer circles represent magnitude
        go.Scattermapbox(
            lat=dff['Latitude'],
            lon=dff['Longitude'],
            mode='markers',
            marker=go.Marker(
                size=dff['Magnitude'] * radius_multiplier['outer'],
                colorscale=colorscale_magnitude,
                color=dff['Magnitude'],
                opacity=1,
            ),
            text=dff['Text'],
            # hoverinfo='text',
            showlegend=False,
        ),
        # inner circles represent depth
        go.Scattermapbox(
            lat=dff['Latitude'],
            lon=dff['Longitude'],
            mode='markers',
            marker=go.Marker(
                size=dff['Magnitude'] * radius_multiplier['inner'],
                colorscale=colorscale_depth,
                color=dff['Depth'],
                opacity=1,
            ),
            # hovering behavior is already handled by outer circles
            hoverinfo='skip',
            showlegend=False
        ),
    ])

    figure = go.Figure(data=data, layout=layout)
    return figure 
开发者ID:jackdbd,项目名称:dash-earthquakes,代码行数:61,代码来源:app.py

示例6: plot

# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Data [as 别名]
def plot(self, figure_or_data, validate=True):
        """Plot figure_or_data in the Plotly graph widget.

        Args:
            figure_or_data (dict, list, or plotly.graph_obj object):
                The standard Plotly graph object that describes Plotly
                graphs as used in `plotly.plotly.plot`. See examples
                of the figure_or_data in https://plot.ly/python/

        Returns: None

        Example 1 - Graph a scatter plot:
        ```
        from plotly.graph_objs import Scatter
        g = GraphWidget()
        g.plot([Scatter(x=[1, 2, 3], y=[10, 15, 13])])
        ```

        Example 2 - Graph a scatter plot with a title:
        ```
        from plotly.graph_objs import Scatter, Figure, Data
        fig = Figure(
            data = Data([
                Scatter(x=[1, 2, 3], y=[20, 15, 13])
            ]),
            layout = Layout(title='Experimental Data')
        )

        g = GraphWidget()
        g.plot(fig)
        ```

        Example 3 - Clear a graph widget
        ```
        from plotly.graph_objs import Scatter, Figure
        g = GraphWidget()
        g.plot([Scatter(x=[1, 2, 3], y=[10, 15, 13])])

        # Now clear it
        g.plot({}) # alternatively, g.plot(Figure())
        ```
        """
        if figure_or_data == {} or figure_or_data == Figure():
            validate = False

        figure = tools.return_figure_from_figure_or_data(figure_or_data,
                                                         validate)
        message = {
            'task': 'newPlot',
            'data': figure.get('data', []),
            'layout': figure.get('layout', {}),
            'graphId': self._graphId
        }
        self._handle_outgoing_message(message) 
开发者ID:jeanfeydy,项目名称:lddmm-ot,代码行数:56,代码来源:graph_widget.py


注:本文中的plotly.graph_objs.Data方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。