在seaborn factorplot中绘制虚线

时间:2017-08-07 06:48:09

标签: 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)

在上图中,有没有办法将其中一种线型绘制为虚线,例如策划休息'如虚线所示。

1 个答案:

答案 0 :(得分:6)

使用linestyles参数并根据matplotlib选择desired type of line

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()

enter image description here