Home > OS >  Changing sns clustermap x axis, label color to white
Changing sns clustermap x axis, label color to white

Time:01-29

I've set my plot to transparent so when i access it after plotting,axis and labels looks dark How can i set the label's and axis to "white" .??

I've tried this

import seaborn as sns 
DATA=sns.load_dataset("tips")           
import matplotlib.pyplot as plt                 
plt.figure()      
sns.set_style(style="white")
              
ax=sns.clustermap(DATA.corr(), 
cmap="viridis")

#ax.xaxis.label.set_color('white')
#ax.yaxis.label.set_color('white')
             
plt.savefig("clustermap",transparent=True)
                            

What i get

enter image description here

Note that i don't want to change the ' background ' color, just the label and axis color

CodePudding user response:

You can probably use the seaborn.set() function. Here you have a previous answer:

Setting plot background colour in Seaborn

Here you have an example it seems to work in your case (at least in my environment ;-) ):

sns.set(rc={'axes.facecolor':'white', 'figure.facecolor':'white'})

to change just the axis's labels you can use this:

sns.set(rc{'ytick.labelcolor':'white','xtick.labelcolor':'white'}) 

There are a lot of very fine parameters to set your plot. You can review the full list of parameters just with the command:

plt.rcParams

You can get many details on such command in the link I gave before, going to the Joelostblom answer

  •  Tags:  
  • Related