[英]Why does Seaborn lineplot "size" argument end up as legend artist?
使用linewidth
參數設置線條的寬度。 size 參數還有其他作用。 查看文檔中的示例以了解如何使用它。 下圖給人留下了很好的印象,也清楚地說明了為什么參數會導致圖例條目。
尺寸用於分組,根據類別會有不同的尺寸線。
例如,您可以根據kind
列有不同的大小:
import seaborn as sns
from matplotlib import pyplot as plt
df = sns.load_dataset('geyser')
fig, ax = plt.subplots()
sns.lineplot(
x=df.waiting,
y=df.duration,
label='Label',
size = df['kind'],
ax=ax
)
plt.show()
雖然不確定它作為一個數字在做什么。 您可以使用linewidth
來設置線條大小:
import seaborn as sns
from matplotlib import pyplot as plt
df = sns.load_dataset('geyser')
fig, ax = plt.subplots()
sns.lineplot(
x=df.waiting,
y=df.duration,
label='Label',
linewidth = 3,
ax=ax
)
plt.show()
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.