Seaborn风格细节设置

  1. 图和轴线的距离

    #f, ax = plt.subplots()
    sns.violinplot(data)
    sns.despine(offset=10)
    

    运行结果:
    在这里插入图片描述

  2. 指定隐藏的轴

    sns.set_style("whitegrid")
    sns.boxplot(data=data, palette="deep")
    sns.despine(left=True)
    

    运行结果:
    在这里插入图片描述

  3. 不同子图风格

    with sns.axes_style("darkgrid"):
        plt.subplot(211)
        sinplot()
    plt.subplot(212)
    sinplot(-1)
    

    运行结果:
    在这里插入图片描述

  4. 设置布局

    sns.set()
    sns.set_context("paper")
    plt.figure(figsize=(8, 6))
    sinplot()
    

    运行结果:
    在这里插入图片描述

    sns.set_context("talk")
    plt.figure(figsize=(8, 6))
    sinplot()
    

    运行结果:
    在这里插入图片描述

    sns.set_context("poster")
    plt.figure(figsize=(8, 6))
    sinplot()
    

    运行结果:
    在这里插入图片描述

    sns.set_context("notebook", font_scale=1.5, rc={"lines.linewidth": 2.5})
    sinplot()
    

    运行结果:
    在这里插入图片描述

发布了301 篇原创文章 · 获赞 30 · 访问量 4万+

猜你喜欢

转载自blog.csdn.net/weixin_42260102/article/details/103446524
今日推荐