change line style in seaborn facet grid

后端 未结 1 938
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-06 05:12

I have a data set like this

import numpy as np; np.random.seed(3)
import pandas as pd
import seaborn.apionly as sns
import matplotlib.pyplot as plt

def get_         


        
相关标签:
1条回答
  • 2021-01-06 06:03

    You can use the hue_kws argument to FacetGrid for changing the color or linestyle of the mapped plot.

    d = {'color': ['C0', 'k'], "ls" : ["-","--"]}
    g = sns.FacetGrid(data, col="overlap",  hue="comp", row="data",hue_kws=d )
    

    If more hue levels are used, more colors and linestyles need to be provided, e.g. d = {'color': ['C0', 'k', "crimson"], "ls" : ["-","--", "-."]} for 3 hue levels.

    To change the xlimits you can use the xlim argument

    g = sns.FacetGrid(..., xlim=(-10,40) )
    

    0 讨论(0)
提交回复
热议问题