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()
  • 相关阅读:
    收藏
    计算矩阵连乘
    关于sublime text
    关于拓扑排序(topologicalsort)
    生成最小树prim算法
    矩阵转置的两种算法
    android wifi热点 socket通信
    AsyncTask异步任务类使用学习
    数据库操作学习
    android 监听短信并发送到服务器
  • 原文地址:https://www.cnblogs.com/huangshiyu13/p/6617999.html
Copyright © 2011-2022 走看看