【问题标题】:Figure size with 0 Axes, using jupiter, seaborn catplot0 轴的图形大小,使用 jupiter,seaborn catplot
【发布时间】:2021-10-26 02:03:27
【问题描述】:

我使用 seaborn 绘制小提琴直方图。当我用plt.figure(figsize=(16,10), dpi= 80)改变figsize时,jupiter输出Figure size with 0 Axes和原来的小提琴图。

plt.figure(figsize=(16,10), dpi= 80)
sns.catplot(x=" ", y=" ", hue=" ", kind="violin", split=True,  data=data)
plt.show()

【问题讨论】:

  • 请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。

标签: python matplotlib seaborn jupyter


【解决方案1】:

sns.catplot 有两个参数,“height 和 aspet”,用来改变这个 seaborn 图形的图形大小。 plt.figure(figsize=(16,10), dpi= 80) 只会创建一个空图形,无法更改图形大小。

“身高和长宽高”的含义如下:

height    scalar
Height (in inches) of each facet. 

aspect    scalar
Aspect ratio of each facet, so that aspect * height gives the width of each facet in inches.

对于您的代码,您可以将其更改为以下

sns.catplot(x=" ", y=" ", hue=" ", kind="violin", split=True, height=8, aspect=1.5,  data=data)
plt.show()

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-11-10
    • 2021-06-18
    • 2019-11-23
    • 2020-05-24
    • 2019-08-30
    相关资源
    最近更新 更多