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


Python graph_objs.Contour方法代码示例

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


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

示例1: __2D_density_plot

# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Contour [as 别名]
def __2D_density_plot (self,
        x_field_name, y_field_name, x_lab, y_lab, x_scale, y_scale, x_nbins, y_nbins,
        colorscale, smooth_sigma, width, height, plot_title):
        """Private function generating density plots for all 2D distribution functions"""
        self.logger.info ("\t\tComputing plot")

        # Prepare all data
        lab1, dd1 = self.__2D_density_data ("all", x_field_name, y_field_name, x_nbins, y_nbins, x_scale, y_scale, smooth_sigma)
        lab2, dd2 = self.__2D_density_data ("pass", x_field_name, y_field_name, x_nbins, y_nbins, x_scale, y_scale, smooth_sigma)

        # Plot initial data
        data = [
            go.Contour (x=dd1["x"][0], y=dd1["y"][0], z=dd1["z"][0], contours=dd1["contours"][0],
                name="Density", hoverinfo="name+x+y", colorscale=colorscale, showlegend=True, connectgaps=True, line={"width":0}),
            go.Scatter (x=dd1["x"][1], y=dd1["y"][1],
                mode='markers', name='Median', hoverinfo="name+x+y", marker={"size":12,"color":'black', "symbol":"x"})]

        # Create update buttons
        updatemenus = [
            dict (type="buttons", active=0, x=-0.2, y=0, xanchor='left', yanchor='bottom', buttons = [
                dict (label=lab1, method='restyle', args=[dd1]),
                dict (label=lab2, method='restyle', args=[dd2])])]

        # tweak plot layout
        layout = go.Layout (
            hovermode = "closest",
            plot_bgcolor="whitesmoke",
            legend = {"x":-0.2, "y":1,"xanchor":'left',"yanchor":'top'},
            updatemenus = updatemenus,
            width = width,
            height = height,
            title = {"text":plot_title, "xref":"paper" ,"x":0.5, "xanchor":"center"},
            xaxis = {"title":x_lab, "showgrid":True, "zeroline":False, "showline":True, "type":x_scale},
            yaxis = {"title":y_lab, "showgrid":True, "zeroline":False, "showline":True, "type":y_scale})

        return go.Figure (data=data, layout=layout) 
开发者ID:a-slide,项目名称:pycoQC,代码行数:38,代码来源:pycoQC_plot.py

示例2: func

# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Contour [as 别名]
def func(custom_data_storage):
    data = json.loads(custom_data_storage)

    trace0 = go.Contour(
        x=np.linspace(0, 10, 200),
        y=np.linspace(0, 10, 200),
        z=np.ones(shape=(200, 200)),
        showscale=False,
        hoverinfo='none',
        contours=dict(coloring='lines'),
    )
    trace1 = go.Scatter(
        x=data['train_X'],
        y=data['train_y'],
        mode='markers',
        name='Training'
    )
    trace2 = go.Scatter(
        x=data['test_X'],
        y=data['test_y'],
        mode='markers',
        name='Training'
    )

    data = [trace0, trace1, trace2]
    figure = go.Figure(data=data)
    return figure 
开发者ID:plotly,项目名称:dash-regression,代码行数:29,代码来源:add_remove_points.py

示例3: name

# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Contour [as 别名]
def name():
        return PlotType.tr('Contour Plot') 
开发者ID:ghtmtt,项目名称:DataPlotly,代码行数:4,代码来源:contour.py

示例4: create_trace

# 需要导入模块: from plotly import graph_objs [as 别名]
# 或者: from plotly.graph_objs import Contour [as 别名]
def create_trace(settings):
        return [graph_objs.Contour(
                z=[settings.x, settings.y],
                contours=dict(
                    coloring=settings.properties['cont_type'],
                    showlines=settings.properties['show_lines']
                ),
                colorscale=settings.properties['color_scale'],
                opacity=settings.properties['opacity']
            )] 
开发者ID:ghtmtt,项目名称:DataPlotly,代码行数:12,代码来源:contour.py


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