如何在Python Seaborn包中更改图形的大小 [英] How to change a figure's size in Python Seaborn package

查看:2214
本文介绍了如何在Python Seaborn包中更改图形的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法使用Seaborn(导入为sns)来增加绘图的大小.我正在使用sns.pairplot相互绘制数据框的列.

I'm having trouble increasing the size of my plot figures using Seaborn (imported as sns). I'm using sns.pairplot to plot columns of a data frame against one another.

    %matplotlib inline
    plt.rcParams['figure.figsize']=10,10
    columns=list(df.columns.values)
    g=sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])

用数据填充的图很好,但是图形尺寸太小.

The plots populate with data just fine, but the figure size is too small.

我认为plot.rCParams['figure.figsize']将控制图形的大小,但是它似乎没有生效.我从网上论坛尝试了一些不同的建议,但似乎没有任何效果.

I thought plot.rCParams['figure.figsize'] would control how large the figure is, but it doesn't seem to take effect. I've tried a few different suggestions from online boards, but nothing seems to work.

推荐答案

sns.pairplot 返回基础的PairGrid实例以进行进一步调整" ...例如更改图形大小:

sns.pairplot "Returns the underlying PairGrid instance for further tweaking" ...for instance changing the figure size:

g=sns.pairplot(df, kind='reg', x_vars=columns,y_vars = ['Column 1'])
g.fig.set_size_inches(15,15)

这篇关于如何在Python Seaborn包中更改图形的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆