seaborn.barplot是否将在不传递任何参数的情况下使用matplotlib.pyplot变量?

我从机器学习开始,最近一直在研究机器学习算法。我已经看到seaborn.barplot使用plt.figure显示图形而没有任何参数。那怎么可能?

fig = plt.figure(figsize = (7,7))
sns.barplot(x = 'quality',y = 'fixed acidity',data = wineData)

fig没有作为参数传递给sns.barplot,但它根据figsize显示了图形。

ldl274057936 回答:seaborn.barplot是否将在不传递任何参数的情况下使用matplotlib.pyplot变量?

import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
data = np.random.normal(0,1,3)
# array([-1.18878589,0.59627021,1.59895721])
plt.figure(figsize=(16,6))
sns.boxplot(x=data);
为了更改seaborn软件包的图形大小,请使用matplotlib.pyplot.figure
用于绘制条形图的seaborn函数,可将matplotlib.pyplot.figure与figsize关键字一起使用

enter image description here

,

在海洋条形码中,您会找到以下two lines

if ax is None:
    ax = plt.gca()

这意味着,如果用户未提供轴ax,则会使用当前图形中的当前轴。您已使用给定的图形大小创建了当前图形。因此,Seaborn绘制了该图的条形图。

本文链接:https://www.f2er.com/3133350.html

大家都在问