Setting plot background colour in Seaborn

后端 未结 3 1473
深忆病人
深忆病人 2021-02-05 13:51

I am using Seaborn to plot some data in Pandas.

I am making some very large plots (factorplots).

To see them, I am using some visualisation faciliti

3条回答
  •  再見小時候
    2021-02-05 14:17

    I am not familiar with seaborn but the following appears to let you change the background by setting the axes background. It can set any of the ax.set_* elements.

    import seaborn as sns
    import pandas as pd 
    import numpy as np
    import matplotlib.pyplot as plt
    
    m=pd.DataFrame({'x':['1','1','2','2','13','13'],
                    'y':np.random.randn(6)})
    
    facet = sns.factorplot('x','y',data=m)
    
    facet.set(axis_bgcolor='k')
    
    plt.show()
    

提交回复
热议问题