首页 > 解决方案 > Seaborn散点图增加了vline标记的粗细

问题描述

我正在生成一个 KDE 图并将数据点添加为散点图。我正在使用 vline 标记“|” 对于这个散点图。我怎样才能增加这个标记的厚度。增加s=200s=1000增加高度。有没有办法在不改变高度的情况下改变厚度?

import seaborn as sns
import numpy as np
import matplotlib.pyplot as plt
numberList = np.random.rand(20)
ax = sns.kdeplot(numberList)
ax = sns.scatterplot(x=numberList, y=0.1, marker='|', s=200)
plt.show()

输出

标签: pythonmatplotlibseaborn

解决方案


我找到了解决方案。添加参数有linewidth=3帮助。

ax = sns.scatterplot(x=numberList, y=0.1, marker="|", s=200, linewidth=3)

在此处输入图像描述


推荐阅读