如何设置Barplot的高度?

时间:2018-10-25 13:44:31

标签: python python-3.x matplotlib

我尝试设置一个小节的结果的高度。

有人可以帮助我吗?

实际上,我有这个结果吗?

enter image description here

谢谢

1 个答案:

答案 0 :(得分:1)

我通常使用subplots中的matplotlib函数来控制图形尺寸。对于seaborn,您通常可以沿matplotlib轴传递。

import matplotlib.pyplot as plt
import seaborn as sns

height = 20
width = 10
fig, ax = plt.subplots(figsize=(height,width)) # I might have swapped height and width here, I never remeber which order they're in

# Do what you had before with barplot just pass in your axis as the ax key word:
sns.barplot(..., ax=ax)