如何使用 Matplotlib 中的 Seaborn factorplot 更改圖形大小?
為了使用 Seaborn factorplot 更改圖形大小,我們可以採取以下步驟 −
使用 load_dataset() 方法載入練習資料。
使用 factorplot() 方法,透過自定義大小和寬高比值來更改圖形大小。
要顯示圖形,請使用 show() 方法。
示例
import seaborn as sns from matplotlib import pyplot as plt plt.rcParams["figure.figsize"] = [7.50, 3.50] plt.rcParams["figure.autolayout"] = True exercise = sns.load_dataset("exercise") sns.factorplot("kind", "pulse", "diet", exercise, kind="point", size=5, aspect=2) plt.show()
輸出
廣告