zoukankan      html  css  js  c++  java
  • Python之Seaborn

    install:  

    pip install seaborn

    official examples: https://seaborn.pydata.org/examples/index.html

    在mac上的bug:

    在mac上运行会出现warnings.warn("tight_layout : falling back to Agg renderer")

    需要在tight_layout()前添加plt.show(),如果tight_layout()被内置到了API中,我就不知道怎么办了。例子:

    import numpy as np
    import seaborn as sns
    import matplotlib.pyplot as plt
    
    sns.set(style="dark")
    rs = np.random.RandomState(50)
    
    # Set up the matplotlib figure
    f, axes = plt.subplots(3, 3, figsize=(9, 9), sharex=True, sharey=True)
    
    # Rotate the starting point around the cubehelix hue circle
    for ax, s in zip(axes.flat, np.linspace(0, 3, 10)):
    
        # Create a cubehelix colormap to use with kdeplot
        cmap = sns.cubehelix_palette(start=s, light=1, as_cmap=True)
    
        # Generate and plot a random bivariate dataset
        x, y = rs.randn(2, 50)
        sns.kdeplot(x, y, cmap=cmap, shade=True, cut=5, ax=ax)
        ax.set(xlim=(-3, 3), ylim=(-3, 3))
    plt.show()  # I just add this line, and it works
    f.tight_layout()
  • 相关阅读:
    类目(分类)
    协议(Protocol)---实例
    OC 复合 组装电脑
    iOS--九宫格奥秘(UIView)(arc4random)
    字符串
    oc 字符串
    七星彩问题
    OC--第一个程序
    关于行内元素垂直居中的一个小小trick
    关于orgChart
  • 原文地址:https://www.cnblogs.com/huangshiyu13/p/6617999.html
Copyright © 2011-2022 走看看