在seaborn factorplot中绘制虚线

use*_*827 1 python matplotlib seaborn

import seaborn as sns
sns.set(style="ticks")
exercise = sns.load_dataset("exercise")
g = sns.factorplot(x="time", y="pulse", hue="kind", data=exercise)
Run Code Online (Sandbox Code Playgroud)

在上图中,有没有办法将其中一种线型绘制为虚线,例如将"其余"线绘制为虚线.

Ser*_*ity 6

使用linestyles参数并根据matplotlib 选择所需的行类型:

import seaborn as sns
import matplotlib.pylab as plt
sns.set(style="ticks")
exercise = sns.load_dataset("exercise")
g = sns.factorplot(x="time", y="pulse", hue="kind", data=exercise, linestyles=[":", "-","-"])
plt.show()
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述