Ctrl7
Ctrl7

Reputation: 161

Changing sns clustermap x axis, label color to white

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)
                            

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

Upvotes: 0

Views: 1303

Answers (1)

GiovaPy
GiovaPy

Reputation: 42

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

Upvotes: 2

Related Questions