如何在Seaborn中更改重新绘制的地块大小?

发布于 2021-01-29 16:34:54

fig.set_size_inches(18.5, 10.5)matplotlib相似。

关注者
0
被浏览
41
1 个回答
  • 面试哥
    面试哥 2021-01-29
    为面试而生,有面试问题,就找面试哥。

    您可以先声明fig, axplt.subplots(),然后在该图上设置适当的大小,然后要求sns.regplot在该图上进行绘制ax

    import numpy as np
    import seaborn as sns
    import matplotlib.pyplot as plt
    
    # some artificial data
    data = np.random.multivariate_normal([0,0], [[1,-0.5],[-0.5,1]], size=100)
    
    # plot
    sns.set_style('ticks')
    fig, ax = plt.subplots()
    fig.set_size_inches(18.5, 10.5)
    sns.regplot(data[:,0], data[:,1], ax=ax)
    sns.despine()
    

    在此处输入图片说明



知识点
面圈网VIP题库

面圈网VIP题库全新上线,海量真题题库资源。 90大类考试,超10万份考试真题开放下载啦

去下载看看