This example relplot call produces the wrong legend. In the example, both the legend of the variables used for hue and style are depicted as the line-style, instead of having one legend part for the color and the other for the style:
# Testdata
data = pd.DataFrame([(0, 0, 0, 0),
(0, 0, 1, 1),
(0, 1, 0, 1),
(0, 1, 1, 0),
(1, 0, 0, 0),
(1, 0, 1, 0),
(1, 1, 0, 1),
(1, 1, 1, 1)],
columns=['a', 'b', 'x', 'y'])
sns.relplot(x='x', y='y', hue='a', style='b', kind='line', data=data)
md5-b2dec66e62a8ea7622dc51e79ea12934
sns.lineplot(x='x', y='y', hue='a', style='b', data=data)
I tested this with python 3.5.2 and seaborn 0.9.0.
Yep this is a bug in FacetGrid. It predates and did not anticipate having multiple semantic variables in the legend. The problem is that it manages its legend data with a dictionary where the keys are values names. I intend to fix it for a 0.9.1 release but it will take a little bit of work with some care in not breaking other things.
Unfortunately I'm not aware of a great workaround when level names are shared across the semantic variables. I guess if you have string-typed levels you could add trailing spaces to differentiate them. Annoying, I know.
Most helpful comment
Yep this is a bug in
FacetGrid. It predates and did not anticipate having multiple semantic variables in the legend. The problem is that it manages its legend data with a dictionary where the keys are values names. I intend to fix it for a 0.9.1 release but it will take a little bit of work with some care in not breaking other things.Unfortunately I'm not aware of a great workaround when level names are shared across the semantic variables. I guess if you have string-typed levels you could add trailing spaces to differentiate them. Annoying, I know.