Seaborn中按类别划分的阴影颜色

我有两个类别的熊猫数据框。

%pylab inline

import pandas as pd
import numpy as np
import seaborn as sns; sns.set();sns.set_style("whitegrid")

df = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list('ABCD'))
df['category'] = df['A'].mod(2)
df['category_2'] = df['B'].mod(3)
df

以这种方式绘制时:

sns.lineplot(x='C', y='D', data=df, hue='category', size='category_2', style='category_2')

the color is constant for all the 0/1 values of category. However, instead, I want to specify a specific color (range) for the two values of category and have hue generate this color range for 0/1 depending on the numeric size of category_2.

编辑

看起来像一个不错的第一次尝试:

sns.relplot(x="D", y="D", hue="category", size="category_2",
                palette=["b", "r"], sizes=(10, 100),
                col="category", data=df)

但是缺少的是:

  • 他们应该在下面,而不是彼此相邻
  • 颜色是二进制且没有阴影,即我想将它们覆盖以更好地比较它们