如何使用 Matplotlib 在 Seaborn jointplot 中自定義軸標籤?
要自定義 Seaborn jointplot 中的軸標籤,我們可以採取以下步驟
- 設定圖形大小並調整子圖之間和周圍的填充。
- 使用 numpy 建立 x 和 y 資料點。
- 使用jointplot()方法在 Seaborn 中繪製聯合圖。
- 要設定自定義軸標籤,我們可以使用 LaTex 表示或set_xlabel()方法屬性。
- 要顯示圖形,請使用show()方法。
示例
import seaborn as sns
import numpy as np
from matplotlib import pyplot as plt
plt.rcParams["figure.figsize"] = [7.50, 3.50]
plt.rcParams["figure.autolayout"] = True
x = np.random.randn(1000,)
y = 0.2 * np.random.randn(1000) + 0.5
h = sns.jointplot(x, y, height=3.50)
h.ax_joint.set_xlabel('$\bf{X-Axis\ Label}$')
plt.show()輸出
廣告
資料結構
網路
關係型資料庫管理系統 (RDBMS)
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP