如何在 Seaborn 中更改 regplot 的绘图大小? [英] How do I change the plot size of a regplot in Seaborn?

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

问题描述

与matplotlib的 fig.set_size_inches(18.5,10.5)类似.

Something similar to the fig.set_size_inches(18.5, 10.5) of matplotlib.

推荐答案

您可以先通过 plt.subplots()声明 fig,ax 对,然后设置适当的大小在那张图上,然后让 sns.regplot 在那个 ax

You can declare fig, ax pair via plt.subplots() first, then set proper size on that figure, and ask sns.regplot to plot on that 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()

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

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