【发布时间】:2025-12-10 03:55:01
【问题描述】:
当我制作一个将 shade 参数设置为 True 的 seaborn.kdeplot 时,背景是白色的。如果在更宽的范围(此处为蓝线)上绘制了其他内容,则此背景不会扩展到整个图。如何让 kdeplot “扩展到”整个情节?
(最终,让 kdeplot 的第一个阴影是透明的也可以解决问题)
例子:
import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
plt.plot([-3, 3],[0,60])
points = np.random.multivariate_normal([0, 0], [[1, 2], [2, 20]], size=1000)
sns.kdeplot(points, shade=True)
plt.show()
【问题讨论】:
-
不确定目前是否可行,请随时打开 github 问题
标签: python matplotlib seaborn