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


Python graph_objects.Layout方法代码示例

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


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

示例1: score_table

# 需要导入模块: from plotly import graph_objects [as 别名]
# 或者: from plotly.graph_objects import Layout [as 别名]
def score_table(quality_estimation, field_accuracy) -> go.FigureWidget:
    cells = [
        ["<b>Field Accuracy Score</b>", "<b>Overall Quality Score</b>"],
        ["<b>" + str(field_accuracy) + "<b>", "<b>" + str(quality_estimation) + "</b>"],
    ]

    font = dict(color="black", size=20)
    trace = go.Table(
        header=dict(
            values=[cells[0][0], cells[1][0]], fill=dict(color="gray"), font=font
        ),
        cells=dict(
            values=[cells[0][1:], cells[1][1:]],
            fill=dict(color=[[get_color(quality_estimation)]]),
            font=font,
        ),
    )

    layout = go.Layout(autosize=True, margin=dict(l=0, t=25, b=25, r=0), height=150)
    return go.FigureWidget(data=[trace], layout=layout) 
开发者ID:scrapinghub,项目名称:arche,代码行数:22,代码来源:tables.py

示例2: make_chart

# 需要导入模块: from plotly import graph_objects [as 别名]
# 或者: from plotly.graph_objects import Layout [as 别名]
def make_chart(title):
    import json

    import plotly.graph_objects as go
    import plotly

    layout = go.Layout(title=title)

    data = go.Scatter(
        x=[1, 2, 3, 4],
        y=[10, 11, 12, 13],
        mode="markers",
        marker=dict(size=[40, 60, 80, 100], color=[0, 1, 2, 3]),
    )

    fig = go.Figure(data=data)
    fig = json.dumps(fig, cls=plotly.utils.PlotlyJSONEncoder)
    layout = json.dumps(layout, cls=plotly.utils.PlotlyJSONEncoder)
    return fig, layout 
开发者ID:apryor6,项目名称:flaskerize,代码行数:21,代码来源:view.py

示例3: performance_plot

# 需要导入模块: from plotly import graph_objects [as 别名]
# 或者: from plotly.graph_objects import Layout [as 别名]
def performance_plot(perf, title):
    formats = ['nbformat'] + JUPYTEXT_FORMATS
    mean = perf.groupby('implementation').mean().loc[formats]
    std = perf.groupby('implementation').std().loc[formats]
    data = [go.Bar(x=mean.index,
                   y=mean[col],
                   error_y=dict(
                       type='data',
                       array=std[col],
                       color=color,
                       thickness=0.5
                   ) if col != 'size' else dict(),
                   name=col,
                   yaxis={'read': 'y1', 'write': 'y2', 'size': 'y3'}[col])
            for col, color in zip(mean.columns, DEFAULT_PLOTLY_COLORS)]
    layout = go.Layout(title=title,
                       xaxis=dict(title='Implementation', anchor='y3'),
                       yaxis=dict(domain=[0.7, 1], title='Read (secs)'),
                       yaxis2=dict(domain=[0.35, .65], title='Write (secs)'),
                       yaxis3=dict(domain=[0, .3], title='Size')
                       )
    return go.Figure(data=data, layout=layout) 
开发者ID:mwouts,项目名称:jupytext,代码行数:24,代码来源:Benchmarking Jupytext.py

示例4: get_layout

# 需要导入模块: from plotly import graph_objects [as 别名]
# 或者: from plotly.graph_objects import Layout [as 别名]
def get_layout(name: str, rows_count: int) -> go.Layout:
        return go.Layout(
            title=name,
            bargap=0.1,
            template="seaborn",
            height=min(max(rows_count * 20, 200), 900),
            hovermode="y",
            margin=dict(l=200, t=35),
        ) 
开发者ID:scrapinghub,项目名称:arche,代码行数:11,代码来源:result.py

示例5: coverage_by_categories

# 需要导入模块: from plotly import graph_objects [as 别名]
# 或者: from plotly.graph_objects import Layout [as 别名]
def coverage_by_categories(category_field, df, product_url_fields) -> go.FigureWidget:
    if category_field not in df.columns:
        return None
    if df[category_field].notnull().sum() == 0:
        return None

    cat_grouping = (
        df.groupby(category_field)[category_field]
        .count()
        .sort_values(ascending=False)
        .head(20)
    )
    category_values = cat_grouping.values
    category_names = cat_grouping.index

    if product_url_fields is not None and product_url_fields[0] in df.columns:
        product_url_field = product_url_fields[0]
        category_urls = [
            df[df[category_field] == cat][product_url_field].head(1).values[0]
            for cat in category_names
        ]
        href_tag = '<a href="{}">{}</a>'
        category_names = [
            href_tag.format(link, cat)
            for cat, link in zip(category_names, category_urls)
        ]

    trace = go.Table(
        columnorder=[1, 2],
        columnwidth=[400, 80],
        header=dict(
            values=[f"CATEGORY", "SCRAPED ITEMS"],
            fill=dict(color="gray"),
            align=["left"] * 5,
            font=dict(color="white", size=12),
            height=30,
        ),
        cells=dict(
            values=[category_names, category_values],
            fill=dict(color="lightgrey"),
            font=dict(color="black", size=12),
            height=30,
            align="left",
        ),
    )
    layout = go.Layout(
        title=f"Top 20 Categories for '{category_field}'",
        autosize=True,
        margin=dict(t=30, b=25, l=0, r=0),
        height=(len(category_names) + 2) * 45,
    )
    return go.FigureWidget(data=[trace], layout=layout) 
开发者ID:scrapinghub,项目名称:arche,代码行数:54,代码来源:tables.py


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