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


Python seaborn.load_dataset方法代码示例

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


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

示例1: test_probplot_with_FacetGrid_with_markers

# 需要导入模块: import seaborn [as 别名]
# 或者: from seaborn import load_dataset [as 别名]
def test_probplot_with_FacetGrid_with_markers(usemarkers):
    iris = seaborn.load_dataset("iris")

    hue_kws = None
    species = sorted(iris['species'].unique())
    markers = ['o', 'o', 'o']
    if usemarkers:
        markers = ['o', 's', '^']
        hue_kws = {'marker': markers}

    fg = (
        seaborn.FacetGrid(data=iris, hue='species', hue_kws=hue_kws)
            .map(viz.probplot, 'sepal_length')
            .set_axis_labels(x_var='Probability', y_var='Sepal Length')
            .add_legend()
    )

    _lines = filter(lambda x: isinstance(x, matplotlib.lines.Line2D), fg.ax.get_children())
    result_markers = {
        l.get_label(): l.get_marker()
        for l in _lines
    }
    expected_markers = dict(zip(species, markers))
    assert expected_markers == result_markers 
开发者ID:matplotlib,项目名称:mpl-probscale,代码行数:26,代码来源:test_viz.py

示例2: heatmap_pData

# 需要导入模块: import seaborn [as 别名]
# 或者: from seaborn import load_dataset [as 别名]
def heatmap_pData(df):
    import pandas as pd
    import seaborn as sns
    sns.set()
    
    # Load the brain networks example dataset
    # df = sns.load_dataset("brain_networks", header=[0, 1, 2], index_col=0)
    
    # Select a subset of the networks
    used_networks = [1, 5, 6, 7, 8, 12, 13, 17]
    # used_columns = [True,]*len(df.columns)
    
    # print(len(used_columns))
    # print(used_columns)
    # df = df.loc[:, used_columns]
    columnsList=['shapelyArea', 'shapelyLength','shapeIdx', 'FRAC', 
                 'popu_mean', 'popu_std','SVFW_mean', 'SVFW_std',
                 'SVFep_std', 'SVFep_median','SVFep_majority', 'SVFep_minority',
                 'facilityFre',
                 'HVege_mean','HVege_count','MVege_mean', 'MVege_count','LVege_mean', 'LVege_count',
                 'cla_treeCanopy', 'cla_grassShrub', 'cla_bareSoil','cla_buildings', 'cla_roadsRailraods', 'cla_otherPavedSurfaces','cla_water',
                 ]
    df=df[columnsList]
    
    # Create a categorical palette to identify the networks
    network_pal = sns.husl_palette(8, s=.45)
    network_lut = dict(zip(map(str, used_networks), network_pal))
    
    # Convert the palette to vectors that will be drawn on the side of the matrix
    networks = df.columns
    network_colors = pd.Series(networks, index=df.columns).map(network_lut)
    
    # Draw the full plot
    sns.clustermap(df.corr(), center=0, cmap="vlag",
                    row_colors=network_colors, col_colors=network_colors,
                    linewidths=.75, figsize=(13, 13)) 
开发者ID:richieBao,项目名称:python-urbanPlanning,代码行数:38,代码来源:parkDataVisulization.py


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