Python seaborn.load_dataset() Examples

The following are 2 code examples of seaborn.load_dataset(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module seaborn , or try the search function .
Example #1
Source File: test_viz.py    From mpl-probscale with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
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 
Example #2
Source File: parkDataVisulization.py    From python-urbanPlanning with MIT License 5 votes vote down vote up
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))