0
我想繪製一個等值線圖(使用contourf
),但我也想通過特定的點(如下圖所示)在兩側顯示切片。 一邊有一維切片的Python輪廓圖
我想繪製一個等值線圖(使用contourf
),但我也想通過特定的點(如下圖所示)在兩側顯示切片。 一邊有一維切片的Python輪廓圖
您顯示的圖是通過seaborn jointplot
生成的。
This example顯示如何產生這種情節。
import numpy as np
import pandas as pd
import seaborn as sns
# Generate a random correlated bivariate dataset
rs = np.random.RandomState(5)
mean = [0, 0]
cov = [(1, .5), (.5, 1)]
x1, x2 = rs.multivariate_normal(mean, cov, 500).T
x1 = pd.Series(x1, name="$X_1$")
x2 = pd.Series(x2, name="$X_2$")
# Show the joint distribution using kernel density estimation
g = sns.jointplot(x1, x2, kind="kde", size=7, space=0)
import matplotlib.pyplot as plt
plt.show()