
然后我尝试在代码中添加style=“logic”,现在标记出现了:
sns.lineplot(x=“n_index”,y=“value”,hue=“logic”,style=“logic”,markers=true,data=df)
< /代码>

另外,我还尝试强制标记采用相同的样式:
sns.lineplot(x=“n_index”,y=“value”,hue=“logic”,style=“logic”,markers=[“o”,“o”],data=df)
< /代码>

似乎我必须先指定样式才能使用标记。但是,这会导致不希望的绘图输出,因为我不想在一个数据维度上使用两个美学维度。这违反了美学映射的原则。
是否有任何方法可以使线条和点都具有相同的样式,但具有不同的颜色(使用seaborn或python visualization)?(seabornis preferred-I don't like the looping way ofmatplotlib.>code>)
我想使用颜色和唯一的颜色辨别logic在线图中,标记点value特别是,这是我想要的输出(由R绘制ggplot2):
ggplot(aes(x = n_index, y = value, color = logic), data = df) + geom_line() + geom_point()

我也试着做同样的事seaborn.lineplot,我指定了markers=True但没有标记:
import seaborn as sns
sns.set()
sns.lineplot(x="n_index", y="value", hue="logic", markers=True, data=df)

然后我尝试添加style="logic"在代码中,现在标记出现了:
sns.lineplot(x="n_index", y="value", hue="logic", style="logic", markers=True, data=df)

另外,我尝试强制标记采用相同的样式:
sns.lineplot(x="n_index", y="value", hue="logic", style="logic", markers=["o", "o"], data=df)

好像我必须说明style在我有记号笔之前。但是,这会导致不需要的绘图输出,因为我不想在一个数据维度上使用两个美学维度。这违反了美学绘图的原则。
有没有什么方法可以让线条和点都是同一样式,但颜色不同seaborn还是Python可视化?(西伯恩是首选-我不喜欢matplotlib)